SageMaker models should use private registry in VPC for multi-container inference pipelines
Checks that every container in the model's container list has repository access mode Vpc, pulling its image from a private Docker registry in your VPC; one container on Platform (Amazon ECR) or with no image configuration fails the model. The images then come from a registry you control, over your VPC rather than the public internet, which limits the risk of a tampered image.
- service
- SageMaker
- severity
- Medium
- scope
- evaluated in every region
How to fix it
- Replaces the resource: A model cannot be edited: create a new one with the whole list fixed, point each endpoint (through a new endpoint configuration), batch transform job and pipeline step at it, then delete this one.
- Affects another check: A model that also names a primary container fails SageMaker.16 too; set Vpc on it in the same replacement to clear both.
Settings
- Containers[].
ImageConfig. RepositoryAccessMode - Vpc, on every container in the list
- Containers[].
Image - Each image in your private registry, which needs a TLS certificate from a public certificate authority
- VpcConfig
- Subnets in the registry's VPC, and security groups the registry accepts inbound traffic from
- Containers[].
ImageConfig. RepositoryAuthConfig - For a registry that needs credentials: RepositoryCredentialsProviderArn, a Lambda function that returns them
With the AWS CLI
aws sagemaker create-model --model-name <model-name> --execution-role-arn <execution-role-arn> --containers '[{"Image":"<preprocessor-image-uri>","ContainerHostname":"preprocessor","ImageConfig":{"RepositoryAccessMode":"Vpc"}},{"Image":"<predictor-image-uri>","ContainerHostname":"predictor","ImageConfig":{"RepositoryAccessMode":"Vpc"}}]' --vpc-config '{"SecurityGroupIds":["<security-group-id>"],"Subnets":["<subnet-id>"]}' --region <region>With Terraform
resource "aws_sagemaker_model" "this" {
name = var.model_name
execution_role_arn = var.execution_role_arn
container {
image = var.preprocessor_image_uri
container_hostname = "preprocessor"
image_config {
repository_access_mode = "Vpc"
}
}
container {
image = var.predictor_image_uri
container_hostname = "predictor"
image_config {
repository_access_mode = "Vpc"
}
}
vpc_config {
security_group_ids = var.security_group_ids
subnets = var.subnet_ids
}
}
See which of your accounts this check is failing on.
Book a live scan