AWS CloudFormation
User Guide (API Version 2010-05-15)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

References

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.