include::../description.adoc[]

include::../ask-yourself.adoc[]

include::../recommended.adoc[]

== Sensitive Code Example

For https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnNotebookInstance.html[`aws-cdk-lib.aws-sagemaker.CfnNotebookInstance`]

[source,javascript]
----
import { CfnNotebookInstance } from 'aws-cdk-lib/aws-sagemaker';

new CfnNotebookInstance(this, 'example', {
      instanceType: 'instanceType',
      roleArn: 'roleArn'
}); // Sensitive
----

== Compliant Solution

For https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnNotebookInstance.html[`aws-cdk-lib.aws-sagemaker.CfnNotebookInstance`]

[source,javascript]
----
import { CfnNotebookInstance } from 'aws-cdk-lib/aws-sagemaker';

const encryptionKey = new Key(this, 'example', {
    enableKeyRotation: true,
});
new CfnNotebookInstance(this, 'example', {
    instanceType: 'instanceType',
    roleArn: 'roleArn',
    kmsKeyId: encryptionKey.keyId
});
----

include::../see.adoc[]

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

* Omitting `kms_key_id` disables encryption of SageMaker notebook instances. Make sure it is safe here.

=== Highlighting

* Highlight the `props` object if it does not contain the property `kmsMasterKeyId`.
* Highlight the `kmsMasterKeyId` attribute if it is set to `undefined`.

endif::env-github,rspecator-view[]
