How to do it...

Follow the steps provided to create AWS VPC and subnet from CLI.

  1. 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 profile.
    • region us-east-1: It is the AWS region where the VPC is going to be created. You can omit this if you want to create it in the default region.
    • cidr-block 10.0.0.0/16: It is the IPv4 CIDR block associated with the VPC.
    • amazon-provided-ipv6-cidr-block ...

Get AWS Networking Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.