Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CloudFormation: Fn::GetAtt: not working for Endpoint.Address on AWS::RDS::DBInstance

When I try to update or create a change set for a stack which uses Fn::GetAtt: Database.Endpoint.Address (where Database is the logical name of an AWS::RDS::DBInstance resource), the attempt fails with Template error: every Fn::GetAtt object requires two non-empty parameters, the resource name and the resource attribute.

This appears to be because CloudFormation decodes the YAML into the following JSON:

[
  'Database',
  'Endpoint',
  'Address'
]

This is clearly three parameters when it ought to be two. Is this a known bug?

like image 320
Tom Barden Avatar asked Nov 29 '25 08:11

Tom Barden


2 Answers

Fn::GetAtt expects an array with two parameters. !GetAtt allows you to use the dot notation you are trying.

Either of these should work for you:

Fn::GetAtt: [ "Database", "Endpoint.Address" ]

!GetAtt Database.Endpoint.Address

Resources:

  • https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html
like image 170
JD D Avatar answered Dec 01 '25 21:12

JD D


CloudFormation Linter in VSCode shows errors inline while authoring templates along with autocompletion and documentation links:

Visual Studio Code extension

Switch the syntax to !GetAtt Database.Endpoint.Address

like image 31
Pat Myron Avatar answered Dec 01 '25 21:12

Pat Myron