Running SageMaker AI Endpoints Privately in a VPC
This lesson explains how SageMaker AI endpoints run inside a VPC and how clients reach them privately, for organisations that require model hosting and data access to stay on private networks.
Learning outcomes
After completing this lesson, you will be able to:
- Connect the model container to a VPC.
- Give clients private access through an interface endpoint.
- Apply network isolation.
Connecting the model container to a VPC
Specifying a VpcConfig (subnets and security groups) on the SageMaker AI model places the endpoint's containers in your VPC by creating elastic network interfaces in the chosen subnets. Use private subnets in at least two Availability Zones for availability. The container can then reach resources in the VPC, such as a feature store cache or a database, and AWS services through VPC endpoints: an S3 gateway endpoint for model artefacts and data, and interface endpoints for ECR (image pulls), CloudWatch Logs and any other service the container calls.
Private client access
Applications inside a VPC call SageMaker AI endpoints through an interface VPC endpoint for the SageMaker Runtime (com.amazonaws.<region>.sagemaker.runtime), so invocation traffic never crosses the internet. A separate interface endpoint for the SageMaker API serves management calls, such as creating and updating endpoints.
Access can be restricted from both directions. A VPC endpoint policy limits which SageMaker endpoints can be invoked through the VPC endpoint, and IAM policies with the aws:SourceVpce or aws:SourceVpc condition can deny invocations that come from anywhere else.
The following diagram shows the network design of a private SageMaker AI endpoint for a hospital's clinical application.

Keep traffic private
Network isolation
Network isolation, set with EnableNetworkIsolation, removes all network access from the inference container: it cannot call AWS services or the internet, and SageMaker AI itself supplies the model artefacts to the container. Even if the model's code tried to send data out, it would have no route to do so.
Network isolation suits untrusted third-party models, such as some models from AWS Marketplace, and workloads with strict data exfiltration requirements. The following table summarises the components.
| Component | Purpose |
|---|---|
| VpcConfig on the model | Containers run with ENIs in your private subnets |
| S3 gateway endpoint | Private access to artefacts and data |
| ECR and CloudWatch Logs interface endpoints | Image pulls and logging without internet |
| sagemaker.runtime interface endpoint | Private invocation by clients |
| aws:SourceVpce condition | Deny invocations from outside the VPC endpoint |
| Network isolation | No outbound network access from the container |
Network isolation
A hospital's private endpoint
A hospital requires that patient data used for inference never traverses the internet and that only its clinical application in a specific VPC can call the model.
- Deploy the model with VpcConfig in private subnets across two Availability Zones and a security group allowing traffic only from the application tier.
- Create interface endpoints for SageMaker Runtime, ECR and CloudWatch Logs, and an S3 gateway endpoint.
- Attach an IAM policy that denies
sagemaker:InvokeEndpointunlessaws:SourceVpceequals the runtime endpoint ID.
A NAT gateway would also let the container reach AWS services, but traffic to public service endpoints would leave the VPC, which the requirement rules out.
How are endpoint invocations restricted to a particular VPC endpoint?
Show answer
With the aws:SourceVpce condition in the policy.
Exam Tips
Remember for the exam
- Private invocation: sagemaker.runtime interface VPC endpoint.
- Model artefacts from S3 in private subnets: S3 gateway endpoint.
- Restrict invocations to the VPC endpoint: aws:SourceVpce condition.
- No outbound access from the container: network isolation.
- Use private subnets in at least two Availability Zones.