AWS sagemaker documentation change
Summary
Added documentation for using project templates from S3 buckets including admin setup and code examples
Security assessment
The changes document new template storage functionality without referencing security vulnerabilities. While CORS policy setup is mentioned, this is standard configuration guidance rather than addressing a specific security issue.
Diff
diff --git a/sagemaker/latest/dg/sagemaker-projects-templates-custom.md b/sagemaker/latest/dg/sagemaker-projects-templates-custom.md index 9cbb6b2ca..5aec52c56 100644 --- a//sagemaker/latest/dg/sagemaker-projects-templates-custom.md +++ b//sagemaker/latest/dg/sagemaker-projects-templates-custom.md @@ -4,0 +5,2 @@ +Templates in Amazon S3 + @@ -76,0 +79,109 @@ After you complete these steps, Studio (or Studio Classic) users in your organiz +## Using a template from an Amazon S3 bucket + +You can also create SageMaker projects using templates stored in Amazon S3. + +###### Note + +While you can use the templates in the AWS Service Catalog, we recommend that you store templates in an S3 bucket and create projects using those templates. + +### Admin setup + +Before you can create projects using templates in an S3 bucket, perform the following steps. + + 1. [Create an S3 bucket](https://docs.aws.amazon.com/AmazonS3/latest/userguide/create-bucket-overview.html), and upload your templates to the bucket. + + 2. [Set up a CORS policy on your S3 bucket to configure access permissions](https://docs.aws.amazon.com/AmazonS3/latest/userguide/enabling-cors-examples.html). + + 3. Add the following key-value tag to the template so they become visible to SageMaker AI. + + sagemaker:studio-visibility : true + + 4. [Create a domain](https://docs.aws.amazon.com/sagemaker/latest/dg/onboard-quick-start.html). + + 5. After SageMaker AI finishes creating your domain, add the following key-value tag to the domain: + + sagemaker:projectS3TemplatesLocation : s3://<amzn-s3-demo-bucket> + + + + +Then use the AWS console, Python, or the [CreateProject](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateProject.html) and [UpdateProject](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_UpdateProject.html) API operations to create or update a SageMaker project from templates inside the S3 bucket. + +Studio + + +**Create a project** + + 1. Open the Amazon SageMaker AI console at [https://console.aws.amazon.com/sagemaker/](https://console.aws.amazon.com/sagemaker/). + + 2. Open the SageMaker Studio console by following the instructions in [Launch Amazon SageMaker Studio](https://docs.aws.amazon.com/sagemaker/latest/dg/studio-updated-launch.html). + + 3. In the left navigation pane, choose **Deployments** , **Projects** , **Create project**. + + 4. Choose **Organization templates** and then **S3 Templates** to see the templates that are available to you. If you don't see a template that you're expecting, notify your administrator. + + 5. Choose the template that you want to use, and then choose **Next**. + + 6. Enter a name for your project, an optional description, and the other required fields. When you're done, choose **Create**. + + + + +**Update a project** + + 1. Open the Amazon SageMaker AI console at [https://console.aws.amazon.com/sagemaker/](https://console.aws.amazon.com/sagemaker/). + + 2. Open the SageMaker Studio console by following the instructions in [Launch Amazon SageMaker Studio](https://docs.aws.amazon.com/sagemaker/latest/dg/studio-updated-launch.html). + + 3. Choose the project that you want to update. Choose **Actions** , then choose **Update Project**. + + 4. When updating a project, you can update the template parameters or the template URL. When you're done, choose **Next**. + + 5. Review the project updates in the summary table, and choose **Update**. + + + + +Python Boto3 + + +After you create the S3 bucket and uploaded your templates, you can use the following example to create a SageMaker project. + + + sagemaker_client = boto3.client('sagemaker', region_name='us-west-2') + + response = sagemaker_client.create_project( + ProjectName='my-custom-project', + ProjectDescription='SageMaker project with custom CFN template stored in S3', + TemplateProviders=[{ + 'CfnTemplateProvider': { + 'TemplateName': 'CustomProjectTemplate', + 'TemplateURL': f'https://<bucket_name>.s3.us-west-2.amazonaws.com/custom-project-template.yml', + 'Parameters': [ + {'Key': 'ParameterKey', 'Value': 'ParameterValue'} + ] + } + }] + ) + print(f"Project ARN: {response['ProjectArn']}") + +To update a SageMaker project, see the following example. + + + sagemaker_client = boto3.client('sagemaker', region_name='us-west-2') + + response = sagemaker_client.update_project( + ProjectName='my-custom-project', + ProjectDescription='SageMaker project with custom CFN template stored in S3', + TemplateProvidersToUpdate=[{ + 'CfnTemplateProvider': { + 'TemplateName': 'CustomProjectTemplate', + 'TemplateURL': f'https://<bucket_name>.s3.us-west-2.amazonaws.com/custom-project-template.yml', + 'Parameters': [ + {'Key': 'ParameterKey', 'Value': 'ParameterValue'} + ] + } + }] + ) + print(f"Project ARN: {response['ProjectArn']}") +