Description
Disable SageMaker’s direct internet path when your VPC must control notebook egress.
Potential impact
With the direct path enabled, uploads and downloads can bypass VPC egress controls.
Remediation
Specify SubnetId and DirectInternetAccess: Disabled. Configure VPC endpoints or a NAT route for required services and test outbound access. Manage root permissions separately.
Examples
Both examples use the same subnet and execution role. CloudFormation replaces an existing notebook when DirectInternetAccess changes, so back up local files first.
Before
yaml
Resources:
Notebook:
Type: AWS::SageMaker::NotebookInstance
Properties:
DirectInternetAccess: Enabled
InstanceType: ml.c4.2xlarge
RoleArn: arn:aws:iam::111122223333:role/SageMakerNotebookRole
SubnetId: !Ref NotebookSubnet
After
yaml
Resources:
Notebook:
Type: AWS::SageMaker::NotebookInstance
Properties:
DirectInternetAccess: Disabled
InstanceType: ml.c4.2xlarge
RoleArn: arn:aws:iam::111122223333:role/SageMakerNotebookRole
SubnetId: !Ref NotebookSubnet