More Info:
Sagemaker Notebook Instance should be in VPC only modeRisk Level
MediumAddress
Monitoring, SecurityCompliance Standards
- APRA CPS 234 (Australia)
- BSI C5 (Germany)
- Brazil LGPD
- CCPA / CPRA (California)
- CIS Critical Security Controls v8
- CMMC 2.0
- CSA Cloud Controls Matrix v4
- DPDPA
- Digital Operational Resilience Act (EU)
- ISO 27001
- ISO/IEC 27018
- ISO/IEC 27701
- MAS Technology Risk Management (Singapore)
- MITRE ATT&CK (Cloud)
- NIST SP 800-171
- NYDFS 23 NYCRR 500
- SOC2
- SWIFT Customer Security Controls Framework
- Sarbanes-Oxley IT General Controls
- UK NCSC Cyber Assessment Framework
Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
To put a SageMaker notebook instance into VPC‑only mode using the AWS Console, you need the notebook:
After these steps, your SageMaker notebook usage will be compliant with “Notebook Instance Should Be In VPC Only Mode” by ensuring:
- Attached to a VPC subnet and security group
- With Direct internet access disabled
A. If the notebook is already in a VPC (has subnet & security group)
Here you only need to disable direct internet access.-
Open the SageMaker console
- Go to:
https://console.aws.amazon.com/sagemaker/ - In the left menu, choose Notebook instances.
- Go to:
-
Stop the notebook instance
- Find your notebook instance.
- If the status is InService, select it and choose Actions → Stop.
- Wait until the status is Stopped.
-
Edit the notebook instance
- Select the stopped notebook.
- Choose Actions → Update settings (or Edit depending on console version).
-
Disable direct internet access
- In the Network or Internet access section:
- Set Direct internet access to Disable.
- Confirm the other network settings (VPC, Subnet, Security groups) are already set; if they are, this notebook will now be VPC‑only.
- In the Network or Internet access section:
-
Save and restart
- Click Update notebook instance.
- After the update completes, select the instance and choose Actions → Start.
B. If the notebook is NOT in a VPC (no subnet / SG options shown)
You must create a new VPC‑only notebook and migrate your code/data.1. Prepare VPC networking (if not already available)
You need:- A VPC
- One or more subnets (typically private subnets)
- At least one security group
- Optional but common: a NAT Gateway in a public subnet so the notebook can reach the internet via the VPC if needed (for pip installs, etc.), while still being VPC‑only from SageMaker’s perspective.
2. Create a new VPC‑only SageMaker notebook
-
Go to Notebook instances
- In SageMaker console, choose Notebook instances → Create notebook instance.
-
Basic settings
- Notebook instance name: e.g.,
my-notebook-vpc-only. - Notebook instance type: same as old instance (or as required).
- IAM role: choose the same role as the old instance if appropriate.
- Notebook instance name: e.g.,
-
Configure VPC‑only networking
- In the Network section:
- VPC: choose your target VPC.
- Subnet: choose a private subnet where you want the notebook to run.
- Security groups: choose a security group that allows required traffic (e.g., to S3, training jobs, databases, etc. via VPC endpoints or NAT).
- Direct internet access: set to Disable.
- In the Network section:
-
Additional options (optional)
- Match lifecycle configuration, encryption keys (KMS), etc., with your existing environment.
-
Create the notebook
- Click Create notebook instance.
- Wait until status is InService.
3. Migrate content from old notebook
Typical options:- Using the same EBS volume (if possible)
- If your old notebook used its default volume and you want to re‑use it, you’d need to stop the old instance and re‑attach the volume to a new instance programmatically (this is easier via CLI and is more advanced).
- Export / import notebooks
- Open the old notebook instance.
- In Jupyter/JupyterLab, download your notebooks (
.ipynb), scripts, and data to your local machine or to S3. - Open the new VPC‑only notebook and upload the files or pull them from S3.
- Use S3 as a source of truth
- If your code/data already lives in S3 or a repo, just configure the new notebook to pull it (git clone, S3 copy, etc.).
4. Decommission the old non‑VPC notebook
- Ensure all code/data is migrated.
- In the SageMaker console → Notebook instances, stop the old notebook.
- When no longer needed, select it and choose Actions → Delete.
After these steps, your SageMaker notebook usage will be compliant with “Notebook Instance Should Be In VPC Only Mode” by ensuring:
- It runs inside a VPC subnet with appropriate security groups.
- Direct internet access is disabled.
Using CLI
Using CLI
To put a SageMaker notebook instance into VPC-only mode using AWS CLI, you must:
Check
Notes:
You should see:
- Attach it to a VPC subnet and security group(s)
- Disable direct internet access
1. Prerequisites
You must have:- A VPC ID (e.g.,
vpc-0123456789abcdef0) - A private subnet ID in that VPC (e.g.,
subnet-0123456789abcdef0) - One or more security group IDs (e.g.,
sg-0123456789abcdef0) - Your notebook instance name (e.g.,
my-notebook)
2. Confirm current notebook configuration (optional)
SubnetId, SecurityGroups, and DirectInternetAccess.3. Stop the notebook instance (required to update)
4. Update notebook to VPC-only mode
Useupdate-notebook-instance to:- Set
--subnet-idand--security-group-ids - Set
--direct-internet-access Disabled
- The subnet must be in the specified VPC and have required routing (e.g., to a NAT gateway or VPC endpoints, depending on how you want the notebook to reach AWS services).
- Security groups should allow required outbound traffic (e.g., to SageMaker, S3 via VPC endpoints, etc.).
5. Start the notebook instance
6. Verify VPC-only configuration
SubnetIdsetSecurityGroupslist populatedDirectInternetAccess="Disabled"(VPC-only mode)
Using Python
Using Python
To force a SageMaker Notebook Instance into VPC-only mode using Python (boto3), you must:
Note:
At this point, the notebook is:
This ensures all new notebooks are compliant by default.
- Stop the notebook
- Attach it to a VPC (subnet + security groups)
- Disable direct internet access
1. Prerequisites
boto3installed and configured with AWS credentials/region.- An existing VPC subnet ID and one or more security group IDs that allow the traffic you need (e.g., to SageMaker, S3 via VPC endpoint, etc.).
2. Identify the Notebook and Target VPC Settings
Decide:NOTEBOOK_INSTANCE_NAMESUBNET_ID(e.g.,subnet-0123456789abcdef0)SECURITY_GROUP_IDS(e.g.,['sg-0123456789abcdef0'])
3. Stop the Notebook Instance (if running)
SageMaker does not allow modifying network settings on a running notebook. Stop it first:4. Update Notebook to VPC-Only Mode
Useupdate_notebook_instance to:- Set SubnetId and SecurityGroupIds (attach to VPC)
- Disable DirectInternetAccess (
'Disabled'= VPC‑only)
- You can supply only the parameters you want to change; the above shows them explicitly.
- If the notebook was already in a subnet/SG but with direct internet access enabled, you can just call with
DirectInternetAccess="Disabled".
5. Start the Notebook Instance
- Attached to your VPC (
SubnetId+SecurityGroupIds) - Running with DirectInternetAccess disabled → VPC-only mode.

