How To Create A Custom VPC Using AWS CLI

How To Create A Custom VPC Using AWS CLI

How to create a custom VPC using AWS CLI

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have discussed how to configure AWS CLI.

In this blog post, we will discuss how to create a custom VPC using AWS CLI. We will create one VPC, one subnet, one internet gateway, one security group and one route table.

Prerequisite for this demo:

  • One Linux instance with AWS CLI installed and configured.

How to create a custom VPC using AWS CLI:

Step 1: Configure AWS CLI.

Step 2: Create a VPC.

Step 3: Modify your custom VPC and enable DNS hostname.

Step 4: Create a subnet.

Step 5: Enable Auto-assign Public IP on the subnet.

Step 6: Create an Internet Gateway.

Step 7: Attach the Internet gateway to your VPC.

Step 8: Create a custom route table.

Step 9: Create a route to Internet Gateway in your custom route table.

Step 10: Associate the subnet with route table, making it a public subnet.

Step 11: Create a custom security group.

Step 12: Get security group ID’s.

Step 13: Create ingress rules for your custom security group.

Step 14: Add tags to the resources in your VPC.

Cleanup (Do not delete, if you want to continue with next demo):

Hope you have enjoyed this article. In the next blog post, we will create an EC2 instance in our VPC.

To get more details on AWS CLI, please refer below AWS documentation


Leave a Reply

Close Menu