Skip to content

Enabling Network Isolation for SageMaker Model with S3 Access

0

I am trying to implement network isolation when creating a SageMaker model, as recommended by Trusted Advisor. However, once network isolation is enabled, the model container loses access to S3 for pulling and pushing objects.

To address this, I attempted to run the model within a VPC and configured an S3 VPC endpoint to allow access, but it still failed to communicate with S3.

According to the AWS documentation (https://docs.aws.amazon.com/sagemaker/latest/dg/mkt-algo-model-internet-free.html?utm_source=chatgpt.com), it appears possible to:

Enable network isolation,

Still pull model artifacts or data from outside the container to local storage of container, and push output to S3 from outside the container.

Could anyone please clarify whether it’s feasible to achieve with network isolation enabled.

2 Answers
5

Below is the consideration on how to make this work:

  1. Use a VPC with S3 VPC Endpoint • Create a Gateway VPC endpoint for S3 in the same VPC and subnet as your SageMaker job • Ensure the route table for the subnet includes the S3 endpoint • No NAT gateway or internet access is needed
  2. Don’t Expect the Container to Access S3 • The container itself cannot make boto3 or curl calls to S3 • Instead, SageMaker downloads input data and model artifacts to the container’s local storage before execution • Similarly, output artifacts are uploaded by SageMaker, not the container
  3. Use Input/Output Channels Properly • Define InputDataConfig and OutputDataConfig in your training or inference job • SageMaker handles the S3 interaction outside the container using its own managed network path
  4. Avoid VpcConfig for Inference if Not Needed • If you specify VpcConfig, SageMaker won’t create the second ENI for S3 access, and you must ensure the container has access to S3 via the VPC
EXPERT

answered a year ago

0

Hey,

Hope you're keeping well.

Yes, it’s feasible, but with network isolation enabled the container itself cannot directly call S3 APIs. SageMaker handles S3 transfers outside the container by downloading your model artifacts and input data to the container’s local storage before execution, and uploading outputs after completion. To make this work in a VPC, attach a Gateway VPC endpoint for S3 to the same subnets used by the SageMaker job and ensure the route tables include it. Then configure your job’s InputDataConfig and OutputDataConfig to point to the desired S3 locations so SageMaker can perform the transfers without requiring internet access.

Thanks and regards,
Taz

answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.