Enhance your AWS knowledge with these AWS CloudFormation MCQ questions and answers. This set focuses on basic CloudFormation concepts, including templates, resources, properties, and template structures in YAML/JSON. You’ll also explore parameters, mappings, and outputs. Perfect for mastering AWS CloudFormation’s infrastructure as code capabilities.
MCQs
AWS CloudFormation Templates
What is an AWS CloudFormation template? a) A script for managing EC2 instances b) A JSON or YAML file that describes AWS resources and configurations c) A Python library for automation d) A deployment tool for third-party applications
What is the maximum size for a single CloudFormation template? a) 512 KB b) 1 MB c) 2 MB d) 5 MB
In CloudFormation, which attribute is mandatory in every template? a) Parameters b) Resources c) Outputs d) Mappings
Which file formats are supported for AWS CloudFormation templates? a) XML and CSV b) YAML and JSON c) HTML and TXT d) SQL and Markdown
What does the “AWSTemplateFormatVersion” field define in a template? a) The CloudFormation service version b) The format version of the template file c) The API version for Lambda functions d) The operating system version
Resources and Properties
What is a “Resource” in a CloudFormation template? a) A mapping of parameters to outputs b) An AWS service or component that you define in the template c) A backup file for CloudFormation stacks d) A default configuration for AWS services
Which of the following is an example of a CloudFormation resource type? a) AWS::EC2::Instance b) EC2::AWS::Instance c) S3::Bucket::AWS d) Instance::EC2::AWS
How are properties defined within a resource in a CloudFormation template? a) As key-value pairs under the “Parameters” section b) Inside the “Properties” section of the resource c) Through the “Mappings” section d) Using external scripts
Which attribute is used to specify dependencies between resources? a) DependsOn b) Dependencies c) RequiredBy d) LinkedResources
How can you dynamically create resource names in a CloudFormation template? a) Using the Ref function b) Through static strings c) By applying the Join function d) Using the Fn::Sub intrinsic function
Template Structure (YAML/JSON)
What symbol is used to denote comments in a YAML-formatted CloudFormation template? a) // b) # c) <!– –> d) **
Which section in a CloudFormation template contains optional metadata about the stack? a) Description b) Metadata c) Resources d) Outputs
How do you declare a resource in a JSON CloudFormation template? a) As an array within the “Resources” key b) As an object under the “Resources” key c) Using the “Mappings” section d) Inside a string under the “Outputs” section
Which YAML syntax is used to define an intrinsic function? a) !!Intrinsic:: b) Fn::FunctionName c) !FunctionName d) $Intrinsic::
What is the purpose of the “Transform” section in a CloudFormation template? a) To map outputs to resources b) To include additional AWS service-specific macros c) To create JSON-to-YAML conversions d) To validate stack permissions
Parameters, Mappings, and Outputs
What is the purpose of “Parameters” in a CloudFormation template? a) To define custom values passed into the template at runtime b) To store data generated by the stack c) To represent the logical relationships between resources d) To map CloudFormation templates to IAM roles
Which intrinsic function is used to reference a parameter value? a) Fn::GetAtt b) Ref c) Fn::Sub d) Fn::Join
What does the “Mappings” section in a CloudFormation template provide? a) A way to organize the structure of resources b) A lookup table for static values based on keys c) Dynamic inputs for stack creation d) A summary of outputs
Which intrinsic function retrieves values from the “Mappings” section? a) Ref b) Fn::GetAtt c) Fn::FindInMap d) Fn::Select
What is a primary use of the “Outputs” section in a CloudFormation template? a) To generate errors for invalid parameters b) To return information about resources created by the stack c) To automate stack deletion d) To deploy external applications
Which attribute is used in the Outputs section to make a value accessible to another stack? a) Export b) Share c) Distribute d) Link
How are conditions defined in a CloudFormation template? a) Using If-Else blocks in the “Resources” section b) Through the “Conditions” section with logical functions c) Inside the “Outputs” section using intrinsic functions d) Directly in the “Parameters” section
Which function is used to combine multiple strings in CloudFormation? a) Fn::Join b) Fn::Concat c) Fn::Merge d) Fn::Combine
What is the purpose of the “Description” section in a CloudFormation template? a) To describe the logical relationships between resources b) To add metadata about the template c) To explain the template’s purpose and details d) To include inline comments
Which section is mandatory in every CloudFormation template? a) Outputs b) Mappings c) Resources d) Parameters
Answer Key
Qno
Answer
1
b) A JSON or YAML file that describes AWS resources and configurations
2
c) 2 MB
3
b) Resources
4
b) YAML and JSON
5
b) The format version of the template file
6
b) An AWS service or component that you define in the template
7
a) AWS::EC2::Instance
8
b) Inside the “Properties” section of the resource
9
a) DependsOn
10
d) Using the Fn::Sub intrinsic function
11
b) #
12
b) Metadata
13
b) As an object under the “Resources” key
14
c) !FunctionName
15
b) To include additional AWS service-specific macros
16
a) To define custom values passed into the template at runtime
17
b) Ref
18
b) A lookup table for static values based on keys
19
c) Fn::FindInMap
20
b) To return information about resources created by the stack
21
a) Export
22
b) Through the “Conditions” section with logical functions