Back to Checks
aws

Amazon SageMaker training job has VPC configuration enabled

sagemaker_training_jobs_vpc_settings_configured
Service: sagemakerSeverity: high
OfficialBuilt-inVerified
Categories:trust-boundariesgen-aiinternet-exposed
Resource Type:Other

SageMaker training jobs are evaluated for VPC configuration by detecting defined subnets in the job settings. With VPC settings, ENIs place the job in your VPC so traffic for training volumes and outputs uses private networking.

Risk

Without VPC settings, training containers rely on public networking and broad egress. This weakens confidentiality and integrity, enabling data exfiltration of datasets or model artifacts, malware downloads, and bypass of granular security group controls and VPC-based monitoring.

Run this check with Prowler

Run in Prowler Cloud
Run
prowler aws --checks sagemaker_training_jobs_vpc_settings_configured

Recommendation

Run training in a VPC using specific subnets and tightly scoped security groups.

  • Use VPC endpoints for S3, ECR, and SageMaker to keep traffic private
  • Block outbound Internet by default and allow only required destinations
  • Apply network segmentation and, when feasible, enable network isolation

Remediation

Terraform

# SageMaker Training Job with VPC configuration
resource "aws_sagemaker_training_job" "<example_resource_name>" {
  name     = "<example_resource_name>"
  role_arn = "<example_resource_id>"

  algorithm_specification {
    training_image     = "<example_resource_id>"
    training_input_mode = "File"
  }

  output_data_config {
    s3_output_path = "s3://<example_resource_name>/"
  }

  resource_config {
    instance_type  = "ml.m5.large"
    instance_count = 1
    volume_size_gb = 10
  }

  stopping_condition {
    max_runtime_in_seconds = 3600
  }

  vpc_config {
    subnets            = ["<example_resource_id>"]     # CRITICAL: enables VPC on the training job
    security_group_ids = ["<example_resource_id>"]     # Required with VPC
  }
}

NativeIaC

# CloudFormation: SageMaker TrainingJob with VPC enabled
Resources:
  <example_resource_name>:
    Type: AWS::SageMaker::TrainingJob
    Properties:
      TrainingJobName: <example_resource_name>
      RoleArn: <example_resource_id>
      AlgorithmSpecification:
        TrainingImage: <example_resource_id>
        TrainingInputMode: File
      OutputDataConfig:
        S3OutputPath: s3://<example_resource_name>/
      ResourceConfig:
        InstanceType: ml.m5.large
        InstanceCount: 1
        VolumeSizeInGB: 10
      StoppingCondition:
        MaxRuntimeInSeconds: 3600
      VpcConfig:
        Subnets:
          - <example_resource_id>  # CRITICAL: adds VPC subnets so job has VPC config
        SecurityGroupIds:
          - <example_resource_id>  # Required by SageMaker when using VPC

Other

1In the AWS Console, go to SageMaker > Training > Training jobs
2Click Create training job (or select a job and choose Create copy)
3In Networking, select a VPC, then choose at least one Subnet and one Security group
4Complete required fields and Create the job
5Verify the new training job shows VPC subnets in its details

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_training_jobs_vpc_settings_configured(Check):
    def execute(self):
        findings = []
        for training_job in sagemaker_client.sagemaker_training_jobs:
            report = Check_Report_AWS(metadata=self.metadata(), resource=training_job)
            report.status = "PASS"
            report.status_extended = f"Sagemaker training job {training_job.name} has VPC settings for the training job volume and output enabled."
            if not training_job.vpc_config_subnets:
                report.status = "FAIL"
                report.status_extended = f"Sagemaker training job {training_job.name} has VPC settings for the training job volume and output disabled."

            findings.append(report)

        return findings