Install AWS-CLI
https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html
1. Create a VPC
aws ec2 create-vpc --cidr-block 172.16.0.0/16
2. Create three subnets
Subnet LB 172.16.0.0/24
Subnet A 172.16.1.0/24
Subnet B 172.16.2.0/24
nasohi@DESKTOP-EQC1K12:~$ aws ec2 create-subnet --vpc-id vpc-007283a0796292c04 --cidr-block 172.16.0.0/24
nasohi@DESKTOP-EQC1K12:~$ aws ec2 create-subnet --vpc-id vpc-007283a0796292c04 --cidr-block 172.16.1.0/24
nasohi@DESKTOP-EQC1K12:~$ aws ec2 create-subnet --vpc-id vpc-007283a0796292c04 --cidr-block 172.16.2.0/24
3. Create an internet gateway
nasohi@DESKTOP-EQC1K12:~$ aws ec2 create-internet-gateway
4. Attach the Internet gateway to your VPC
5. Create a custom route table for your VPC
6. Create a route in the routing table that points all traffic (0.0.0.0/0) to the Internet gateway
7. Associate the routing table with a subnet in the VPC.
Follow a complete guide from AWS https://docs.aws.amazon.com/vpc/latest/userguide/vpc-subnets-commands-example.html
Comments
Post a Comment