SageMaker notebook encryption key settings need review

Distinguish SageMaker notebook default encryption from requirements for a customer managed key.

Description

SageMaker encrypts notebook OS and ML data volumes with system-managed keys by default. Set KmsKeyId when the ML data volume must use a key you control.

Potential impact

If the key becomes unavailable, the notebook can lose access to its data. Updating KmsKeyId in CloudFormation replaces the notebook instance.

Remediation

Back up required files before updating the stack. Choose an enabled KMS key and grant the required permissions. Restore files that need this key to /home/ec2-user/SageMaker on the new instance and verify access. Set notebook access controls and S3 output encryption separately.

Examples

Define the ExecutionRole IAM role resource whose ARN the template reads, and the NotebookKmsKeyArn parameter for the KMS key ARN.

Default encryption key

yaml
Resources:
  BasicNotebookInstance:
    Type: AWS::SageMaker::NotebookInstance
    Properties:
      InstanceType: ml.t2.large
      RoleArn: !GetAtt ExecutionRole.Arn

Without KmsKeyId, the notebook uses system-managed encryption.

Customer managed key

yaml
Resources:
  BasicNotebookInstance:
    Type: AWS::SageMaker::NotebookInstance
    Properties:
      InstanceType: ml.t2.large
      RoleArn: !GetAtt ExecutionRole.Arn
      KmsKeyId: !Ref NotebookKmsKeyArn

KmsKeyId selects the KMS key for the ML data volume.

References