Networks in AWS
I enjoy networking. I was introduced to it by lecturer, Mr. Fredrick Ogore, in my 2nd year at the university. He made the subject enjoyable with his calm, collected teaching style. I was excited to find similar networking concepts in AWS. It was familiar and it made it fun to learn!
I’m excited to write this guide— it is an introduction to a 9 part series where you and I will dive into networking concepts in the Amazon Cloud environment. Today, we’ll start by building a Virtual Private Cloud (VPC). Along the way, I’ll break down new terms and provide clear explanations to help you understand the concepts easily.
Let’s dive in!
Building a VPC
The above diagram will guide us on what we’ll be building. Starting from the outermost part, we have the region, followed by our VPC, the public subnet, and finally the internet gateway. In this guide, we’ll go through the key steps to set up our virtual cloud environment, which includes:
a) VPC
b) Public Subnet
c) Internet Gateway
a) VPC
A VPC ( Virtual Private cloud) is a virtual network dedicated to your AWS account. It is logically isolated from other virtual networks in the AWS Cloud. To bring this definition home we can think of a VPC as a city within a country, where the country is a region — (a region is a distinct geographical area designed to house AWS resources and infrastructure.) Inside our VPC we can create neighborhoods (Subnets), traffic rules, and security measures to control how the different resources inside your VPC, like EC2 instances and S3 buckets, are connected and work together. With these definitions in mind we can proceed.
Steps to Set Up a VPC
- Log in to the AWS Management Console: Search for VPC.
2. Switch to the Region Closest to You: This reduces latency.
3. Choose Your VPC: On the left navigation panel, select Your VPCs. You’ll see a default VPC that AWS creates to help beginners quickly set up environments.
4. Create a VPC: Click the Create VPC button on the top right, and select VPC only.
5. Name Tag: Input a name for your VPC (e.g., evan-vpc).
6. IPv4 CIDR: Enter the following CIDR block: 10.0.0.0/16
What’s an IPv4 CIDR Block?
We can break this into two parts then join them once we understand what they mean.
— IPv4 stands for Internet Protocol version 4, which is the most common way to write an IP address. It acts like a “home address” for devices on a network.
— CIDR (Classless Inter-Domain Routing) allows flexible grouping of IP addresses, helping manage networks more efficiently. AWS uses private IP ranges based on the RFC 1918 standard:
— 10.0.0.0/8 (16,777,216 IP addresses)
— 172.16.0.0/12 (1,048,576 IP addresses)
— 192.168.0.0/16(65,536 IP addresses)
I know it sounds like a complex and foreign, but trust me with a little practice you’ll be able to grasp the concepts of subnetting. Here is are 20min links to videos that have really helped me grasp subnetting and managing cidr blocks. ( One: Two: Three: four).
I believe in your ability to grasp this content my fellow human.💪
7. Select No IPv6 Block: Choose No IPv6 for simplicity.
8. Create VPC: Click Create VPC.
Now that was Exciting ! You can jump up and down before we continue…I’ll wait hehe😁
b) Public Subnet
A subnet is like a subdivision within your VPC. We’ll create a subnet in the 10.0.0.0/16 network. Cool stuff right ?
- Search for Subnet: Go to your VPC Dashboard under Virtual Private Cloud and select Subnets. You’ll see some subnets already created. Do you know why this is ? — the default VPC comes with predefined subnets in each Availability Zone (AZ). (An Availability Zone is a separate data center in a specific region, each with independent power, cooling, and networking for high availability). These default subnets are ready to use, helping you to quickly launch resources and test services without needing to create subnets manually.
2. Create Subnet: Click on Create Subnet
— Subnet Name: Input public 1 as the name.
— Availability Zone: Select the first Availability Zone from the dropdown list.
— IPv4 VPC CIDR Block: Select the CIDR block we created earlier (10.0.0.0/16).
— IPv4 Subnet CIDR Block: Enter 10.0.0.0/24.
By choosing /24, we’re creating a smaller subnet with fewer IP addresses (256), which fits neatly into our larger /16 block (65,536 IP addresses). This gives us control over how we allocate resources within the VPC.
3. Edit Subnet Settings: On the top right, click the Actions dropdown and select Edit Subnet Settings.
4.Enable auto-assign public IPv4 address: Check the box for Enable auto-assign public IPv4 address.
(This ensures that any EC2 instance launched in this subnet automatically receives a public IP, making it accessible from the internet without needing to manually assign a public IP — saving time!)
5. Save: Click Save to apply the changes.
And just like that we have lift off for our public subnet.
N/B — The name Public subnet is a variable name that doesn’t offer access or communication outside the subnet. For this we have to create and attach an internet gateway.
— Today’s break or when you read this, I am giving tribute to James Earl Jones his voice made my kid self believe Lion’s could talk. Have a great ride “King Mufasa”.
c) Internet Gateway
Steps to Create an Internet Gateway (IGW)
1. Search for Internet Gateway:
— In the left navigation pane, select Internet Gateways.
— You might see an existing Internet Gateway associated with the default VPC. This default IGW allows for immediate internet connectivity, making it easy for beginners to launch instances without manual configuration.
2. Create Internet Gateway: Click Create Internet Gateway.
3. Configure Your Internet Gateway: Name tag — Input a name for the IGW (e.g., Mwami igw).
Next, we’ll attach this Internet Gateway to the VPC.
4. Create Internet Gateway: After configuring the name tag, click Create Internet Gateway.
5. Attach Internet Gateway to VPC: Select your newly created Internet Gateway, click Actions, and choose Attach to VPC.
— Select your VPC from the list and attach the Internet Gateway to it.
This step connects your VPC to the internet, allowing your resources (like EC2 instances) to communicate with the outside world.
6. Attach to Evan VPC: From the dropdown, select evan-vpc (your VPC).Click Attach Internet Gateway to complete the process.
Now, your VPC is connected to the internet via the Internet Gateway, allowing resources within the VPC to communicate with the outside world.
And that, my friends, is how to build your very own VPC in AWS! From setting up the VPC, creating a public subnet, and configuring an Internet Gateway, you’ve now established a fully functional cloud network. This VPC forms the foundation for deploying secure and scalable applications on AWS, giving you control over network settings, traffic rules, and internet access.
I hope this guide has been as enjoyable for you to follow as it was for me to write. With these fundamentals, you’re well on your way to mastering AWS networking.
Happy building, and thank you for reading! See you next week.
Oooh I almost forgot — you can check out Draw.io… I used the web platform to draw the first image.
Enjoy your weekend!