Creating a Virtual Private Cloud (VPC) with AWS CloudFormation
AWS CloudFormation is a way to deploy your infrastructure resources and applications on AWS in a reliable, repeatable manner using a called template.
Because the template used by CloudFormation acts as documentation to show exactly what is being deployed.
Create an Amazon Virtual Private Cloud (VPC) using AWS CloudFormation.
Update the VPC adding two new subnets.
- Deploy an AWS CloudFormation template that creates an Amazon VPC
- Examine the components of the template
- Update a CloudFormation stack
- Examine a template with the AWS CloudFormation Designer
- Delete a CloudFormation stack
In the AWS Management Console, on the Services menu, click CloudFormation.
Click Create Stack.
Select Upload a template to Amazon S3.
Click Choose File or Browse to select the vpc.yaml located on the
v1
directory, then click Next.At the Specify Details page, do the following:
- Stack name:
- Click Next >
The Options page allows you to specify tags, permissions and advanced options. You will use the default values.
Click Next.
Review the configuration on the Review page, then click Create.
On the Services menu, click VPC.
In Filter by VPC in the top-left corner, select Lab VPC.
In the left navigation pane, click Your VPCs.
Select Lab VPC.
- In the left navigation pane, click Internet Gateways.
- In the left navigation pane, click Subnets.
In the left navigation pane, click Route Tables.
Select the Public Route Table.
Click the Routes tab in the lower half of the window.
- Click the Subnet Associations tab.
On the Services menu, click CloudFormation.
Select the Lab stack.
Click the Outputs tab.
Once a CloudFormation stack has been deployed, it is recommended that any changes to the resources should be made through CloudFormation rather than by directly modifying the resources.
In the Actions menu, click Update Stack.
Select Upload a template to Amazon S3.
Click Choose File or Browse to select the vpc.yaml template located on the
v2
directory.Click Next.
- Click Next.
- Scroll to the bottom of the screen, then click Next.
- Scroll to the bottom of the screen, then click Update.
It indicates that two new Subnets will be created. In addition, two Route Table Associations will be added, to associate these Subnets with their appropriate Route Tables.
In CloudFormation select the Lab stack.
In the Actions menu, select Delete Stack, then click Yes, Delete.
Click the Events tab to view details of the deletion.
Click Refresh until the stack is deleted.