AWS VPC Commands

VPC and networking commands

VPCs

aws ec2 describe-vpcs # list all VPCs
aws ec2 create-vpc --cidr-block 10.0.0.0/16 # create VPC
aws ec2 delete-vpc --vpc-id vpc-xxx # delete VPC

Subnets

aws ec2 describe-subnets # list all subnets
aws ec2 create-subnet --vpc-id vpc-xxx --cidr-block 10.0.1.0/24 # create subnet
aws ec2 delete-subnet --subnet-id subnet-xxx # delete subnet

Internet Gateways

aws ec2 describe-internet-gateways # list internet gateways
aws ec2 create-internet-gateway # create internet gateway
aws ec2 attach-internet-gateway --vpc-id vpc-xxx --internet-gateway-id igw-xxx # attach to VPC

Route Tables

aws ec2 describe-route-tables # list route tables
aws ec2 create-route --route-table-id rtb-xxx --destination-cidr-block 0.0.0.0/0 --gateway-id igw-xxx # add route