Created
December 21, 2019 00:02
-
-
Save leehanchung/254debc191fef90ec98f370ae7437ecc to your computer and use it in GitHub Desktop.
Bash script for creating Sagemaker Model from AWS ECR Docker Image repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
MODEL_NAME=<<name your model>> | |
ROLE_NAME=AmazonSageMaker-ExecutionRole-XXXXXXXXXXXXXXXX | |
# the name of the image created with | |
ECS_IMAGE_NAME=<<your image name>> | |
# the role arn of the role | |
EXECUTION_ROLE_ARN=$(aws iam get-role --role-name ${ROLE_NAME} | jq -r .Role.Arn) | |
# the ECS image URI | |
ECS_IMAGE_URI=$(aws ecr describe-repositories --repository-name ${ECS_IMAGE_NAME} | jq -r .repositories[0].repositoryUri) | |
# defines the SageMaker model primary container image as the ECS image | |
PRIMARY_CONTAINER="Image=${ECS_IMAGE_URI}" | |
# creates the model | |
aws sagemaker create-model --model-name ${MODEL_NAME} \ | |
--primary-container=${PRIMARY_CONTAINER} --execution-role-arn ${EXECUTION_ROLE_ARN} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment