aws-cdk: How to specify stack creation and rollback timeout?

Very often (especially with CustomResources) Cloudformation fails to create the stack - BUT it takes about 1 hour for Cloudformation to recognize this and then another hour to rollback. This is incredibly frustrating if you try to get things done!

Is there a way to set a timeout to lets say 5 minutes for stack creation and rollback to speed up trial and error development and deployment?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 20
  • Comments: 18 (5 by maintainers)

Most upvoted comments

@eladb this does not address the issue. What folks are really looking for is the CDK equivalent to --timeout-in-minutes that is part of the AWS CLI today. Even if this was something that is set from the CDK CLI that would be more than acceptable.

There is support for timeout in the CloudFormation (see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-console-add-tags.html) but I can’t find how to use this in CDK. I am interested in this feature as well, waiting that much for a rollback is painful.

Resolved by #4572

@eladb hello, I’m not sure if I understand, how it that fixing the issue? Could you please provide a short example here? Thanks

Add CF WaitCondition in your stack could configure the timeout of stack,

 const waitHandle = new cfn.CfnWaitConditionHandle(this, 'WaitConditionHandle');
    const waitCondition = new cfn.CfnWaitCondition(this, 'WaitCondition', {
      count: 1,
      handle: waitHandle.ref,
      timeout: '600'
    });
 scope.node.addDependency(waitCondition);

+1 I’m about to give up using CDK in production because of this issue. It’s totally unrealistic to expect people to wait hours for rollbacks when you’re using Fargate.