When creating a CloudFormation template that deploys EC2 instances across multiple AWS accounts, the developer must restrict instance types to an approved list. How should the template include this approved list of EC2 instance types?
Choose an answer
Tap an option to check your answer.
Correct answer: Define a single template parameter whose AllowedValues list contains the approved EC2 instance types..
Why this is the answer
The most efficient and maintainable way to restrict EC2 instance types to an approved list in a CloudFormation template is to define a single template parameter with an AllowedValues property. This property accepts a list of strings, which will be your approved instance types. During stack creation or update, CloudFormation validates the provided parameter value against this list, ensuring only approved types are selected. Creating separate templates for each instance type is impractical and leads to significant duplication. Defining resources for every approved type within the Resources section is incorrect; the Resources section defines the actual AWS resources to be created, not a list of allowed input values. Defining a distinct parameter for each approved instance type is also inefficient and overly complex, as it would require a separate parameter for every single allowed option.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed