Hello Techies! ๐
I hope youโre all doing great.
Welcome to my very first blog on DEV! Iโm super excited to begin this journey and share my learnings with all of you. Since many of you might not know me yet, let me start with a quick introduction.
Iโm a tech enthusiast who genuinely enjoys exploring new technologies. In my free time, youโll usually find me experimenting with tools, building small projects, or keeping up with the latest trends in the tech world. Recently, Iโve been diving deep into AWS Infrastructureโespecially Networking and advanced VPC concepts.
I must say, it has been a fascinating learning experience. Through this blog series, Iโll be documenting everything Iโve learned along the way. If you're just getting started with AWS Networking, youโll definitely find this helpful. And for me, writing these posts will be a great motivation to keep learning and improving.
Letโs begin this journey together! ๐
Architecture Overview
We will create:
๐น VPC CIDR:
- 10.10.0.0/16
๐น Public Subnets:
- 10.10.0.0/24 (AZ a)
- 10.10.1.0/24 (AZ b)
๐น Private Subnets:
- 10.10.11.0/24 (AZ a)
- 10.10.12.0/24 (AZ b)
๐น Other Components
- EC2 instance in Public Subnet
- RDS MySQL DB in Private Subnet
- Route tables for public/private traffic
- Internet Gateway
- Security Groups
- Public DNS with Route53
This is what the architecture looks like:
Step 1 โ Create VPC, Subnets & Routing
Go to VPC Console โ Create VPC โ VPC and more.
Configuration
- Name: webapp-vpc
- IPv4 CIDR: 10.10.0.0/16
- Availability Zones: 2
- Public Subnets: 2
- Private Subnets: 2
- NAT Gateway: None
- Endpoints: None
| Subnet | AZ | CIDR |
|---|---|---|
| Public Subnet 1 | a | 10.10.0.0/24 |
| Public Subnet 2 | b | 10.10.1.0/24 |
| Private Subnet 1 | a | 10.10.11.0/24 |
| Private Subnet 2 | b | 10.10.12.0/24 |
What the wizard creates automatically:
โ VPC
โ IGW
โ Public + private route tables
โ Subnets
โ Routing
Step 2 โ Launch an EC2 instance and connect
1. Launch EC2 Instance:
- Navigate to the EC2 Dashboard and launch a new instance.
- Name: Webserver
- AMI: Amazon Linux 2023 (Free Tier)
- Instance Type: t3.micro
- Key Pair: Select your existing key pair or create a new one if unavailable
2. Configure Network & Security:
- VPC & Subnet: Select your webapp-vpc and a public subnet
- Auto-assign Public IP: Enable
3. Security Group:
- Create webapp-ec2-sg allowing SSH (22) and HTTP (80) from all IPs
- Storage: Use default 8 GiB gp3 volume
4.Launch & Connect:
- Launch the instance, copy the Public IPv4 address, and connect via SSH using your key pair.
Step 3 โ Create a RDS Database
1. Create a DB Subnet Group
- Go to RDS Console โ Subnet Groups โ Create DB Subnet Group.
- Configure the subnet group:
- Name: webapp-db-subnet-group
- Description: DB Subnet group
- VPC: webapp-vpc
- Add subnets for high availability:
- AZ a: 10.10.11.0/24
- AZ b: 10.10.12.0/24
- Click Create.
2. Create the RDS Database
Go to Databases โ Create Database โ Standard Create.
Select the following options:
- Engine: MySQL
- Template: Free Tier
- DB Cluster Identifier: webapp-db
- Set master credentials:
- Username: admin
- Password: your chosen password
- VPC: webapp-vpc
- DB Subnet Group: webapp-db-subnet-group
- Public Access: No
- VPC Security Group: Create new โ webapp-db-security-group
- Authentication: Password
- Initial Database Name: corp
Click Create Database and wait until itโs fully provisioned.
3. Update DB Security Group
- Select the newly created database โ Connectivity & Security โ click the VPC Security Group link.
- In the EC2 console, edit inbound rules:
- Source: 10.10.0.0/16 (your VPC CIDR)
- Save the changes.
Step 4 โ Install and configure a webapp on EC2.
Step 6 โ Setup Public DNS for Your Web Application
Once your EC2 instance and web application are ready, the next step is to configure a public DNS so your app can be accessed via a domain name.
1.Create a DNS Record in Route53
Prerequisite: Ensure you have a public domain name and a Route 53 Public Hosted Zone already created.
Go to the Route 53 Console โ Hosted Zones โ click on your domain name.
Click Create Record and configure the following:
Record Name: leave blank (to map the root domain)
Record Type: A โ Routes traffic to an IPv4 address or AWS resource
Value: Enter the public IP of your EC2 instance
Click Create Records to save the changes.
2. Verify the DNS
Open a browser and access your web application using:
http://YOUR_DOMAIN_NAME/corp.php
โ Your web application is now publicly accessible via your custom domain name.
Thank you! ๐โจ
Top comments (0)