- Log in to the AWS Management Console as the Admin user.
- Search for VPC in the Services bar and open the VPC console.
- In the navigation pane, under Virtual private cloud, select Your VPCs.
- Click Create VPC.
- Configure the following:
- Name tag:
app-vpc - IPv4 CIDR block:
10.1.0.0/16
- Name tag:
- Click Create VPC.
- Navigate to Internet gateways.
- Click Create internet gateway.
- Set the Name tag to
app-igw, then click Create internet gateway. - After creation, choose Actions > Attach to VPC.
- Select
app-vpcand click Attach internet gateway.
Create four subnets — two public and two private:
- Go to Subnets and click Create subnet.
- Choose
app-vpcas the VPC ID.
- Name:
Public Subnet 1 - AZ:
us-west-2a(example) - CIDR:
10.1.1.0/24
- Name:
Public Subnet 2 - AZ:
us-west-2b - CIDR:
10.1.2.0/24
- Name:
Private Subnet 1 - AZ:
us-west-2a - CIDR:
10.1.3.0/24
- Name:
Private Subnet 2 - AZ:
us-west-2b - CIDR:
10.1.4.0/24
- Click Create subnet once all four are added.
- Select
Public Subnet 1. - Go to Actions > Edit subnet settings.
- Enable Auto-assign public IPv4 address.
- Click Save.
- Repeat the same steps for
Public Subnet 2.
- Navigate to Route tables > Create route table.
- Set:
- Name:
app-routetable-public - VPC:
app-vpc
- Name:
- Click Create route table.
- Select
app-routetable-public. - Under the Routes tab, click Edit routes > Add route.
- Destination:
0.0.0.0/0 - Target: Internet Gateway →
app-igw
- Destination:
- Click Save changes.
- Go to the Subnet associations tab.
- Click Edit subnet associations.
- Select:
Public Subnet 1Public Subnet 2
- Click Save associations.
- Go back to Route tables and click Create route table.
- Set:
- Name:
app-routetable-private - VPC:
app-vpc
- Name:
- Click Create route table.
- Select
app-routetable-private. - Go to Subnet associations > Edit subnet associations.
- Select:
Private Subnet 1Private Subnet 2
- Click Save associations.
You have successfully:
- Created a custom VPC:
app-vpc - Added and attached an Internet Gateway:
app-igw - Created:
- 2 Public Subnets
- 2 Private Subnets
- Enabled auto-assign public IP for public subnets
- Created and associated:
- Public Route Table with Internet Access
- Private Route Table with no external route (yet)