如何解决在 CloudFormation 中使用资源提供商类型创建资源时收到的“Resource timed out waiting for creation of physical resource”(等待创建物理资源时资源超时)错误?

1 分钟阅读
0

当我使用我的资源提供商类型在 AWS CloudFormation 中创建资源时,我收到以下错误: "Resource timed out waiting for creation of physical resource"(等待创建物理资源时资源超时)

简短描述

如果资源未在 60 秒内返回其 primaryIdentifier物理 ID,您将会收到"Resource timed out waiting for creation of physical resource"(等待创建物理资源时资源超时)这一错误。发生错误是因为,您的资源的 CreateHandler 未返回在organization-service-resource.json 资源提供者 schema 文件中被指定为 primaryIdentifier 的属性。

有关与使用资源提供商相关的其他错误,请参阅以下文章:

解决方法

1.    在您的organization-service-resource.json文件中,确认 primaryIdentifier 定义遵循的是此格式,其中,Id是在属性部分定义的:

"primaryIdentifier": [
    "/properties/Id"
]

**注意:**organization-service-resource.json 格式位于项目的根目录中。

2.    在 CreateHandler中,在模型对象中设置primaryIdentifier属性。例如:

final ResourceModel model = request.getDesiredResourceState();
model.setId("abcdxyz");
return ProgressEvent.<ResourceModel, CallbackContext>builder()
    .resourceModel(model)
    .status(OperationStatus.SUCCESS)
    .build();

相关信息

AWS CloudFormation CLI(来自GitHub 网站)

AWS 官方
AWS 官方已更新 2 年前