Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SageMaker Spaces #8

Merged
merged 5 commits into from
Apr 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.bkp

.DS_Store
**/.DS_Store
**/**/.DS_Store
**/**/**/.DS_Store
**/**/**/**/.DS_Store
**/**/**/**/**/.DS_Store
41 changes: 41 additions & 0 deletions Sagemaker-Spaces-management/ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Streamlining ML and DS development with Amazon SageMaker spaces

Amazon SageMaker Spaces is a feature that allows users to collaborate on machine learning projects in a secure and isolated environment. With SageMaker Spaces, users can create shared workspaces where they can share notebooks, files, experiments, and models with other users. Users can also control access to these resources, so they can be sure that their data is safe.

SageMaker Spaces is a great way to accelerate the machine learning development process. By sharing resources with other users, users can get feedback on their work quickly and easily. Users can also collaborate on experiments and models, which can help them to improve the quality of their results.

To get started with SageMaker Spaces, users first need to create a domain. A domain is a collection of shared workspaces. Once users have created a domain, they can create shared workspaces within it. To create a shared workspace, users need to specify a name for the workspace and a list of users who will have access to it.

Once users have created a shared workspace, they can start sharing resources with other users. To share a notebook, file, experiment, or model, users need to select the resource and then click the "Share" button. In the "Share with" dialog box, users can select the users who they want to share the resource with.

Users can also control access to resources by using IAM roles. When users create a shared workspace, they can specify an IAM role that will be used by default for all resources in the workspace. Users can also specify individual IAM roles for specific resources.

SageMaker Spaces is a powerful new feature that can help users to collaborate on machine learning projects more effectively. By sharing resources with other users, users can get feedback on their work quickly and easily. Users can also collaborate on experiments and models, which can help them to improve the quality of their results.

Here are some of the benefits of using Amazon SageMaker Spaces:
* Collaboration: SageMaker Spaces makes it easy for users to collaborate on machine learning projects. Users can share notebooks, files, experiments, and models with other users in a secure and isolated environment.
* Security: SageMaker Spaces provides a high level of security for user data. Users can control who has access to their resources and they can revoke access at any time.
* Scalability: SageMaker Spaces is designed to scale to meet the needs of the user's team. Users can create as many shared workspaces as they need and they can add users to these workspaces as needed.
* Cost-effectiveness: SageMaker Spaces is a cost-effective way for users to collaborate on machine learning projects. Users only pay for the resources that they use.
If users are looking for a way to collaborate on machine learning projects, then Amazon SageMaker Spaces is a great option. It is secure, scalable, and cost-effective.


This workshop consists of following modules:
- [AWS CodeCommit version control](./SETTING_UP.md#aws-codecommit-version-control)
- [IAM Policy to access the CodeCommit repository](./SETTING_UP.md#iam-policy-to-access-the-codecommit-repository)
- [SageMaker Spaces](./SETTING_UP.md#sagemaker-spaces)
- [Conclusion](./SETTING_UP.md#conclusion)
- [References](./SETTING_UP.md#references)


## Getting Started
[Setting up the environment and loading the notebooks in Sagemaker spaces](./SETTING_UP.md)

## Security

See [CONTRIBUTING](../CONTRIBUTING.md#security-issue-notifications) for more information.

## License

This library is licensed under the MIT-0 License. See the LICENSE file.

84 changes: 84 additions & 0 deletions Sagemaker-Spaces-management/SETTING_UP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@

## Amazon SageMaker Spaces configuration

To get started, you first need to create a source code repository

## AWS CodeCommit version control
* In the web browser, log in with your AWS credentials to the AWS Management console at https://console.aws.amazon.com/
* You can search for 'code' in the search bar and select 'CodeCommit'
![Image](./images/codecommit-search.png)
* When you go to the CodeCommit page, click on the 'Create repository' button.
![Image](./images/codecommit-repos.png)
* Enter a name for your repository and click on the 'Create' button at the bottom right corner.
![Image](./images/codecommit-create.png)
* AWS CodeCommit repository has been successfully created. Example: https://git-codecommit.us-east-1.amazonaws.com/v1/repos/spaces-repo
![Image](./images/codecommit-spaces.png)

## IAM Policy to access the CodeCommit repository
To create an IAM policy to access the CodeCommit repository, follow these steps:
* In the AWS Management console and navigate to the IAM service.
![Image](./images/console-iam.png)
* Click on the 'Policies' link in the left-hand menu.
![Image](./images/iam-leftnav.png)
* Click on the 'Create policy' button.
![Image](./images/iam-createpolicy.png)
* Select the 'JSON' tab and enter the following policy document, replacing '123456789012' with the Account information of your CodeCommit repository.
``````json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "CodeCommitPolicy",
"Effect": "Allow",
"Action": "codecommit:*",
"Resource": "arn:aws:codecommit:us-east-1:123456789012:spaces-repo"
}
]
}
``````
* Click on the 'Review policy' button.
![Image](./images/iam-reviewpolicy.png)
* Enter a name for your policy and click on the 'Create policy' button.
![Image](./images/iam-cc-policy.png)


## SageMaker Spaces
Create a SageMaker domain, follow these steps:
* Log in to the AWS Management Console and navigate to the SageMaker service.
![Image](./images/console-sagemaker.png)
* Click on the 'Create domain' button.
![Image](./images/sm-createdomain.png)
* Enter a name for your domain, user profile name, and execution role. Click on the "Submit" button.
![Image](./images/sm-domaindetails.png)
* The successfully created domain is displayed.
![Image](./images/sm-domain.png)
* You can view the recently created domain by selecting it and clicking 'View' button.
![Image](./images/sm-domainview.png)
* Create another user 'user2' by clicking 'Add user' button. Assign appropriate execution role 'AmazonSageMakerServiceCatalogProductsExecutionRole'.
![Image](./images/sm-domain-users.png)
* Select the user profile from the dropdown of 'user1' and then select Collabrative 'Spaces'
![Image](./images/sm-domain-user1.png)
* Creating the Jupyter notebook and launches the Amazon Sagemaker studio
* In Studio toolbar, go to File >> New >> Terminal launches CLI.
* Check out the codecommit url using Git CLI command
![Image](./images/sm-domain-user1-notebook.png)
* Create Notebook file 'HelloWorld.ipynb' and commit to CodeCommit
![Image](./images/sm-domain-user1-codecommit.png)
* Launch user2 in new browser window using Collabrative Spaces.
* Both users (user1 and user2) can expeiences for someone editing the notebook
![Image](./images/users-collaboration.gif)


## Conclusion
In this post, I've shown how to use Amazon SageMaker spaces to organize your ML resources, collaborate with team members, and streamline ML workflow. I've also demostrated how to use AWS CodeCommit repositories to version control using ML code.


## References
- [Onboard to Amazon SageMaker Domain Using Quick setup](https://docs.aws.amazon.com/sagemaker/latest/dg/onboard-quick-start.html)
- [How to manage Amazon SageMaker code with AWS CodeCommit](https://aws.amazon.com/blogs/publicsector/how-to-manage-amazon-sagemaker-code-aws-codecommit/)
- [AWS Policy Generator](https://awspolicygen.s3.amazonaws.com/policygen.html)
- [Collaborate with shared spaces](https://docs.aws.amazon.com/sagemaker/latest/dg/domain-space.html)
- [Organize machine learning development using shared spaces in SageMaker Studio for real-time collaboration](https://aws.amazon.com/blogs/machine-learning/organize-machine-learning-development-using-shared-spaces-in-sagemaker-studio-for-real-time-collaboration/)



Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Sagemaker-Spaces-management/images/diagram.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile host="Electron" modified="2023-04-28T23:20:15.825Z" agent="5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/20.8.16 Chrome/106.0.5249.199 Electron/21.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y6lkqzU+QTADkI03oMOIYz6GhBF0+EC0bTMwZ89YxxO016M43l823BGQKF7egtRyzrvcqybHw==</diagram></mxfile>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Sagemaker-Spaces-management/images/sm-domain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Sagemaker-Spaces-management/images/sm-role.png
Binary file not shown.