| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
Within an AWS CloudFormation template, any named item can be used as a reference, including parameters and resources.
With the Ref function, you specify the logical name of any resource to dereference a value for another resource, output, parameter, or intrinsic function.
For example, in the Resources section, you might declare a security group resource with the logical name
"HighRestriction". Elsewhere in another resource declaration, you can use "Ref" :
"HighRestriction" as the value for another resource's property.
In the following example, the parameter "MyURL" is declared with a default String value of
"http://aws.amazon.com". Later in the Outputs section, that value is dereferenced as "Ref" :
"MyURL".
"Parameters" : {
"MyURL" : {
"Type" : "String",
"Default" : "http://aws.amazon.com"
},
...
"Outputs" : {
"URL" : {
"Value" : { "Ref" : "MyURL" }
}
}The value that AWS CloudFormation returns for the dereferenced object depends on the resource type. See Resource Property Types Reference for details about the specific return values for each supported type.
Most of the sample templates make use of the Ref function (see Example Templates). Also, for technical details about the Ref function, see Ref.