The aim of this repository is to provide a custom Docker image for SageMaker Training Job.
- Create an ECR repository at first
- Create a build project on CodeBuild console.
- Do not forget to check "Privileged" under "Environment" section.
- Attach the built image to SageMaker Domain. (If you want to use this image on SageMaker Studio.)
Define the following environment variables on CodeBuild console.
AWS_DEFAULT_REGION
: e.g. eu-central-1AWS_ACCOUNT_ID
: your account ID. You can copy it on the AWS console. (Click your account name.)ECR_REPOSITORY_NAME
: Repository name in ECR
The IAM role of the CodeBuild project needs a privilege to push a built Docker image to your ECR repository.
Add the following policy to the role after replacing AWS_ACCOUNT_ID
with your AWS account ID.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ecr:CompleteLayerUpload",
"ecr:UploadLayerPart",
"ecr:InitiateLayerUpload",
"ecr:BatchCheckLayerAvailability",
"ecr:PutImage"
],
"Resource": "arn:aws:ecr:*:AWS_ACCOUNT_ID:repository/*"
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": "ecr:GetAuthorizationToken",
"Resource": "*"
}
]
}
- GPU