aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.62k stars 3.91k forks source link

(synthetics): add DeleteLambdaResourcesOnCanaryDeletion to the canary L2 #23772

Closed kaizencc closed 1 year ago

kaizencc commented 1 year ago

Describe the feature

Lambda has a new? property that will delete lambda resources when the canary is deleted.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-deletelambdaresourcesoncanarydeletion

This is a step in the right direction, but still not perfect, because canaries will still isolate s3 buckets, log groups, etc. Still, we should support this property in the L2 and allow our users to specify this prop.

Use Case

Currently, after deleting the canary you have to go and manually delete lambda/s3/cloudwatch logs. Now, you can set this property and only delete s3 + cloudwatch.

Proposed Solution

Add the prop to Canary. This will need some testing to make sure that the property is doing what we expect.

Other Information

No response

Acknowledgements

CDK version used

latest

Environment details (OS name and version, etc.)

MacOs

github-actions[bot] commented 1 year ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

jedwards1211 commented 4 months ago

Did this property go away? OP's link to the CloudFormation docs no longer shows anything about DeleteLambdaResourcesOnCanaryDeletion.

SankyRed commented 4 months ago

As part of stabilizing the synthetics module I see @kaizencc has cleaned up DeleteLambdaResourcesOnCanaryDeletion property in this PR. Also, instead of enableAutoDeleteLambdas you could use cleanup: Cleanup.LAMBDA the same affect via custom resource.

jedwards1211 commented 4 months ago

Do you know if CloudFormation itself supports deleting the lambda? I'm not actually using the CDK, just landed here because OP had a link to the CloudFormation docs that looks like it mentioned the kind of option I need.