Let’s Create a 3 tier Architecture
3 Tier Architecture is used in the client-server to display the front-end(presentation), back-end (Business), and the Database (Storage). This is created in Amazon AWS.
Step One: Create your VPC
Login to AWS console, type in VPC at the top search bar and Create VPC
Select VPC only as we will create the subnets in the next step. Give your VPC a name and your IPv4 CIDR should be 10.0.0.0/16
Click Create VPC
Step 2: Create Subnets
Select the VPC you just created in the previous step.
I will be creating a total of 6 subnets. 2 Public and 4 private. Make sure you give them a distinct name in order to recognize them. After creating all 6 hit Create subnet
Step 3: Create an Internet Gateway
Name it and hit Create internet gateway
See popup for Attach to VPC, select your VPC, and attach
Next comes the fun part!!! Routing Tables!!!
Of course, we will be creating 3 different route tables for each Tier so let’s get started!!!
Name your Route tables and Create
As you can see I have 1 public and 2 private route tables.
For your private tables, you must create a NAT gateway first
After creating this NAT gateway return to the routing table and edit the route for your 2 private route tables.
Step 4: EC2 instances for Presentation Tier
From the EC2 instance page scroll to the bottom and hit Create Launch template
- Name your template
- Check provide auto-scaling guidance
- Choose AMI
- For instance type choose t2.micro
- Create new security group
- Enable Cloudwatch
- insert bootstrapping script
Create Launch template
On this same page click create Auto-scaling group
Step 2 Instance Options select your VPC created earlier and your 2 public subnets
Configure Group size
desired Capacity=2, minimum =2, and Max =3, Click Next
Target Tracking Policy= value of 80 and Instances need 60 seconds warm-up
Repeat the same steps to create another Auto-scaling group for the Private subnets (Application Tier)
Step 5: RDS Database tier creation
Type RDS in your Amazon Console, select subnet groups
Name your subnet, give a description and choose your VPC from earlier
Select your availability zones that you made the private subnets in and then select your subnets from the list, Hit Create
Next select databases on the left-hand side then create database
For this project, I will be using a MySQL engine type.
Under settings create a master username and password
Choose your VPC, make sure your private subnet is inserted and create a new Security group. Name it what you like and hit create database
Connect your app tier to your database tier by clicking the link under the VPC security group, inbound rules tab, and deleting the current one there as it is not correct
You have just created a 3 tier Architecture
Let's connect to the EC2 instance and make sure the public can access our private
ping <private IP address>