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?
It鈥檚 a great idea but sadly unsupported by CloudFormation. We are trying to look for ways to make it easier to author custom resources. For example, a common reason for those to hang the stack is if they don鈥檛 submit a response when an exception is thrown. Maybe we can integrate with a framework for custom resources that will make it easier to implement without making those mistakes.
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.
Same here. This feature will be useful when composing CDK and deploying stack for testing.
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);
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
@BerndWessels I was baffled by this too, but after looking at #4572 PR realized I should use Provider from @aws-cdk/custom-resources (instead of cloudformation.CustomResourceProvider).
See: https://docs.aws.amazon.com/cdk/api/latest/docs/custom-resources-readme.html#timeouts
Most helpful comment
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.