How do I resolve the "Resource timed out waiting for creation of physical resource" error when I create a resource using my resource provider type in AWS CloudFormation?
Last updated: 2020-08-17
I receive the "Resource timed out waiting for creation of physical resource" error in my stack events when I create a resource using my Resource Provider type in AWS CloudFormation. How can I resolve this error?
If a resource doesn't return its primaryIdentifier or Physical ID within 60 seconds, then AWS CloudFormation returns the "Resource timed out waiting for creation of physical resource" error. The error happens because the CreateHandler of your resource doesn't return the property specified as the primaryIdentifier in the resource provider schema file organization-service-resource.json.
If you're having issues with other errors related to using a resource provider, see the following articles for additional troubleshooting steps:
- How do I resolve the "Resource specification is invalid" error when I run the cfn generate command using the CloudFormation CLI in AWS CloudFormation?
- How do I resolve the "Model validation failed (#: extraneous key [Key] is not permitted)" error in AWS CloudFormation?
- How do I resolve the "Attribute 'Key' does not exist" error when I use the Fn::GetAtt function on my resource provider resource in AWS CloudFormation?
- How do I resolve the "java.lang.ClassNotFoundException: com.example.package.resource.HandlerWrapper" error in AWS CloudFormation?
1. In your organization-service-resource.json file, confirm that the primaryIdentifier definition follows this format, where Id is a property defined in the properties section:
"primaryIdentifier": [ "/properties/Id" ]
Note: The resource provider schema file is a JSON file in the organization-service-resource.json format and is located in the root directory of your project.
2. In your CreateHandler, set the primaryIdentifier property in the model object. For example:
final ResourceModel model = request.getDesiredResourceState(); model.setId("abcdxyz"); return ProgressEvent.<ResourceModel, CallbackContext>builder() .resourceModel(model) .status(OperationStatus.SUCCESS) .build();