Setting up a Three-Tier Architecture on AWS


Hello, and welcome to another exciting episode of Continuous Improvement! I’m your host, Victor, and today we’re going to dive deep into the world of Virtual Private Cloud (VPC) services on Amazon Web Services (AWS).

In this episode, we’ll explore how to set up a three-tier architecture using VPC services. So, grab a cup of coffee and get ready to learn!

Now, before we jump into the technicalities, let’s take a look at the architecture diagram. We have three layers: the presentation layer, the logic layer, and the data layer.

The presentation layer allows users to access the public subnet directly through the gateway. Then we have the logic layer, which handles all the business logic. This layer is located in a private subnet behind a load balancer. And finally, we have the data layer, which consists of a MySQL database in a private subnet.

To ensure high availability, we have deployed our architecture across two Availability Zones. Additionally, our database is backed up to the other zone, guaranteeing operational continuity in case of an Availability Zone failure.

Now that we have an overview of the architecture, let’s dive into the setup process.

First, we’ll create a VPC network named ‘victorleungtwdemo.’ We’ll allocate the CIDR block ‘172.17.0.0/16’ to provide room for future expansion.

Moving forward, we’ll create six subnets, each associated with a specific Availability Zone. This setup allows us to distribute our resources across multiple zones, enhancing scalability and resilience.

Now, let’s talk about routing. We’ll create three separate routing tables: ‘pub-route’ for the public network, ‘priv-route’ for the private network, and ‘nat-route’ for the database subnet.

The ‘pub-route’ table will have a route ‘0.0.0.0/0’ directed towards our Internet Gateway, granting access to the public internet for all machines in the associated subnets.

As for security, we’ll create separate security groups for our bastion host, load balancer, web servers, and database. This way, we can ensure proper access controls and protect our infrastructure.

Once the networking and security aspects are in place, we’ll launch the relevant EC2 instances and set up an RDS server with the appropriate VPC and security group.

To provide load balancing capabilities, we’ll create a target group for the web servers and set up an application load balancer.

All that’s left is to test the system and ensure everything is functioning as expected. From the bastion host, we’ll SSH into the web servers, launch an Nginx server, and verify access to the database from the application layer.

And just like that, we’ve successfully set up a three-tier architecture using VPC services on AWS! Give yourself a pat on the back for a job well done.

Well, that wraps up today’s episode of Continuous Improvement. I hope you found this guide helpful in understanding and implementing a three-tier architecture on AWS. If you have any questions or would like to connect, feel free to reach out to me on LinkedIn.

Join me next time as we explore more exciting topics and strategies for continuous improvement. Until then, keep learning and stay curious!

This is Continuous Improvement, signing off.