To create an Amazon VPC using AWS CLI, you need to first configure AWS (assuming you already have AWS CLI installed)
To configure simply use the following command:-
C:\Users\priyj_kumar>aws configure
AWS Access Key ID [****************PO6Y]:
AWS Secret Access Key [****************P6Vo]:
Default region name [us-east-1]:
Default output format [None]:
Now your account is configured. To create a VPC (blank) use the following command:-
C:\Users\priyj_kumar>aws ec2 create-vpc --cidr-block 10.0.0.0/16
This will result in the Output giving you the necessary details about your VPC.
{
"Vpc": {
"CidrBlock": "10.0.0.0/16",
"DhcpOptionsId": "dopt-d6bc32ad",
"State": "pending",
"VpcId": "vpc-0a1a117b2e6c8e09b",
"InstanceTenancy": "default",
"Ipv6CidrBlockAssociationSet": [],
"CidrBlockAssociationSet": [
{
"AssociationId": "vpc-cidr-assoc-044572a6755a02354",
"CidrBlock": "10.0.0.0/16",
"CidrBlockState": {
"State": "associated"
}
}
],
"IsDefault": false,
"Tags": []
}
}
This way you can create an Amazon VPC.