More Info:
Sagemaker Notebook instance should be associated to a VPCRisk Level
MediumAddress
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
For SageMaker Notebook Instances, you cannot change an existing notebook from “no VPC” to “in VPC.” You must create a new notebook instance in a VPC and then decommission the old one.Below are step‑by‑step instructions using the AWS Console:
This process results in your SageMaker Notebook Instance running inside a VPC, satisfying the “Notebook Instance Should Be In VPC” requirement.
1. Prerequisites: Identify / Prepare VPC, Subnet, and Security Group
- In the AWS Console, go to VPC service.
- Choose (or create) a VPC you want to use.
- Under Subnets, pick a private subnet (recommended) with:
- Route to required services (e.g., NAT Gateway for internet access if needed).
- Under Security Groups, either:
- Choose an existing one, or
- Create a new security group with:
- Outbound rules to allow access to SageMaker endpoints, S3, etc. (usually “All traffic” outbound is fine if routed via NAT).
- Inbound rules only if you need specific inbound connections (often none are needed for notebooks).
2. Create a New Notebook Instance in the VPC
- Go to Amazon SageMaker in the console.
- In the left navigation pane, select Notebook instances.
- Click Create notebook instance.
- Fill in:
- Notebook instance name: e.g.,
sagemaker-notebook-in-vpc. - Notebook instance type: same as your current instance or as needed.
- Notebook instance name: e.g.,
- IAM role:
- Select Existing role if you already have a SageMaker execution role.
- Otherwise, choose Create a new role and allow required S3 access.
- Scroll down to Network (or Network and security) section:
- VPC: Select your target VPC.
- Subnet: Select the private subnet you prepared.
- Security group(s): Select the security group you prepared.
- (Optional) Under Additional configuration:
- Attach the same Lifecycle configuration as the old instance if you used one.
- Configure any volume size, encryption, etc., to match your requirements.
- Click Create notebook instance.
- Wait until the status becomes InService.
3. Migrate Your Work (Notebooks, Code, Data)
- Open the old notebook instance:
- From Notebook instances, click Open Jupyter or Open JupyterLab.
- Copy notebooks and files to durable storage:
- Preferred: Save them in Amazon S3 (if they’re not already).
- Use the Jupyter file browser “Download” or upload them to S3 using the AWS CLI / SDK / Jupyter extensions.
- Preferred: Save them in Amazon S3 (if they’re not already).
- Open the new VPC‑based notebook instance:
- From Notebook instances, click Open Jupyter or Open JupyterLab.
- Restore content:
- Download from S3 or upload from local machine into the new notebook instance.
- Verify:
- Run a few notebooks to confirm they can access needed data (S3, databases, external APIs via NAT, etc.).
4. Decommission the Old Non‑VPC Notebook Instance
- In Amazon SageMaker → Notebook instances:
- Select the old notebook instance.
- Choose Stop.
- Wait until the status is Stopped.
- With the instance selected, choose Delete.
- Confirm deletion.
5. (Optional) Tighten Network Controls
In VPC → Security groups:- Restrict inbound rules to only what is necessary.
- Leave outbound open or restrict to required destinations if you have more advanced network controls (VPC endpoints, proxy, etc.).
This process results in your SageMaker Notebook Instance running inside a VPC, satisfying the “Notebook Instance Should Be In VPC” requirement.
Using CLI
Using CLI
For SageMaker, you cannot “move” an existing Notebook Instance into a VPC; you must create a new notebook in a VPC, move any code/data, then delete the old one.Below are step‑by‑step AWS CLI–based instructions.
For each notebook:Any instance with
Get subnets for a chosen VPC:Get or create a security group:Example: create a new SG:
Wait for it to be Confirm VPC settings:
1. Identify notebook instances not in a VPC
"SubnetId": null is not in a VPC.2. Choose / prepare VPC resources
You need:- A VPC ID
- A private subnet ID in that VPC
- One or more security group IDs allowing needed outbound traffic (and inbound if required, e.g., for SSM or Git)
3. Create a new Notebook Instance in the VPC
Decide:INSTANCE_TYPE(e.g.,ml.t3.medium)ROLE_ARN– execution role withsagemaker:*/ S3 permissionsSUBNET_ID– from step 2SG_ID– from step 2- Optional: lifecycle config, volume size, etc.
InService:4. Migrate notebooks / data
Typical pattern (if old notebook is still accessible via console):-
From the old notebook, ensure all notebooks and code are saved to S3 (e.g.,
~/SageMakerauto‑syncs to S3 if configured). -
Alternatively, sync manually:
-
On the new notebook instance, pull from S3:
5. Stop and delete old non‑VPC notebook instance
6. (Optional) Enforce “must be in VPC” via SCP or IaC
To prevent future non‑VPC notebooks, you can:- Use a Service Control Policy denying
sagemaker:CreateNotebookInstanceifsagemaker:SubnetIdis not present. - Use Infrastructure‑as‑Code (CloudFormation/Terraform) that always sets
SubnetIdandSecurityGroupIds.
describe-notebook-instance), I can give an exact create-notebook-instance CLI command that reproduces it inside a VPC.Using Python
Using Python
For SageMaker, a notebook instance cannot be moved into a VPC after creation. You must:
To wait until it’s ready:
- Create (or choose) a VPC, subnet, and security group.
- Create a new SageMaker notebook instance configured to use that VPC.
- Migrate code/data from the old notebook (e.g., via Git, S3).
- Delete the old non‑VPC notebook.
1. Prerequisites
boto3installed and configured with credentials/region.- You have (or will create) the following:
- VPC ID:
vpc-xxxxxxxx - Subnet ID in that VPC:
subnet-xxxxxxxx - Security Group ID that allows needed traffic:
sg-xxxxxxxx - IAM role with SageMaker permissions:
arn:aws:iam::<account-id>:role/<SageMakerRole>
- VPC ID:
2. Create a SageMaker Notebook in a VPC (Python/boto3)
3. (Optional) Stop and Delete the Old Non‑VPC Notebook
4. Notes for Compliance
- Ensure SubnetId and SecurityGroupIds are always specified when calling
create_notebook_instance. - Enforce via CI/CD or internal tooling so that notebooks are only created with VPC settings.
- If needed, you can verify compliance by listing and checking:

