Which code snippet below returns the URL of a load balanced web site created in
CloudFormation with an AWS::ElasticLoadBalancing::LoadBalancer resource name
“ElasticLoad Balancer”?
A.
“Fn::Join” : [“”. [ “http://”, {“Fn::GetAtr” : [ “ElasticLoadBalancer”,”DNSName”]}]]
B.
“Fn::Join” : [“.”, [ “http://”, {“Ref” : “ElasticLoadBalancerDNSName”}]]
C.
“Fn::Join” : [“”. [ “http://”, {“Ref” : “ElasticLoadBalancerUrl”}]]
D.
“Fn::Join” : [“”. [ “http://”, {“Fn::GetAtr” : [ “ElasticLoadBalancer”,”Url”]}]]
A – http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html
A
Answer = A
Additional reading material
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html
Declaration
JSON
{ “Fn::GetAtt” : [ “logicalNameOfResource”, “attributeName” ] }
Example
This example returns a string containing the DNS name of the LoadBalancer with the logical name MyLB.
JSON
“Fn::GetAtt” : [ “MyLB” , “DNSName” ]
Answer is D
Declaration
JSON
{ “Fn::GetAtt” : [ “logicalNameOfResource”, “attributeName” ] }
Because the attribute in question being asked is URL and not DNS Name
It would still be A because there is no attribute for the LoadBalancercalled URL, see the list
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html
A is the answer with following correction in the intrinsic function: GetAtr should be GetAtt.
“Fn::Join” : [“”. [ “http://”, {“Fn::GetAtt” : [ “ElasticLoadBalancer”,”DNSName”]}]]
Answer = A
Additional reading material
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html
Declaration
JSON
{ “Fn::GetAtt” : [ “logicalNameOfResource”, “attributeName” ] }
Example
This example returns a string containing the DNS name of the LoadBalancer with the logical name MyLB.
JSON
“Fn::GetAtt” : [ “MyLB” , “DNSName”