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?
Show Answer & Explanation
Correct Answer: D. In the CloudFormation template, create a parameter with the list of EC2 instance types as AllowedValues.
CloudFormation parameters support the AllowedValues property, which constrains the parameter values to a predefined list. By creating a parameter for the instance type and specifying AllowedValues with the list of approved instance types, users can only select from approved options. This is the standard and most efficient approach. Creating separate templates or resources for each type (Options A and B) is highly inefficient and hard to maintain. Creating separate parameters for each type (Option C) doesn't enforce selection from a predefined list.