What is the recommended way to use AWS CloudFormation to meet this requirement?
Use parameters to provision the resources.
Use nested stacks to provision the resources.
Use Amazon EC2 user data to provision the resources.
Use stack policies to provision the resources.
Explanations:
Using parameters allows the administrator to create a reusable CloudFormation template that can be customized for different environments by passing values for the parameters when launching the stack. This enables safe and repeatable deployments.
Nested stacks are used to break down complex templates into smaller, reusable templates. While useful for organizing large infrastructures, they are not primarily designed to customize or vary resources across multiple environments in a straightforward way.
Amazon EC2 user data is used to configure EC2 instances at launch, not to manage the provisioning of infrastructure resources. It doesn’t help with creating a reusable template for infrastructure as code.
Stack policies are used to control which resources can be updated during stack updates, not for the provisioning or customization of resources for different environments. They don’t fulfill the requirement of creating a reusable infrastructure template.