All checks
Medium SageMaker · regional

SageMaker models should use private registry in VPC for multi-container inference pipelines

Flags SageMaker inference-pipeline models whose Containers[] pull images via the public ECR endpoint. Every container in the pipeline must set ImageConfig.RepositoryAccessMode='Vpc' for image pulls to stay inside the VPC.

service
SageMaker
severity
Medium
scope
evaluated in every region

How to fix it

Set at creation: fixing it means replacing the resource.

Give every container in the model's container list an image configuration whose repository access mode is Vpc. One container short of that fails the whole model, as does a container with no image configuration at all, which is the default. There is no update operation for a model, so fix the whole list in one replacement and repoint every endpoint, batch transform job and pipeline step at the new model. One container shape has no route to pass here: a container built from a model package or an inference specification takes its image path from the package, so image configuration cannot be set on it and the model keeps failing until the package is republished with a VPC image configuration. A model that names a single primary container instead is checked by SageMaker.16.

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 demo