Answer – C
The below example shows a simple CloudFormation template. It creates an EC2 instance based on the AMI - ami-d6f32ab5. When the instance is created, it will output the AZ in which it is created.
{
"Resources": {
"MyEC2Instance": {
"Type": "AWS::EC2::Instance",
"Properties": {
"ImageId": "ami-d6f32ab5"
}
}
},
"Outputs": {
"Availability": {
"Description": "The Instance ID",
"Value":
{ "Fn::GetAtt" : [ "MyEC2Instance", "AvailabilityZone" ]}
}
}
}
Option A is incorrect because this is used to define the main resources in the template.
Option B is incorrect because this is used to define parameters that can be taken during template deployment.
Option D is incorrect because this is used to map key-value pairs in a template.
To understand more on CloudFormation, please visit the URL-
https://aws.amazon.com/cloudformation/
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html