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.34k stars 3.76k forks source link

custom-resource: Support of ServiceTimeout from Cloudformation #30517

Open btd opened 2 weeks ago

btd commented 2 weeks ago

Describe the feature

Hi, everyone.

Cloudformation just release ServiceTimeout attribute support in Custom Resources, so now we do not need to wait 1h to notice faulty deployment.

Announcement: https://aws.amazon.com/about-aws/whats-new/2024/06/aws-cloudformation-dev-test-cycle-timeouts-custom-resources/

Docs: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html#response-timeout

Use Case

Mostly development cycle should be improved when you actively develop custom resources. I will be able to set timeout to 5 min max and see it fail faster.

Proposed Solution

New optional property added to custom resource construct (not sure to which part, most likely it is framework)

Other Information

No response

Acknowledgements

CDK version used

all

Environment details (OS name and version, etc.)

AL2

pahud commented 2 weeks ago

Definitely, this is a highly anticipated feature that many users have been waiting for.

prazian commented 2 weeks ago

I just created this PR. I would appreciate to receive your thoughts and feedback: https://github.com/aws/aws-cdk/pull/30557

I still need to work on adding integration tests (probably a maintainer needs to create the snapshots) + also I don't know where in docs this can be added, but meanwhile would be great if someone looks at the approach and give feedback.

Currently, we have the timeout field for the lambda function that creates the resource (here is the cfn docs), but this new field sets timeout on a higher level (stack, instead of the lambda fn that creates the resource).

mrlikl commented 1 week ago

@pahud, what do you think about the idea of having a feature flag to control the default timeout for all the custom resources in a stack ?

Also, I do want to suggest having a different default timeout for CDK of 15mins rather than setting to 1hour (excluding edge cases like EKS cluster provider).

Main reason being for cases like lambda's failing to signal back due to network issues, users need not wait 1+1 hour (update as well as rollback) to have an updatable stack.