aws runtime_error ai_generated true

资源创建已取消:资源创建在 60 分钟后超时 (AWS::CloudFormation::Stack)

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

ID: aws/cloudformation-stack-creation-timeout

其他格式: JSON · Markdown 中文 · English
85%修复率
87%置信度
1证据数
2023-11-05首次发现

版本兼容性

版本状态引入弃用备注
CloudFormation API 2010-05-15 active
AWS CLI 2.13.0 active

根因分析

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

English

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

官方文档

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

解决方案

  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' 并设置自定义超时。

无效尝试

常见但无效的做法:

  1. 95% 失败

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

  2. 80% 失败

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