Git Product home page Git Product logo

aws-cdk-sagemaker-studio's Introduction

Build and automatize the management of your Sagemaker Studio Users using AWS CDK!

You should explore the contents of this project. It demonstrates a CDK app with an instance of a stack (sagemakerStudioCDK)

The cdk.json file tells the CDK Toolkit how to execute your app.

Deployment Steps

Pre-requisites:

  • An AWS profile with permissions to create AWS Identity and Access Management (AWS IAM) roles, Studio domains, and Studio user profiles
  • AWS CLI, authenticated and configured
  • Python 3.6+
  • AWS CDK
  • Git
  • Knowledge on how Amazon Sagemaker Studio works.

Step 1: Using your device’s command line, check out our Git repository to a local directory on your device:

git clone https://github.com/aws-samples/aws-cdk-sagemaker-studio

Step 2: Change directories to the new directory that was created during the previous step:

cd aws-cdk-sagemaker-studio/

Step 3: Create a virtual environment:

macOS/Linux: python3 -m venv .cdk-venv
Windows: python -m venv .cdk-venv

Step 4: Activate the virtual environment after the init process completes, and the virtual environment is created:

macOS/Linux: source .cdk-venv/bin/activate
Windows: .cdk-venv\Scripts\activate.bat

Step 5: Install the required dependencies:

pip3 install -r requirements.txt

Step 6: Synthesize the templates. AWS CDK apps use code to define the infrastructure, and when run, they produce, or “synthesize” an AWS CloudFormation template for each stack defined in the application:

cdk synthesize

Step 7: Deploy the solution.

cdk deploy sagemakerStudioCDK -c existing_vpc_id="<THE_VPC_ID_WHERE_TO_DEPLOY_SAGEMAKER_STUDIO>"

Review the resources that AWS CDK creates for you in your AWS account and choose yes to deploy the stack.

Diagram

Wait for your stack to be deployed by checking the status on the AWS CloudFormation console.

Enjoy!

Useful commands

  • cdk ls list all stacks in the app
  • cdk synth emits the synthesized CloudFormation template
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with current state
  • cdk docs open CDK documentation

Cleanup

Follow this step to remove the resources that were deployed in this post.

cdk destroy

When asked to confirm the deletion of the four stacks, select “y”.

Security

See CONTRIBUTING for more information.

License

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

aws-cdk-sagemaker-studio's People

Contributors

amazon-auto avatar amineizanami avatar haramine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

aws-cdk-sagemaker-studio's Issues

Could not find any VPCs matching

I followed the README and when I run cdk synthesize I got the error:

[Error at /sagemakerStudioCDK] Could not find any VPCs matching {"account":"nnnnnnnnnn","region":"us-west-2","filter":{"isDefault":"true"},"returnAsymmetricSubnets":true}

Found errors

I modified app.py with the right region.

Is there a VPC I need to create before running this?

How to create Sagemaker studio project?

P.S. Don't attach files. Please, prefer add code snippets directly in the message body.
I am trying to create sagemaker project following below steps:

create domain (using the example)
create user (using the example)
create jupyter app
create project

Code for creating jupyter app:

`class SagemakerStudioJupyterAppConstruct(Construct):

def __init__(self, scope: Construct,
             construct_id: str, *,
             app_name: str,
             app_type: str,
             domain_id: str,
             user_profile_name: str,
             depends_on=None, **kwargs) -> None:
    super().__init__(scope, construct_id)

    sagemaker_jupyter_app = sg.CfnApp(self, construct_id,
                                      app_name=app_name,
                                      app_type=app_type,
                                      domain_id=domain_id,
                                      user_profile_name=user_profile_name
                                      )
    sagemaker_jupyter_app.add_depends_on(depends_on_user_creation)`

Code for creating project:

`class SagemakerStudioProjectConstruct(Construct):

def __init__(self, scope: Construct,
             construct_id: str, *,
             project_name: str,
             project_description: str,
             product_id: str,
             depends_on=None,
             **kwargs) -> None:
    super().__init__(scope, construct_id)

    sagemaker_studio_project = sg.CfnProject(self, construct_id,
                                             project_name=project_name,
                                             service_catalog_provisioning_details={
                                                 "ProductId": "prod-7tjedn5dz4jrw"
                                             },
                                             project_description=project_description
                                             )`

Domain, user, jupyter app all gets created successfully. The problem comes in with project.
Below is the error :

Resource handler returned message: "Product prod-7tjedn5dz4jrw does not exist or access was denied (Service: SageMaker, Status Code: 400, Request ID: 768116aa-e77b-4691-a972-38b83093fdc4)" (RequestToken: 45ca2a0c-3f03-e3e0-f29d-d9443ff4dfc1, HandlerErrorCode: GeneralServiceException)

I am running this code from an ec2 instance that has SagemakerFullAccess
I also tried attaching SagemakerFullAccess execution role with project...but got the same error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.