| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
The intrinsic function Ref returns the value of the specified
parameter or resource.
When you specify a parameter's logical name, it returns the value of the parameter.
When you specify a resource's logical name, it returns a value that you can typically use to refer to that resource.
When you are declaring a resource in a template and you need to specify another template resource by name, you
can use the Ref to refer to that other resource. In general, Ref returns
the name of the resource. For example, a reference to an AWS::AutoScaling::AutoScalingGroup returns the name of that Auto Scaling group resource.
For some resources, an identifier is returned that has another significant meaning in the context of the resource. An AWS::EC2::EIP resource, for instance, returns the IP address, and an AWS::EC2::Instance returns the instance ID.
At the bottom of this topic, there is a table that lists the values returned for many common resource types.
More information about Ref return values for a particular resource or property can be found
in the documentation for that resource or property.
Tip
You can also use Ref to add values to Output messages.
"Ref" : "logicalName"
The logical name of the resource or parameter you want to dereference.
The value of the MyInputParameter parameter.
The following resource declaration for an Elastic IP address needs the instance ID of an EC2 instance and
uses the Ref function to specify the instance ID of the MyEC2Instance resource:
"MyEIP" : {
"Type" : "AWS::EC2::EIP",
"Properties" : {
"InstanceId" : { "Ref" : "MyEC2Instance" }
}
} This section lists sample values returned by Ref for particular AWS CloudFormation resources. For
more information about Ref return values for a particular resource or property, refer to
the documentation for that resource or property.
| Resource Type | Reference Value | Example |
|---|---|---|
|
Name |
mystack-myasgroup-NT5EUXTNTXXD | |
|
Name |
mystack-mylaunchconfig-1DDYF1E3B3I | |
|
Name |
mystack-myaspolicy-1DDYF1E3B3I | |
|
Name |
mystack-mytrigger-7GQPDS5YHI5B | |
|
Stack ID |
arn:aws:cloudformation:us-east-1:803981987763:stack/mystack-myembeddedstack-sggfrhxhum7w/f449b250-b969-11e0-a185-5081d0136786 | |
|
Name |
arn:aws:cloudformation:us-east-1:803981987763:stack/mystack/c325e210-bdf2-11e0-9638-50690880c386/mywaithandle | |
|
Wait Condition Signal URL |
https://cloudformation-waitcondition-us-east-1.s3.amazonaws.com/arn%3Aaws%3Acloudformation%3Aus-east-1%3A803981987763%3Astack%2Fwaittest%2F054a33d0-bdee-11e0-8816-5081c490a786%2FmyWaitHandle?Expires=1312475488&AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE&Signature=tUsrW3WvWVT46K69zMmgbEkwVGo%3D | |
|
Distribution ID |
E27LVI50CSW06W | |
|
Name |
mystack-myalarm-3AOHFRGOXR5T | |
|
Volume ID |
vol-3cdd3f56 | |
|
Name |
mystack-myvola-ERXHJITXMRLT | |
|
Elastic IP Address |
192.0.2.0 | |
|
Name |
mystack-myeipa-1NU3IL8LJ313N | |
|
Instance ID |
i-636be302 | |
|
Name |
mystack-mysecuritygroup-QQB406M8FISX | |
|
Name |
mysecuritygroupingress | |
|
Name |
mystack-myelb-1WQN7BJGDB5YQ | |
|
Name |
mystack-myapplication-FM6BIXY7U8PK | |
|
Name |
mystack-myenv-LKGNQSFHO1DB | |
|
AccessKeyId |
AKIAIOSFODNN7EXAMPLE | |
|
GroupName |
mystack-mygroup-1DZETITOWEKVO | |
|
UserName |
mystack-myuser-1CCXAFG2H2U4D | |
|
Name |
mystack-mydb-ea5ugmfvuaxg | |
|
Name |
mystack-mydbsecuritygroup-1k5u5dxjb0nxs | |
|
Name |
mystack-mys3bucket-1hbsmonr9mytq | |
|
Name |
mystack-mysdbdomain-IVNAOZTDFVXL | |
|
Topic ARN |
arn:aws:sns:us-east-1:803981987763:mystack-mytopic-NZJ5JSMVGFIE | |
|
Queue URL |
https://sqs.us-east-1.amazonaws.com/803981987763/aa4-MyQueue-Z5NOSZO2PZE9 | |
|
AWS::Region |
us-east-1 | |
|
AWS::StackName |
MyStack |