-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
bucketNotificationDestination: SnsDestination does not give S3 service principal KMS access when Topic is encrypted under KMS key #29511
Comments
I'll take this. |
This one is tricky because with SQS, if you specify KMS and don't specify a key, CDK will create a new KMS key and can update the policy. However, if you specify the KMS key, CDK cannot update the key policy. See these lines. With SNS, CDK does not create the KMS key for you. You must specify the KMS key. And we can't update the key policy of an imported key. I suppose the options are:
I will wait for import from the team to proceed. |
Thank you @msambol we probably can do both but we need the input from the maintainers. |
@msambol I have a question about this
Is this a documented behavior ? |
Hey @msambol, since the Thanks! |
Describe the bug
In https://github.com/aws/aws-cdk/blob/v2.133.0/packages/aws-cdk-lib/aws-s3-notifications/lib/sns.ts, creating SnsDestination sets up topic access policy for S3 Service principal to publish to SNS topic.
But if topic has KMS key encryption, nothing is added and S3 cannot verify the notification destination configuration is valid.
Similar to what is done in SqsDestination https://github.com/aws/aws-cdk/blob/v2.133.0/packages/aws-cdk-lib/aws-s3-notifications/lib/sqs.ts#L27-L37
Expected Behavior
I was expecting the KMS key access to be given automatically when creating Sns notification destination.
Current Behavior
The SNS does not receive any notification as S3 is not able to verify destination is valid when SNS has KMS encryption.
Reproduction Steps
Creating an SNS topic using KSM encryption.
Creating an S3 bucket.
Adding SNS notification destination for S3 bucket events.
Possible Solution
Do similar as what is done in SqsDestination https://github.com/aws/aws-cdk/blob/v2.133.0/packages/aws-cdk-lib/aws-s3-notifications/lib/sqs.ts#L27-L37
Additional Information/Context
No response
CDK CLI Version
v2.133
Framework Version
No response
Node.js Version
18
OS
MacOS
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: