aws runtime_error ai_generated true

Resource creation cancelled: Resource creation timed out after 60 minutes (AWS::CloudFormation::Stack)

ID: aws/cloudformation-stack-creation-timeout

Also available as: JSON · Markdown · 中文
85%Fix Rate
87%Confidence
1Evidence
2023-11-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
CloudFormation API 2010-05-15 active
AWS CLI 2.13.0 active

Root Cause

A CloudFormation stack creation exceeded the default 60-minute timeout, typically due to a slow resource provisioning (e.g., large RDS instance, complex nested stack).

generic

中文

CloudFormation 堆栈创建超过了默认的 60 分钟超时,通常是由于资源预配缓慢(例如大型 RDS 实例、复杂的嵌套堆栈)。

Official Documentation

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-timeouts.html

Workarounds

  1. 90% success Increase the stack creation timeout using the CloudFormation console or CLI: 'aws cloudformation create-stack --stack-name my-stack --template-body file://template.yaml --timeout-in-minutes 120'. Set a value appropriate for the expected provisioning duration.
    Increase the stack creation timeout using the CloudFormation console or CLI: 'aws cloudformation create-stack --stack-name my-stack --template-body file://template.yaml --timeout-in-minutes 120'. Set a value appropriate for the expected provisioning duration.
  2. 75% success Optimize the CloudFormation template: break large stacks into nested stacks with individual timeouts, or use 'DependsOn' sparingly to reduce sequential dependencies. Consider using 'AWS::CloudFormation::WaitCondition' with a custom timeout for long-running resource creation.
    Optimize the CloudFormation template: break large stacks into nested stacks with individual timeouts, or use 'DependsOn' sparingly to reduce sequential dependencies. Consider using 'AWS::CloudFormation::WaitCondition' with a custom timeout for long-running resource creation.

中文步骤

  1. 使用 CloudFormation 控制台或 CLI 增加堆栈创建超时时间:'aws cloudformation create-stack --stack-name my-stack --template-body file://template.yaml --timeout-in-minutes 120'。根据预期的预配持续时间设置适当的值。
  2. 优化 CloudFormation 模板:将大型堆栈拆分为具有单独超时的嵌套堆栈,或谨慎使用 'DependsOn' 以减少顺序依赖。考虑对长时间运行的资源创建使用 'AWS::CloudFormation::WaitCondition' 并设置自定义超时。

Dead Ends

Common approaches that don't work:

  1. 95% fail

    Simply retrying the stack creation without increasing timeout or optimizing resource provisioning will hit the same timeout again.

  2. 80% fail

    Deleting the failed stack and recreating it with the same template doesn't address the root cause; the timeout will recur.