Back to Checks
aws

Amazon SageMaker model has VPC settings enabled

sagemaker_models_vpc_settings_configured
Service: sagemakerSeverity: medium
OfficialBuilt-inVerified
Categories:trust-boundariesgen-aiinternet-exposed
Resource Type:Other

SageMaker models use VPC settings (VpcConfig with subnets and security groups) so inference containers communicate through a selected VPC rather than the public internet.

This evaluates whether a model defines VPC subnets for its network path.

Risk

Without VPC isolation, model traffic and data access can traverse public paths, weakening confidentiality and integrity through interception or misrouting.

Missing security groups and private endpoints reduce access control, enabling excessive egress, data exfiltration, or command-and-control from compromised containers.

Run this check with Prowler

Run in Prowler Cloud
Run
prowler aws --checks sagemaker_models_vpc_settings_configured

Recommendation

Enable VPC-only networking for models by defining VpcConfig with private subnets and restrictive security groups.

Apply least privilege egress, use VPC endpoints for S3 and SageMaker runtime, avoid public routes, and implement defense in depth with segmentation and traffic monitoring.

Remediation

Terraform

resource "aws_sagemaker_model" "model" {
  name               = "<example_resource_name>"
  execution_role_arn = "<example_resource_id>"

  primary_container {
    image = "<example_resource_name>"
  }

  # Critical: VPC config enables VPC networking for the model so the check passes
  vpc_config {
    subnets            = ["<example_resource_id>"]       # Critical
    security_group_ids = ["<example_resource_id>"]       # Critical
  }
}

NativeIaC

Resources:
  SageMakerModel:
    Type: AWS::SageMaker::Model
    Properties:
      ExecutionRoleArn: "<example_resource_id>"
      PrimaryContainer:
        Image: "<example_resource_name>"
      # Critical: VpcConfig enables VPC networking for the model so the check passes
      VpcConfig:
        SecurityGroupIds:
          - "<example_resource_id>"  # Critical: security group in the VPC
        Subnets:
          - "<example_resource_id>"  # Critical: at least one subnet in the VPC

Other

1Open the AWS Console > Amazon SageMaker > Inference > Models
2Open the model and note its container image and execution role
3Delete the model (models cannot be updated to add VPC settings)
4Click Create model
5Enter the same Model name, set the Execution role, and the Container image
6Under Network, select a VPC, then choose at least one Subnet and one Security group
7Create the model
8Verify the model shows VPC settings enabled

Check Code

from prowler.lib.check.models import Check, Check_Report_AWS
from prowler.providers.aws.services.sagemaker.sagemaker_client import sagemaker_client


class sagemaker_models_vpc_settings_configured(Check):
    def execute(self):
        findings = []
        for model in sagemaker_client.sagemaker_models:
            report = Check_Report_AWS(metadata=self.metadata(), resource=model)
            report.status = "PASS"
            report.status_extended = (
                f"Sagemaker notebook instance {model.name} has VPC settings enabled."
            )
            if not model.vpc_config_subnets:
                report.status = "FAIL"
                report.status_extended = f"Sagemaker notebook instance {model.name} has VPC settings disabled."

            findings.append(report)

        return findings