Skip to main content

More Info:

Sagemaker Notebook Instance should be encrypted with KMS Customer Managed Keys

Risk Level

High

Address

Security

Compliance 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

Using Console

To remediate this in the AWS Management Console, you’ll usually need to create a new notebook instance that uses a customer-managed KMS key (CMK); the KMS key cannot be changed on an existing instance.

1. Create or Identify a Customer-Managed KMS Key

  1. Sign in to the AWS Management Console.
  2. Go to Key Management Service (KMS).
  3. In the left pane, choose Customer managed keys.
  4. Choose Create key (if you don’t already have a CMK you want to use):
    • Key type: Symmetric.
    • Key usage: Encrypt and decrypt.
    • Configure Key administrators and Key users (include IAM roles/users used by SageMaker).
    • Finish the wizard and note the Key ID or ARN.
Make sure the SageMaker execution role has permissions to use this key (via KMS key policy or IAM).

2. Capture Configuration of Existing Notebook (for recreation)

  1. Go to Amazon SageMaker in the console.
  2. In the left pane, choose Notebook instances.
  3. Click your existing notebook instance.
  4. Note:
    • Instance type
    • VPC / subnets / security groups (if used)
    • IAM role
    • Lifecycle configuration (if any)
    • Volume size
    • Any other relevant settings.
If you have important data in the notebook’s EBS volume, back it up (e.g., sync to S3 from the notebook).

3. Create a New Notebook Instance Encrypted with CMK

  1. In SageMaker ConsoleNotebook instances → click Create notebook instance.
  2. Set:
    • Notebook instance name: A new name (or plan to rename later).
    • Notebook instance type: Same as old (or as desired).
    • IAM role: Same role as the old notebook (if appropriate).
    • VPC, subnets, security groups: Match the previous configuration if used.
    • Volume size in GB: Same or larger.
  3. Under Encryption key – optional:
    • Choose Enter a KMS key ID or choose from your AWS KMS keys.
    • Select the customer-managed KMS key created/identified in step 1.
  4. Configure Lifecycle configuration if needed.
  5. Click Create notebook instance and wait for the status to become InService.

4. Migrate Data (If Needed)

  1. Open the old notebook instance and ensure any notebooks/data are copied to S3 (or another storage), if you haven’t already.
  2. Open the new KMS-encrypted notebook.
  3. Pull your data back from S3 (or other backup location) into the new instance as required.

5. Decommission the Unencrypted Notebook

  1. In SageMaker ConsoleNotebook instances.
  2. Select the old notebook instance.
  3. Click Stop and wait until it is stopped.
  4. Once confirmed that all needed data has been migrated, select the old instance and choose Delete.
Your SageMaker notebook workload is now running on an instance whose EBS volume is encrypted using a customer-managed KMS key.
Below are step‑by‑step AWS CLI instructions to ensure a SageMaker notebook instance is encrypted with a customer-managed KMS key (CMK).Important limitation:
You cannot modify the KMS key of an existing SageMaker notebook instance. You must create a new notebook instance with a CMK and migrate any data.

1. Create (or identify) a KMS Customer Managed Key

If you already have a CMK you want to use, skip to step 2.
Get the KeyId or ARN from the output, or list keys:
Describe the key to confirm:
You’ll use <KEY_ARN> or <KEY_ID> in --kms-key-id later.
Give SageMaker (and your users/roles) permission to use the key. Example key policy snippet (you’d merge this into your CMK’s key policy):
Apply via:

3. Stop and delete the existing unencrypted notebook instance

First, stop it:
Wait until status is Stopped:
Then delete:
Ensure any notebooks are saved to S3 or source control; the EBS volume will be lost.

4. Create a new SageMaker notebook instance encrypted with CMK

(Adjust --instance-type, --volume-size-in-gb, and add any other options you used previously, such as --security-group-ids, --subnet-id, --tags, --lifecycle-config-name, etc.)Start the notebook:

5. Verify the notebook is using the CMK

You should see the CMK ARN/ID you provided.

6. Migrate notebooks/data (if needed)

If you had notebook files in the old instance:
  • If they were in S3: point your new notebook to the same S3 buckets.
  • If they were only on the old EBS volume and you didn’t back them up, they are not recoverable after deletion.
    For future, use:
    • Git integration (from the notebook UI) or
    • Sync to S3 (e.g., aws s3 sync from a terminal in the notebook).

These steps ensure the SageMaker notebook instance’s EBS volume is encrypted with your KMS customer-managed key using AWS CLI.
Below are practical, step‑by‑step instructions and Python (boto3) snippets to ensure a SageMaker notebook instance is encrypted with a customer managed KMS key.

Key points up front

  • The KmsKeyId of a SageMaker notebook instance cannot be changed in place.
  • To remediate:
    1. Create or identify a KMS CMK.
    2. Create a new notebook instance with KmsKeyId specified.
    3. Migrate any data from the old instance (S3, Git, or manual copy) and then delete the old one.

1. Prerequisites


2. Create or identify a customer managed KMS key

If you already have a CMK, skip to step 3.
You can later refer to this key via either cmk_id or alias/sagemaker-notebook-cmk.

3. Verify existing notebook’s encryption (to identify non‑compliant ones)

If KmsKeyId is missing or using the default AWS managed key (rather than your CMK), it’s non‑compliant.

4. Create a new encrypted notebook instance with KMS CMK

You must specify KmsKeyId at creation time:
Then start it:

5. Migrate content from old notebook to new

Common approaches (not strictly Python, but required for remediation):
  1. If work is in S3 (recommended):
    • Configure the old notebook to save notebooks and data to S3.
    • In the new notebook, open from the same S3 location.
  2. Git-based projects:
    • Commit/push from the old notebook.
    • Clone/pull in the new notebook.
  3. Direct copy (manual):
    • From the old notebook UI, download .ipynb and data.
    • Upload to the new notebook.
If you want to script S3 copy from your local machine (assuming everything is in S3):

6. Stop and delete the old, unencrypted notebook


7. (Optional) Enforce CMK encryption for all future notebooks

You can run a simple Python check and auto‑remediate by creating compliant replacements for non‑compliant notebooks:

If you share:
  • how your notebooks are currently storing data (S3 path, EBS only, or Git), and
  • whether you need an automated remediation script or a one-time migration,
I can provide a more specific Python script tailored to your setup.