Inviting External Data Scientists to MongoDB Atlas for Joint Model Development
PythonWhen working with external data scientists on MongoDB Atlas for joint model development, you need to manage access and permissions carefully. This will typically involve creating or configuring MongoDB Atlas projects, defining user roles, providing the appropriate level of database access, and auditing interactions with the data.
Here is a Pulumi program in Python that demonstrates how to set up a MongoDB Atlas environment and manage invitations for external data scientists. In this program, we will use the
mongodbatlas
Pulumi package to create a MongoDB Atlas cluster, add a team, invite users to the team, and enable auditing for the project.Before you can run the program, ensure that you have the following prerequisites set up:
- A Pulumi account with the Pulumi CLI installed and configured.
- A MongoDB Atlas account with appropriate permissions and the Atlas API key correctly configured with Pulumi.
- Python 3 installed on your system.
The program consists of the following steps:
-
Setup MongoDB Atlas Project: Create a new project in MongoDB Atlas where the database cluster will reside.
-
Create Cluster: Provision a MongoDB Atlas cluster within the project. This is where the data will be stored and manipulated for model development.
-
Team Management: Create a team within your organization in MongoDB Atlas and invite external data scientists by their username. These users must have MongoDB Atlas accounts.
-
User Roles and Permissions: Assign appropriate roles to the invited team members. Roles define what actions the team members can perform within the MongoDB Atlas project.
-
Auditing: Enable auditing to keep a log of activities that the external data scientists perform within the Atlas project.
Below is a Pulumi program that accomplishes the above tasks:
import pulumi import pulumi_mongodbatlas as mongodbatlas # Replace these variables with the actual values for your MongoDB Atlas setup atlas_org_id = 'your_atlas_org_id' project_name = 'jointModelDevelopment' cluster_name = 'dataScienceCluster' team_name = 'externalDataScientists' # Create a new MongoDB Atlas project project = mongodbatlas.Project("project", org_id=atlas_org_id, name=project_name) # Create a MongoDB Atlas Cluster within the project cluster = mongodbatlas.Cluster("cluster", project_id=project.project_id, name=cluster_name, disk_size_gb=10, provider_name="AWS", provider_region_name="US_EAST_1", provider_instance_size_name="M10", provider_backup_enabled=True, mongo_db_major_version="4.4") # Create a team in MongoDB Atlas and invite members team = mongodbatlas.Team("team", org_id=atlas_org_id, name=team_name, usernames=['data_scientist_1@example.com', 'data_scientist_2@example.com']) # list of data scientist emails # Enable auditing for the project auditing = mongodbatlas.Auditing("auditing", project_id=project.project_id, enabled=True, audit_filter='{}') # Export the MongoDB Atlas project ID and cluster connection strings pulumi.export('project_id', project.project_id) pulumi.export('cluster_connection_string', cluster.connection_strings.apply(lambda cs: cs['standard']))
This code first creates a project within your MongoDB Atlas organization. It then provisions a new cluster for storing and processing your data. Following that, it creates a new team and invites external data scientists to the team by their MongoDB Atlas usernames. Lastly, it enables auditing for the new project to ensure all operations by the team members are logged and can be reviewed later.
After running this Pulumi program, you will have a MongoDB Atlas environment ready for external data scientists to contribute to your model development process. Remember to review and manage user permissions regularly to maintain the security and integrity of your data.
For more detailed information about each resource and property, you can visit the following links to the official documentation:
The invitation process requires that the invited members have a MongoDB Atlas account and accept the invitation. You should also manage your Atlas API keys securely and follow MongoDB Atlas’s best practices for user management and security.