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?

Last updated: 2022-09-19

When I use the Fn::GetAtt function on my resource provider in AWS CloudFormation, I receive the following error:

"Attribute 'Key' does not exist"

Short description

Resolution

1.    In your organization-service-resource.json file, confirm that the readOnlyProperties definition uses the following format, where Output is a property that's defined in the properties section. For example:

"readOnlyProperties": [
    "/properties/Output"
],

Note: The organization-service-resource.json format is located in the root directory of your project.

2.    In your ReadHandler, set the property in the model object. For example:

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

AWS CloudFormation CLI (from the GitHub website)

Did this article help?


Do you need billing or technical support?