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.
VPC design for ML
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.
A private training job
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.
| Layer | Control |
|---|---|
| Subnets | Private, multi-AZ, no internet gateway route |
| Studio | VPC-only mode |
| Traffic between tiers | Security groups referencing each other |
| Distributed training | Self-referencing security group, inter-container encryption |
| AWS service access | Gateway and interface VPC endpoints with endpoint policies |
| Container | Network isolation |
The following diagram shows the network paths of a locked-down research environment in SageMaker Studio.

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.
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.