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

Allow setting removal policy for BucketNotificationsHandler Lambda log group #19726

Closed
2 tasks
toxygene opened this issue Apr 1, 2022 · 3 comments
Closed
2 tasks
Labels
@aws-cdk/aws-iam Related to AWS Identity and Access Management closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@toxygene
Copy link

toxygene commented Apr 1, 2022

Describe the feature

I would like the ability to specify a log stream, or the removal_policy for the log stream, that is used by the BucketNotificationsHandler.

Use Case

If I understand it correctly, in order to add an S3 bucket event notification, CDK has to create a Lambda function. That Lambda automatically creates a log group. The log group does not have a removal policy, so cdk destroy does not remove it. I would like to be able to remove them automatically.

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.17.0

Environment details (OS name and version, etc.)

Darwin ML11085 19.6.0 Darwin Kernel Version 19.6.0: Thu Jan 13 01:26:33 PST 2022; root:xnu-6153.141.51~3/RELEASE_X86_64 x86_64

@toxygene toxygene added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Apr 1, 2022
@github-actions github-actions bot added the @aws-cdk/aws-iam Related to AWS Identity and Access Management label Apr 1, 2022
@rix0rrr
Copy link
Contributor

rix0rrr commented Apr 7, 2022

The Log Group is not created by CDK, but by Lambda, so this is potentially hard.

@rix0rrr rix0rrr added effort/medium Medium work item – several days of effort p2 and removed needs-triage This issue or PR still needs to be triaged. labels Apr 7, 2022
@rix0rrr rix0rrr removed their assignment Apr 7, 2022
@toxygene
Copy link
Author

toxygene commented Apr 7, 2022

It appears that, if a Log Stream with a name of /aws/lambda/{lambda function name} already exists, the Lambda will use it for logging. I have seen other services (eg Serverless Framework) use this detail to create Log Groups with custom settings, such as removal policies and retention periods. I've tested this myself with CloudFormation and confirmed it works as of this writing.

I'm not certain that this is documented behavior, so using it could be potentially risky, but it is an option currently.

(I sure would be nice if it was supported by CF)

@github-actions
Copy link

github-actions bot commented Apr 7, 2023

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-iam Related to AWS Identity and Access Management closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

2 participants