AWS Certified Developer – Associate (DVA-C02) — Question 7

A developer is creating an AWS CloudFormation template to deploy Amazon EC2 instances across multiple AWS accounts. The developer must choose the EC2 instances from a list of approved instance types.
How can the developer incorporate the list of approved instance types in the CloudFormation template?

Answer options

Correct answer: D

Explanation

The correct answer is D because creating a parameter with AllowedValues allows the developer to restrict the EC2 instance types to the approved list, ensuring only valid options are used. Option A is incorrect as it would lead to unnecessary duplication of templates. Option B does not allow for flexibility in choosing instance types at deployment time, and option C would require a separate parameter for each instance type, which is not efficient.