Tired of trawling through the full CloudFormation docs? Here’s a quick reference for commonly used things.
!Ref ResourceName
{ "Fn::Ref": "ResourceName" }
!GetAtt ResourceName.AttributeName
{ "Fn::GetAtt": [ "ResourceName", "AttributeName" ] }
!Sub "something:with:${Variable}"
{ "Fn:Sub": "something:with:${Variable}" }
!Sub
- something:with:${Variable}
- { Variable: "foo" }
{ "Fn:Sub": [ "something:with:${Variable}", { "Variable": "foo" } ] }
Yaml form | Yaml Shorthand | Original JSON |
---|---|---|
Fn::Ref arg | !Ref arg | { "Fn::Ref": arg } |
Intrinsic functions can be nested, but take care with the shorthand yaml form as that cannot be nested consecutively.
Ok: Fn::GetAZs: !Ref 'AWS::Region'
Not Ok: !GetAZs !Ref 'AWS::Region'
AWS::Region
AWS::AccountId