Networking on AWS — Amazon Virtual Private Cloud (VPC)
Tags: aws, cloud, vpc, network
Published: 2023-03-13 06:29:11

![Amazon VPC](https://cdn-images-1.medium.com/max/2000/1*5Vxl9p0WAGcBEfth-Z0JZg.png)

Hello everyone. I am Budi want to write about networking on AWS. AWS has a networking service — [Amazon VPC](https://aws.amazon.com/vpc). **Amazon VPC** are secure, less time setting network and can manage control in your virtual private cloud. Amazon VPC is integrated with other AWS services like Amazon EC2, Amazon RDS and many more.

Go to Networking & Content Delivery section and click VPC. My VPC journey is beginning. Click **Create VPC**. My VPC is located in North Carolina (us-west-1). One region has a **maximal 5 VPC only**.

![](https://cdn-images-1.medium.com/max/2000/1*ijmirrZZhRgnFw9XvB7-xg.jpeg)

**VPC only** means creating VPC only without creating subnet, internet gateway and route table. While **VPC and more** are created VPC with create subnet, internet gateway and route table by automatic create. Choose to create VPC and more.

![](https://cdn-images-1.medium.com/max/2000/1*geTvUaNmUyeJmT09AI6T1A.jpeg)

About IPv4 CIDR block and IPv6 CIDR block, you can read [this link](https://docs.aws.amazon.com/vpc/latest/userguide/configure-your-vpc.html). **Availability Zones (AZ)** are several zones in one region. For example, North Carolina (us-west-1) has 2 AZ and North Virginia (us-east-1) has 6 AZ. If you curious about AZ, you can read [this link](https://aws.amazon.com/about-aws/global-infrastructure/regions_az).

![](https://cdn-images-1.medium.com/max/2000/1*6T5xmKxKeU_ZtDLd6OPL9g.jpeg)

If you want to create a web application, you can use a **public subnet** for **EC2** and a **private subnet** for **RDS**. You can read about the public subnet and private subnet on [this link](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Scenario2.html).

![](https://cdn-images-1.medium.com/max/2000/1*grKPIaP-nJqcYQTOBxvGfQ.jpeg)

This is VPC visualization for creating VPC and more. VPC are connected to subnet, route table and internet gateway (network connections).

![VPC visualization](https://cdn-images-1.medium.com/max/2540/1*1tzbj52Q4-CEYs48UvAauQ.jpeg)

Then, **NAT gateway** is Network Address Translation service. You can use a NAT gateway so that instances in a private subnet can connect to services outside your VPC, but external services cannot initiate a connection with those instances. You can read about NAT Gateway on [this link](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html).

While **VPC endpoint** is connected to services powered by [**AWS PrivateLink**](https://aws.amazon.com/privatelink), including many AWS services. Click **Create VPC**.

![](https://cdn-images-1.medium.com/max/2000/1*sNxPf8XEnlGSLq8BTkg8xA.jpeg)

![VPC](https://cdn-images-1.medium.com/max/2000/1*RJVu7T3SSqFHzBnmh-zSlA.jpeg)

After clicking View VPC, click the **Subnet** section. The subnet in VPC means the range of IP addresses in VPC. Subnets have three types:

 1. **Public subnet** — can connect to the internet with an internet gateway or egress-only internet gateway.

 2. **Private subnet** — cannot connect to the internet, but if you want can connect to the internet, must have a NAT gateway.

 3. **VPN-only subnet** — needs a Site-to-Site VPN connection with a virtual private gateway. VPN = Virtual Private Network.

Click filter subnets based on VPC values. You can see how to filter subnets based on VPC. You also can create a subnet if you want to add another subnet.

![Subnets](https://cdn-images-1.medium.com/max/2106/1*uFkibE3Udn1qYnD2moBcqg.jpeg)

Click subnet ID budionosan-vpc-subnet-public1-us-west-1a.

![](https://cdn-images-1.medium.com/max/2038/1*GlcK7x-YoKJVcQ1FZ4Q8KQ.jpeg)

The public subnet has 2 routes — local and internet gateway because public subnet need internet gateway for can connect to internet.

![](https://cdn-images-1.medium.com/max/2060/1*3meO9gGoxbuCxf7CGjLWNA.jpeg)

Click subnet ID budionosan-vpc-subnet-private1-us-west-1a.

![](https://cdn-images-1.medium.com/max/2018/1*L2nWp9iNHt1RKeS4w2y91w.jpeg)

The private subnet has one route because private subnet cannot connect internet. Private subnet recommended for databases. But still can connect to internet and need NAT gateway.

![](https://cdn-images-1.medium.com/max/2036/1*SzB4G0BusKkjFl6LVOZAMg.jpeg)

Then click the **Route Tables** section. Route table means to determine where network traffic from the subnet or is directed. For example, one route table has several routes like local target or internet gateway or many more.

Click filter route tables based on VPC values. You also can create route tables if you want to add other route tables.

![Route tables](https://cdn-images-1.medium.com/max/2082/1*O329ec24mI61MWJFSS_F9Q.jpeg)

Then click the **Internet gateway** section. Internet gateway means can connect VPC to internet. Click filter internet gateway based on VPC values. You also can create internet gateway if you want to add other internet gateway.

![](https://cdn-images-1.medium.com/max/2000/1*K1EqkemN1i9hyUS-_hChNw.jpeg)

Then go to the **Security** section. Click **security group**. Security group means controls the traffic that is allowed to reach and leave the resources in VPC. If you want to know about security group, you can read [this link](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html#VPCSecurityGroups).

![](https://cdn-images-1.medium.com/max/2000/1*wOHOx1GBB3FZPfeOF22PtA.jpeg)

Click filter security group based on VPC values. You also can create security group if you want to add another security group. Click security group ID sg-066…

![](https://cdn-images-1.medium.com/max/2044/1*QNryrjNXilLOf9qmQiKNcQ.jpeg)

This security group connected with VPC (name **budionosan-vpc**), has one inbound rule and one outbound rule. Scroll down to see inbound rules and click edit inbound rules.

![](https://cdn-images-1.medium.com/max/2218/1*wbEFocL8JlK-xFc9OTAUBg.jpeg)

![](https://cdn-images-1.medium.com/max/2476/1*HeNXfZsiKKkjdqf7JhYNaA.jpeg)

![](https://cdn-images-1.medium.com/max/2512/1*Fqqs-IYmo2yeRLTVAHiTmg.jpeg)

If you want to add a rule, can click Add rule. Choose a type like All traffic, TCP, UDP, IPv4, IPv6, SSH, DNS, HTTP, HTTPS, MySQL, Redshift, PostgreSQL and many more. Input source address. If done, click save rules. Outbound rules are also the same way as inbound rules.

![](https://cdn-images-1.medium.com/max/2476/1*WA0aaXe_YtLu8y8f1wfbPA.jpeg)

If need security group again, can click create security group for AWS services. Fill in the security group name and description. Choose VPC with click X then choose VPC for this security group.

![](https://cdn-images-1.medium.com/max/2050/1*mxAt3bLpdDOH6SyseSr9fQ.jpeg)

When create security group, inbound rules are not available. But can create inbound rule with click Add rule.

![](https://cdn-images-1.medium.com/max/2376/1*T97LoFzaCAndfQTj3R3row.jpeg)

Choose all traffic and choose source 0.0.0.0/0 and ::/0 but this step is not best practice/recommended. This step is for learning only and can edit again to match needs. For example, Amazon RDS MySQL can choose MySQL/Aurora type and Amazon Redshift can choose Redshift.

![](https://cdn-images-1.medium.com/max/2380/1*azvSeuMose9wBVnoNaSPcA.jpeg)

After setting the security group, click create security group.

![](https://cdn-images-1.medium.com/max/2426/1*PuSuGkRip83DqDMlCwjYOg.jpeg)

![](https://cdn-images-1.medium.com/max/2146/1*DHuBNjo0tmCiDSZXytHvxw.jpeg)

Source/reference you can read about Amazon VPC:

 1. **Amazon VPC** — [https://aws.amazon.com/vpc](https://aws.amazon.com/vpc)

 2. **Amazon VPC docs** — [What is Amazon VPC? — Amazon Virtual Private Cloud](https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html)

Thank you for reading this article :)