Setup EnvironmentTypeConfig - Research Service Workbench on AWS

Setup EnvironmentTypeConfig

Retrieve Environment Type Id

  1. In RSW Official Postman Collection under envType folder choose List envTypes API and send request. If there aren't any environment types displaying in the response, check whether the post deployment step ran correctly.

  2. Running the List envTypes request in postman should return a json with the following format:

    { "data": [ { "id": " et-<productId>,<provisioningArtifactId> ", "productId": " <productId> ", "provisioningArtifactId": " <provisioningArtifactId> ", "description": " description ", "name": " name ", "type": " sagemakerNotebook ", "status": " NOT_APPROVED ", "createdAt": " 2022-07-21T21:24:57.171Z ", "updatedAt": " 2022-07-21T21:24:57.171Z ", "params": { "DatasetsBucketArn": { "Description": " Name of the datasets bucket in the main account ", "Type": " String " }, "EncryptionKeyArn": { "Description": " The ARN of the KMS encryption Key used to encrypt data in the notebook ", "Type": " String " }, "AccessFromCIDRBlock": { "Default": " 10.0.0.0/19 ", "Description": " The CIDR used to access sagemaker notebook ", "Type": " String " }, "VPC": { "Description": " VPC for Sagemaker Notebook ", "Type": " AWS::EC2::VPC::Id " }, "S3Mounts": { "Description": " A JSON array of objects with name, bucket and prefix properties used to mount data ", "Type": " String " }, "Namespace": { "Description": " An environment name that will be prefixed to resource names ", "Type": " String " }, "MainAccountId": { "Description": " The Main Account ID where application is deployed ", "Type": " String " }, "MainAccountKeyArn": { "Description": " The ARN of main account bucket encryption key ", "Type": " String " }, "IamPolicyDocument": { "Description": " The IAM policy to be associated with the launched workstation ", "Type": " String " }, "EnvironmentInstanceFiles": { "Description": " An S3 URI (starting with \" s3:// \" ) that specifies the location of files to be copied to the environment instance, including any bootstrap scripts ", "Type": " String " }, "MainAccountRegion": { "Description": " The region of application deployment in main account ", "Type": " String " }, "InstanceType": { "Default": " ml.t3.xlarge ", "Description": " EC2 instance type to launch ", "Type": " String " }, "Subnet": { "Description": " Subnet for Sagemaker Notebook, from the VPC selected above ", "Type": " AWS::EC2::Subnet::Id " }, "AutoStopIdleTimeInMinutes": { "Description": " Number of idle minutes for auto stop to shutdown the instance (0 to disable auto-stop) ", "Type": " Number " } } } ] }

In the response, take note of the environment type id you are looking for. The name will have the format <product name>-<provisioning artifact name>, e.g. sageMakerNotebook-v1. We'll need it for the next step. We'll refer to this id value as ENV_TYPE_ID.

Approve Environment Type

  1. In RSW Official Postman Collection under envType folder choose Update envType API to change the status of environemnt type.

  2. In the params tab set id parameter to the ENV_TYPE_ID value from the Retrieve Environment Type Id step.

  3. Send an Update envType request

    PATCH {{API_URL}}/environmentTypes/:id
    { "status": "APPROVED" }

Create Environment Type Config

  1. In RSW Official Postman Collection under envTypeConfig folder choose Create envTypeConfig API.

  2. In the params tab set envTypeId parameter to the ENV_TYPE_ID value from the Retrieve Environment Type Id step.

  3. Send a Create envTypeConfig request:

    POST {{API_URL}}/environmentTypes/:envTypeId/configurations
    { "type": "sagemakerNotebook", "description": "<description>", "name": "<environment type config name>", "estimatedCost": "<estimated cost>", "params": [ { "key": "IamPolicyDocument", "value": "${iamPolicyDocument}" }, { "key": "InstanceType", "value": "ml.t3.medium" }, { "key": "AutoStopIdleTimeInMinutes", "value": "0" }, { "key": "CIDR", "value": "0.0.0.0/0" } ] }
  4. In the response take note of the id that was returned. We'll refer to this value as ENV_TYPE_CONFIG_ID.

    If you would like to launch a sagemaker notebook instance with a different instance type than ml.t3.medium, you can replace that value in the JSON above.

Associate Project to Environment Type Configuration

  1. In RSW Official Postman Collection under project folder choose Associate project with EnvTypeConfig API.

  2. In the params tab set projectId parameter to the PROJECT_ID value from the Setup Project step.

  3. In the params tab set envTypeId parameter to the ENV_TYPE_ID value from the Retrieve Environment Type Id step.

  4. In the params tab set envTypeConfigId parameter to the ENV_TYPE_CONFIG_ID value from the Create Environment Type Config step.

  5. Send Associate project with EnvTypeConfig request.

    PUT {{API_URL}}/projects/:projectId/environmentTypes/:envTypeId/configurations/:envTypeConfigId/relationships