Creating a VPC and subnet from the CLI
AWS CLI is a command-line interface that facilitates managing AWS resources from the command line. Until now we have learnt recipes for creating AWS networking components from the console. In this recipe we'll learn how to create them through the CLI. This will help you understand how scripts can be written to automate the management of network components.
Getting ready
You will need to configure the CLI in your system from which you are going to execute the commands.
How to do it...
Follow the steps provided to create AWS VPC and subnet from CLI.
- Open your command prompt and give the command:
aws ec2 create-vpc --profile user2 --region us-east-1 --cidr-block 10.0.0.0/16 --amazon-provided-ipv6-cidr-block
The different components of our command are explained as follows:
aws ec2 create-vpc
: It is the command for creating a VPC profile.user2
: It is the user profile with which a VPC is being created. You may omit this if you want to create the VPC with a default...