Lesson 3 of 5 Securing ML and AI Workloads

Isolating ML Systems on Private Networks

This lesson explains how VPCs, subnets and security groups limit who can reach ML resources and where they can send data, as the exam guide asks.

Learning outcomes

After completing this lesson, you will be able to:

  • Design private subnets for ML resources.
  • Configure security groups and VPC endpoints.
  • Apply container-level network isolation.

VPC design

Place ML resources in private subnets with no route to an internet gateway, across at least two Availability Zones. SageMaker AI Studio domains can run in VPC-only mode so notebooks have no direct internet access. Training jobs, processing jobs and endpoints are attached to the VPC with subnet and security group settings; OpenSearch domains, Aurora clusters and other vector stores also live in private subnets.

True or false

VPC design for ML

Exam skills 4.3.6

Check how VPCs isolate ML systems.

Log in to try this activity Interactive activities are free with an account.

Security groups and endpoints

Security groups allow only required traffic: for example, the application tier's security group to an endpoint's, or a training cluster's security group to itself (a self-referencing rule) so distributed training nodes can communicate. VPC endpoints provide private access to AWS services: an S3 gateway endpoint, and interface endpoints for the SageMaker API, SageMaker Runtime, Bedrock runtime and agent runtime, STS, ECR, CloudWatch Logs, KMS and Secrets Manager. Endpoint policies can restrict which buckets or actions are reachable through each endpoint, preventing data exfiltration to buckets in other accounts.

Select all that apply

A private training job

Exam skills 4.3.6

Identify the VPC endpoints a training job in private subnets with no NAT gateway needs.

Log in to try this activity Interactive activities are free with an account.

Container-level isolation

Network isolation for training and inference containers blocks all outbound network calls, even within the VPC; SageMaker AI still supplies input data and collects outputs. Inter-container traffic encryption encrypts data exchanged between instances in distributed training. Together with private subnets and endpoints, these controls let even untrusted code run without a path to exfiltrate data. The following table summarises the layers.

LayerControl
SubnetsPrivate, multi-AZ, no internet gateway route
StudioVPC-only mode
Traffic between tiersSecurity groups referencing each other
Distributed trainingSelf-referencing security group, inter-container encryption
AWS service accessGateway and interface VPC endpoints with endpoint policies
ContainerNetwork isolation

The following diagram shows the network paths of a locked-down research environment in SageMaker Studio.

The locked-down research environment. Studio runs in VPC-only mode in private subnets with no NAT gateway; the S3 gateway endpoint's policy allows only buckets in the company's accounts; interface endpoints serve SageMaker AI, STS, ECR, CloudWatch Logs and KMS; and an SCP requires VPC settings and network isolation for every training job. A researcher cannot copy data to a personal bucket.
The scenario is illustrative.
Worked example

A locked-down research environment

A pharmaceutical company lets researchers train models on clinical data but must prevent any copy of the data leaving its accounts.

  • Studio domain in VPC-only mode in private subnets; no NAT gateway.
  • S3 gateway endpoint with a policy allowing only the company's buckets (using aws:ResourceAccount).
  • Interface endpoints for SageMaker API and Runtime, STS, ECR, CloudWatch Logs and KMS.
  • SCP requiring VPC configuration and network isolation for all training jobs.

Even a researcher with valid credentials cannot upload data to a personal bucket from the environment, because the endpoint policy blocks other accounts' buckets and there is no internet path.

Check yourself

How can SageMaker Studio run without direct internet access?

Show answer

In VPC-only mode.

Exam Tips

Remember for the exam

  • Private subnets in multiple AZs with no internet gateway route.
  • Studio without direct internet: VPC-only mode.
  • S3 gateway endpoint policies can block exfiltration to other accounts' buckets.
  • Distributed training nodes: self-referencing security group and inter-container encryption.
  • No outbound calls from a container: network isolation.