You are writing an AWS CloudFormation template, and you want to assign values to properties that will not be available until runtime.
You know that you can use intrinsic functions to do this but are unsure which part of the template they can use.
Which of the following is correct in describing how you can currently use intrinsic functions in an AWS CloudFormation template?
Click on the arrows to vote for the correct answer
A. B. C. D.Answer - B.
As per AWS documentation:
You can use intrinsic functions only in specific parts of a template.
Currently, you can use intrinsic functions in resource properties, outputs, metadata attributes, and update policy attributes.
You can also use intrinsic functions to create stack resources conditionally.
Hence, B is the correct answer.
For more information on intrinsic function, please refer to the below link.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.htmlIntrinsic functions can be used in an AWS CloudFormation template to assign values to resource properties, outputs, metadata attributes, and update policy attributes that are not available until runtime. These functions allow you to dynamically set property values in your template based on conditions that may not be known at the time of template authoring.
The answer to the question is B. You can use intrinsic functions only in specific parts of a template. Specifically, intrinsic functions can be used in resource properties, outputs, metadata attributes, and update policy attributes.
Intrinsic functions are denoted by special syntax, which starts with a double curly brace "{{" and ends with a double curly brace "}}". The function name is enclosed within the curly braces, along with any arguments that the function may require.
Here are some examples of intrinsic functions and their usage:
Example:
yamlMetadata: AWS::CloudFormation::Init: config: commands: 01_hello: command: !Sub echo "Hello ${UserName}!"
Example:
vbnetResources: MyBucket: Type: "AWS::S3::Bucket" Properties: BucketName: !Join ["-", ["my", "bucket", "name"]]
Example:
yamlResources: MyInstance: Type: "AWS::EC2::Instance" Properties: UserData: Fn::Base64: !Sub | #!/bin/bash export MY_DB_HOST=$(Fn::ImportValue "MyDBInstanceEndpoint") # rest of the script
In conclusion, intrinsic functions are a powerful tool in AWS CloudFormation templates that allow you to dynamically set property values based on runtime conditions. They can be used in resource properties, outputs, metadata attributes, and update policy attributes. The correct answer to the question is B.