Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add option to use CMK and set the resources retention #573

Merged
merged 6 commits into from
Sep 25, 2024

Conversation

charles-marion
Copy link
Collaborator

Issue #, if available:

Description of changes:

  • Add an option to use a customer managed keys for data encryption.
  • Add an option to retain data stores and logs on cleanup
  • Add versioning to all buckets

Testing

  • Verified the generated template without change of configuration has no breaking change
  • Migrated an existing environment to use CMK. The difference can be seen in this commit (/tests/snapshots/cdk-app.test.ts.snap)
  • Manual tests + Integration tests

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@@ -17,15 +15,13 @@ export class SageMakerModel extends Construct {
const { model } = props;
this.modelId = model.modelId;

if (model.type == DeploymentType.Container) {
const { endpoint } = deployContainerModel(this, props, model);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed because it was never used.

removalPolicy: cdk.RemovalPolicy.DESTROY,
storageEncryptionKey: props.shared.kmsKey,
// Always setting it to true would be a breaking change.
storageEncrypted: props.shared.kmsKey ? true : false,
Copy link
Collaborator Author

@charles-marion charles-marion Sep 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My preference would be to always enable it but it would trigger the recreation of the cluster

@charles-marion charles-marion changed the title feat: Add option to use CMK and set the resource retention feat: Add option to use CMK and set the resources retention Sep 20, 2024
encryption: props.kmsKey
? dynamodb.TableEncryption.CUSTOMER_MANAGED
: dynamodb.TableEncryption.AWS_MANAGED,
encryptionKey: props.kmsKey,
Copy link
Collaborator

@grinko grinko Sep 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if props.kmsKey does not exist? Same comment for other constructs like ChatBotS3Buckets, RealtimeResolvers, ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It passes undefined. (property is ignored)

enforceSSL: true,
encryption: s3.BucketEncryption.S3_MANAGED,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does logs bucket encrypted with S3 managed key and files bucket has options?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not supported.
https://docs.aws.amazon.com/AmazonS3/latest/userguide/enable-server-access-logging.html

"You can use default bucket encryption on the destination bucket only if you use server-side encryption with Amazon S3 managed keys (SSE-S3), which uses the 256-bit Advanced Encryption Standard (AES-256). Default server-side encryption with AWS Key Management Service (AWS KMS) keys (SSE-KMS) is not supported."

@charles-marion charles-marion merged commit d419d58 into aws-samples:main Sep 25, 2024
1 check passed
charles-marion added a commit to charles-marion/aws-genai-llm-chatbot that referenced this pull request Sep 25, 2024
lloydclowes pushed a commit to lloydclowes/gen-ai-playground that referenced this pull request Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants