ANS-C01 Question 313
Single answerYou are tasked with setting up a highly available VPC with two public subnets and two private subnets across two Availability Zones. Additionally, you need to automate the creation of VPC components such as route tables, subnets, and NAT Gateways. Which approach would best achieve this objective?
- A
Manually create all VPC components using the AWS Management Console.
- B
Write an AWS CloudFormation template to define and deploy the VPC, subnets, route tables, and NAT Gateways.
- C
Use the AWS CLI to create the VPC and other components individually during a live session.
- D
Set up the VPC using AWS Elastic Beanstalk to automatically provision the network infrastructure.
Show answer and explanation
Correct answer: B
Explanation
AWS CloudFormation is a service that allows you to define your AWS infrastructure as code in a declarative JSON or YAML template. By creating a CloudFormation template for your VPC, you can automate the creation and configuration of all network components such as subnets, route tables, and NAT Gateways. This approach ensures consistency, scalability, and repeatability, which is critical for automating and configuring network infrastructure.
- A. Incorrect.
Manually creating all VPC components using the AWS Management Console is time-consuming and error-prone. It does not align with the goal of automating network infrastructure.
- B. Correct.
Writing an AWS CloudFormation template allows you to define infrastructure as code, enabling repeatable, automated, and scalable provisioning of network resources. This is the most efficient and reliable approach for this task.
- C. Incorrect.
Using the AWS CLI to create the VPC and components individually during a live session is not automated and does not provide a repeatable infrastructure setup.
- D. Incorrect.
AWS Elastic Beanstalk is primarily designed for deploying applications, not for provisioning network infrastructure. It does not meet the requirements for this task.