Fn::GetAtt retrieves a property value from a resource in a template.
Return the value of a property from a resource in a regular stack
Declaration
-
JSON
{ "Fn::GetAtt": [ "logicalNameOfResource", "attributeName" ] } -
YAML
-
Syntax for the full function name:
Fn::GetAtt: - logicalNameOfResource - attributeName -
Syntax for the short form:
!GetAtt logicalNameOfResource.attributeName
-
Parameters
-
logicalNameOfResource: the logical name of the resource, as defined in the template. -
attributeName: the name of the resource property to query.
Return value
The value of the attributeName property.
Examples
The following example returns the ImageId property from a resource named MyEcsInstance.
!GetAtt MyEcsInstance.ImageID{
"Fn::GetAtt": [
"MyEcsInstance",
"ImageID"
]
}The short form syntax supports resource names that contain periods (.). However, we recommend that you avoid using periods (.) in logical resource names to prevent errors.
Resources:
Foo.Moo.MyInstance:
Type: ALIYUN::ECS::InstanceGroup
Outputs:
ImageId:
Value: !GetAtt Foo.Moo.MyInstance.ImageID
Return the value of a property from the outputs of a nested stack
Declaration
-
JSON
{ "Fn::GetAtt": [ "nestedStackName", "Outputs.attributeName" ] } -
YAML
-
Syntax for the full function name:
Fn::GetAtt: - nestedStack - Outputs.attributeName -
Syntax for the short form:
!GetAtt nestedStack.Outputs.attributeNameNoteIn the short form syntax, the nested stack name can contain periods (
.), but the property name in the outputs cannot contain periods (.).
-
Parameters
-
nestedStack: the name of the nested stack. For more information about nested stacks, see Use nested stacks. -
Outputs.attributeName:Outputs.is a fixed prefix.attributeNamespecifies the name of the property to query from the outputs of the nested stack.
Return value
The property value from the outputs of the nested stack.
Examples
For more information, see ALIYUN::ROS::Stack.