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 CloudFormation?
Last updated: 2022-09-19
When I use my Resource Provider type to create a resource in AWS CloudFormation, I receive the following error:
"Resource timed out waiting for creation of physical resource"
When a resource doesn't return its primaryIdentifier or Physical ID within 60 seconds, you receive the "Resource timed out waiting for creation of physical resource" error. This error occurs because the CreateHandler of your resource doesn't return the property that's specified as the primaryIdentifier in the organization-service-resource.json resource provider schema file.
For other errors that are related to using a resource provider, see the following articles:
- How do I resolve the "Resource specification is invalid" error when I run the cfn generate command using the CloudFormation CLI in CloudFormation?
- How do I resolve the "Model validation failed (#: extraneous key [Key] is not permitted)" error in 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 CloudFormation?
- How do I resolve the "java.lang.ClassNotFoundException: com.example.package.resource.HandlerWrapper" error in CloudFormation?
1. In your organization-service-resource.json file, confirm that the primaryIdentifier definition uses the following format, where Id is a property that's defined in the properties section:
"primaryIdentifier": [ "/properties/Id" ]
Note: The organization-service-resource.json format 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();