VPC (Virtual Private Cloud) is one of the most important services of AWS. You can create a redundant network on VPC.
As you might guess, you can create a public network and a private network on AWS. I’ll walk you through the steps of creating a redundant public network and private network.
First of all, please have a look at the VPC pricing page in order to not be shocked when you get your bill.
Let’s get started!
Open the VPC dashboard. Click the Create VPC button.
Your network will be created once you click the Create button. Cool, the network appears on the VPC list page.
Open the Subnets page. Click the Create subnet button.
I’ve created the Public A Network (10.0.0.0/27) in eu-central-1a
I’ve created the Public B Network (10.0.0.32/27) in eu-central-1b
I’ve created the Private A Network (10.0.0.64/27) in eu-central-1a
I’ve created the Private B Network (10.0.0.96/27) in eu-central-1b
If you want you can create more subnets on this network. 2 Public networks and 2 Private Networks are enough for this blog post.
As you can see, one of the public networks is in eu-central-1a and another one is in eu-central-1b. Likewise for the private networks.
Well, actually they are neither public network nor private network. Their name is public/private. It doesn’t make them public or private network.
Open the Internet Gateways. Click the Create internet gateway button.
Your Internet gateway will be created once you click the Create button. Cool, your Internet gateway appears on the list. Find your Internet gateway and click right then click Attach to VPC.
It must be like this:
The Internet gateway has been created.
The next step is NAT Gateway.
Open the NAT Gateway. Click the Create NAT Gateway button.
Choose the Subnet ID of the Public A Network. The subnet ID is subnet-0614b458595d8f39a in this blog post. If you don’t have an Elastic IP then click the Create New EIP button.
If you don’t choose the Public A Network then your Private subnet can’t access Internet. If you want a private network that doesn’t need to access Internet then choose the Private A Network.
Your NAT Gateway will be created in a just minute.
Do the same for other private subnets.
By default, the name is blank. I’ve written “medium-blog-nat-gateway”.
Open the Route Tables. You will see a row. Its name column is blank too.
If you don’t see it, no worries. Just click Create route table button. Find your VPC and write “medium-blog-public-route-table”.
If you see the row then write “medium-blog-public-route-table” to its name column. Select the row and select the Routes tab.
Click the Edit Routes button.
The destination is 0.0.0.0/0 and Target is your Internet Gateway.
Create another Route Table and write “medium-blog-private-route-table” to its name. Its destination 0.0.0.0/0 and its target is your NAT Gateway.
Open the medium-blog-public-route-table and click Subnet Associations, click Edit subnet associations button.
Choose the Public Subnets
Do the same for Private Subnets.