aws-samples / sagemaker-custom-project-templates

MIT No Attribution
219 stars 158 forks source link

Custom Project Templates in SageMaker

This repository contains an example SageMaker Project template. Each folder in this repo contains a custom project template with details on what that template achieves and how to set it up. The generic instructions are shown below.

Custom Projects

Adding the templates to SageMaker Studio Studio

In order to add your custom SageMaker Projects into SageMaker studio and deploy them, you will need to complete 3 steps:

Step 1: Create a Service Catalog Portfolio (only needs to be done the first time)

  1. Download the sagemaker-projects-portfolio.yaml CloudFormation template from the root of this repo to your local machine.

  2. Open the CloudFormation console at https://console.aws.amazon.com/cloudformation

  3. Choose on Create stack, then With new resources (standard).

  4. On the Create Stack screen, under Template source, choose Upload a template file.

  5. Choose Choose file then select the sagemaker-projects-portfolio.yaml from your machine.

  6. Choose Next

  7. On the Parameters screen, under Stack Name, enter a unique name for this CloudFormation stack.

  8. Next, you will need to enter either your SageMaker Domain Execution Role, or the Role that your Studio users are assuming if you have defined a custom one. You can find your SageMaker Domain Execution Role ARN in the Studio Dashboard: https://console.aws.amazon.com/sagemaker/home?#/studio under the Domain section, then Execution Role. Paste that value into the SageMaker Domain Execution Role ARN parameter.

  9. Choose Next.

  10. On the Configure stack options screen, no changes are necessary. Scroll to the bottom and choose Next.

  11. On the Review screen, scroll to the bottom and choose Create Stack.

  12. After a few seconds, the stack should move to a __CREATE_COMPLETE__ stage, and will be ready to add products into.

Step 2: Add your SageMaker Projects product to the portfolio

  1. In the project you wish to use in SageMaker studio, download the product CloudFormation template to your machine. There is a unique one in each project, and the filename ends in "-product.yaml"

  2. Similar to the way you created the portfolio, open the CloudFormation console at https://console.aws.amazon.com/cloudformation, upload that template, fill in the necessary parameters, and create the stack. Each project may have different parameters, which will be outlined in their README.md files.

    Every template will require your Service Catalog portfolio id, which can be found in the Outputs tab of your deployed portfolio stack or in the Service Catalog portfolio list: https://console.aws.amazon.com/servicecatalog/home?#/portfolios

  3. Once your product stack is in a __CREATE_COMPLETE__ stage, you can then go to SageMaker Studio for deployment.

Step 3: Deploy your SageMaker Projects project template

  1. Open SageMaker Studio and sign in to your user profile.

  2. Choose the SageMaker components and registries icon on the left, and choose the Create project button.

  3. The default view displays SageMaker templates. Switch to the Organization templates tab to see custom project templates.

  4. The template you created will be displayed in the template list. (If you do not see it yet, make sure the correct execution role is added to the product and the sagemaker:studio-visibility tag with a value of true is added to the Service Catalog product).

  5. Choose the template and click Select project template.

  6. Enter a name and optional description for the project. If additional parameters or tags are required, enter the appropriate values, and choose Create project.

You have now successfully created an MLOps template and a SageMaker Project using the custom template. Refer to encrypted-buckets for a sample implementation.