11

Can we change the default timeout of AWS CustomResource, as its default timeout is 1 hour and the job that will return an HTTP response to the custom resource is taking approximately 2 hours to send the response and the custom resource is getting timed out before that.

Yves M.
  • 29,855
  • 23
  • 108
  • 144
priyojit Pal
  • 111
  • 1
  • 4
  • 5
    You want to change it to a larger value, I'd like to change it to a smaller value. Certain error types (like a typo in a module name) cause the lambda to fail, but we have to wait 1 hour for the deploy to fail, and another hour for the rollback to complete. Ouch! – Elroy Flynn Dec 05 '18 at 20:59
  • For this reason, I'll probably cease from invoking lambdas during cloudformation deploy, and instead do my necessary work in scripts that follow the CF deploy. – Elroy Flynn Dec 05 '18 at 21:01
  • Have you tried the technique mentioned in the link here, https://operatingops.org/2018/10/13/cloudformation-custom-resources-avoiding-the-two-hour-exception-timeout/ – dghant1024 Aug 03 '20 at 03:57
  • 1
    @dghant1024 - OP is not asking about how to handle timeout issues due to error. They are asking because he has a resource that actually takes 2 hours to SUCCESSFULLY complete. It will complete successfully, but after the timeout, at which point CloudFormation assumes it has failed. – ipetrik Jan 12 '21 at 19:47
  • 1
    It helps me save an hour by cancelling the update so it then takes one hour for it to rollback. But looking to save that hour too – The_Coder Dec 07 '21 at 05:58

2 Answers2

4

In November 2019, CloudFormation shifted focus from custom resources to CloudFormation Registry resource providers:

https://aws.amazon.com/blogs/aws/cloudformation-update-cli-third-party-resource-support-registry/

While there are many other differences between custom resources and Registry resource providers, one is that Registry resource providers support timeoutInMinutes on Create, Update, and Delete handlers, which is currently configurable from 2 to 2160 minutes (36 hours)


Registry resource provider development information can be found here and here for anyone investigating if this is a suitable alternative

Pat Myron
  • 4,437
  • 2
  • 20
  • 39
-2

This may be what you are looking for:

https://operatingops.org/2018/10/13/cloudformation-custom-resources-avoiding-the-two-hour-exception-timeout/

Listed above is a good way to check for event errors instead of waiting for the initial default timeout of a cloudformation custom resource, or waiting an hour for that custom resource to rollback.

dghant1024
  • 184
  • 2
  • 8
  • 4
    OP is not asking about how to handle timeout issues due to error. They are asking because he has a resource that actually takes 2 hours to SUCCESSFULLY complete. It will complete successfully, but after the timeout, at which point CloudFormation assumes it has failed. – ipetrik Jan 12 '21 at 19:47
  • The link above would have been useful to me, but it's broken. – theberzi Jan 24 '23 at 09:52