Two Tier Solution

A solid architecture for a highly available application with a secure connection to a resilient multi-availability zone database.

Related Links

Click the links below to check how I implemented this architecture step by step using Terraform.

Blog: Step by step Two Tier Solution

Github Repository: github.com/tales-menezes/two-tier-solution/

Estimated Monthly Cost

Public IPv4 Address: 7.30 USD
Number of In-use public IPv4 addresses (2)

Amazon EC2 (t2.micro): 19.27 USD
Tenancy (Shared Instances)
Operating system (Linux)
Workload (Consistent, Number of instances: 2)
Pricing strategy (On-Demand Utilization: 100 %Utilized/Month)
(Up to 72% discount with Instance Saving Plans)

Application Load Balancer: 6.13 USD
Number of Application Load Balancers (1)
Utilization (EC2 / IP) 1 GB per hour x 730 hours per month

Amazon RDS for MySQL: 33.06 USD
Storage for each RDS instance (General Purpose SSD (gp2) 20 GB)
Nodes (1), Instance type (db.t3.micro)
Utilization (On-Demand only) (100 %Utilized/Month)
Deployment option (Multi-AZ)
No RDS Proxy
Pricing strategy (OnDemand)

Total Monthly Cost: 65.76 USD

* AWS Pricing Calculator provides only an estimate of your AWS fees and doesn't include any taxes that might apply. Your actual fees depend on a variety of factors, including your actual usage of AWS services.

Brief Description

In this project, I demonstrate how implementing a two-tier architecture across multiple Availability Zones (AZs) can significantly enhance the high availability and resilience of an application. This architecture reduces the risk of failure by ensuring that even if an entire AZ goes offline, the application remains operational.

Key AWS components are used in harmony to ensure this:

  1. Elastic Load Balancer (ELB): Distributes incoming traffic evenly across EC2 instances deployed in multiple AZs. It not only balances the load but also reroutes traffic to healthy instances in the event of an AZ failure, maintaining service continuity.

  2. EC2 Instances: These instances run the application layer and are distributed across different AZs for fault tolerance and high availability.

  3. Amazon RDS: A relational database service that provides reliable and scalable storage. In this example, it is deployed with Multi-AZ support to ensure database failover and data durability.

The AWS Pricing Calculator was used to estimate the cost of this solution under a worst-case scenario (no discounts, no saving plans, and no free-tier eligibility). However, significant cost savings can be achieved by applying the following strategies:

  • EC2 Savings Plans: By committing to a one or three-year term, savings plans offer lower pricing on compute usage.

  • Spot Instances: These allow you to take advantage of unused EC2 capacity at significantly reduced rates.

  • RDS Single-AZ Deployment: While reducing resilience, opting for a Single-AZ deployment can lower database costs.