Introducing Amazon SageMaker Spaces for Enhanced Machine Learning Development
Streamlining Interactive Development Environments in SageMaker HyperPod Clusters
Overview
Amazon SageMaker HyperPod clusters with Amazon Elastic Kubernetes Service (EKS) now support interactive development environments like JupyterLab and Visual Studio Code through the new SageMaker Spaces add-on.
Solution Overview
A structured guide on setting up and managing SageMaker Spaces in HyperPod clusters.
Installation Prerequisites
Ensure you meet necessary requirements to effectively use SageMaker Spaces.
Step-by-Step Installation and Configuration
Step 1: Install the Spaces Add-On
Follow the installation process to integrate the new feature.
Step 2: Create EKS Access Entries
Grant necessary permissions for user access.
Step 3: Create and Manage Spaces
Instructions for data scientists on utilizing SageMaker Spaces.
Best Practices for Efficient Use
Recommendations for user management, collaboration, and performance optimization.
Conclusion
A summary highlighting the benefits and the impact of SageMaker Spaces on ML development efficiency.
About the Authors
Meet the contributors behind the development of this feature at Amazon SageMaker.
Streamlining ML Development with Amazon SageMaker HyperPod and Spaces
Amazon SageMaker HyperPod, in collaboration with Amazon Elastic Kubernetes Service (EKS) orchestration, is revolutionizing the machine learning (ML) development lifecycle. By enabling the creation and management of interactive development environments such as JupyterLab and open-source Visual Studio Code, it empowers data scientists with managed environments tailored to their familiar tools. A game-changing feature, known as Amazon SageMaker Spaces, allows AI developers to create and manage self-contained environments for executing notebooks, enhancing productivity and collaboration in AI and ML workflows.
This feature facilitates maximizing GPU investments, allowing both interactive workloads and training jobs to run on the same infrastructure while supporting fractional GPU allocations to optimize cost efficiency. Say goodbye to the complexities of managing multiple development environments and focus your energy on building and deploying your AI and ML models.
Solution Overview
Key Components
In this section, we’ll highlight the core components involved in managing Spaces on HyperPod clusters. The process begins with the cluster administrator installing the Spaces add-on via the SageMaker AI console, choosing between a quick or custom installation. Once the cluster is prepared, data scientists and AI developers can create their own Spaces using the HyperPod Command Line Interface (CLI) or kubectl.
How It Works
-
Installation of Spaces Add-On:
- Administrators install the Spaces add-on from the SageMaker AI console. The Quick Install option is ideal for quick setups, while the Custom Install option allows for tailored configurations.
-
Space Creation:
- Data scientists create Spaces using commands in the HyperPod CLI or
kubectl.
- Data scientists create Spaces using commands in the HyperPod CLI or
-
Accessing Spaces:
- Users can connect to their created Spaces via:
- Web UI: Set up with an AWS Application Load Balancer (ALB) and Route 53 for DNS. Access securely through presigned URLs.
- Remote IDE Connection: Utilize SSH-over-SSM tunneling for secure connections to SageMaker Spaces pods, eliminating the need for managing SSH keys or exposing port 22.
- Users can connect to their created Spaces via:
Step-by-Step Guide to Setting Up SageMaker Spaces
Prerequisites
Before diving into the installation process, ensure you meet the following prerequisites:
- An AWS account with permissions to create IAM roles, SageMaker resources, and access EKS cluster resources.
- A SageMaker HyperPod cluster orchestrated using EKS, running Kubernetes version 1.30 or later.
- HyperPod CLI installed (or
kubectl). - A local IDE like VS Code, with the AWS Toolkit for VS Code installed.
Step 1: Install the Spaces Add-On
- Navigate to the Clusters option from the SageMaker AI console.
- Choose your HyperPod cluster.
- Click on the IDE and Notebooks tab and select Quick Install.
- Review the dependencies and click Install.
Note: The quick installation will set up default IAM roles and remote access components.
Step 2: Create or Update EKS Access Entries
Grant your users the necessary permissions through EKS access policies, specifically:
AmazonSagemakerHyperpodSpacePolicyAmazonSagemakerHyperpodSpaceTemplatePolicy
Step 3: Create and Manage Spaces
Data scientists can use the HyperPod CLI or kubectl to create JupyterLab and Code Editor Spaces. Here’s a snippet to get you started:
# Set the cluster context
hyp set-cluster-context --cluster-name <your-cluster-name>
# Create a Space
hyp create hyp-space --name "data-science-space" --display-name "Data Science Workspace" --namespace "default"
Once created, users can access the Space via the web UI or their local VS Code environment using the commands outlined in the earlier sections.
Best Practices for Using SageMaker Spaces
User Management and Collaboration
- Assign roles to control access efficiently.
- Use public and private Space setups based on collaborative needs.
- Implement real-time collaboration features for shared workspaces.
Admin Defaults and Controls
- Create templates with predefined settings to expedite the Space creation process for data scientists.
- Implement custom templates that cater to specific projects or use cases.
Customization and Resource Management
- Employ lifecycle scripts for minimal customizations.
- Enable automatic shutdown of idle compute to conserve resources.
Monitoring and Maintaining GPU Efficiency
- Leverage fractional GPU configurations to boost resource utilization without compromising performance.
hyp create hyp-space --name test-space --accelerator-partition-type mig-3g.20gb --accelerator-partition-count 1
Clean Up Resources
To avoid unnecessary charges, ensure to delete all the resources you created during this setup:
hyp delete hyp-space --name <space-name>
You can also remove the Spaces add-on and delete the HyperPod cluster if it was created solely for testing.
Conclusion
Amazon SageMaker HyperPod facilitates a seamless, secure, and managed development environment that enhances productivity among data scientists and AI developers. By streamlining setup processes and integrating task governance features, teams can focus on model development without spending excessive time on environment configurations.
Integrate SageMaker Spaces into your workflow today to maximize your resources and enhance your collaborative efforts in machine learning. For more information, or to get started, check out the AWS SageMaker documentation.
About the Authors
This insightful post was brought to you by Durga Sury, Edward Sun, and their esteemed colleagues at AWS, who are passionate about simplifying the AI/ML development experience. Their varied backgrounds in architecture, engineering, design, and management provide a robust foundation for the innovations shaping SageMaker HyperPod and its capabilities.