Building a 3-Tier Application on AWS

Published: (March 17, 2026 at 04:58 AM EDT)
3 min read
Source: Dev.to

Source: Dev.to

When I hear the word “3‑tier architecture,” it often feels like one of those big concepts mentioned in tech talks. Instead of just reading about it, I built a small Nigerian passport application system on AWS to see how it works in practice.

Overview of the 3‑Tier Architecture

                User
                 |
                 |  HTTP Request
                 v
        -----------------------
        Presentation Layer
        EC2 Instance
        Nginx Web Server
        (HTML, CSS, JS)
        -----------------------
                 |
                 |  POST Request
                 v
        -----------------------
        Logic Layer
        EC2 Instance
        Flask API
        (Application Logic)
        -----------------------
                 |
                 |  SQL Query
                 v
        -----------------------
        Data Layer
        Amazon RDS
        MariaDB Database
        -----------------------

What Is a 3‑Tier Architecture?

A 3‑tier architecture separates an application into three distinct layers:

  1. Presentation Layer – The frontend that users see and interact with.
  2. Logic Layer – The backend that processes requests and contains the application logic.
  3. Data Layer – The storage layer, typically a database hosted by a cloud provider.

This separation makes systems easier to manage, scale, and troubleshoot.

Presentation Layer

Technologies Used

  • HTML, CSS, JavaScript – Simple form for passport applications.
  • EC2 instance running Nginx – Serves the static assets.

The presentation layer’s responsibility is to collect user input from the form and send it to the backend via an HTTP POST request.

Logic Layer

Technologies Used

  • EC2 instance running a Flask API.

The Flask application receives the form data from the presentation layer, validates and processes it, and then forwards it to the data layer for storage.

Data Layer

Technologies Used

  • Amazon RDS with MariaDB.

The data layer stores the passport application records. When the backend receives a valid request, it inserts the data into the RDS database.

Interaction Flow

  1. A user opens the website and fills out the passport form.
  2. The frontend sends the form data to the Flask API.
  3. The backend processes the request and stores the information in Amazon RDS.

Each layer performs a specific task, keeping the system organized and easier to manage.

Troubleshooting Example

During development everything seemed ready: servers were running, code looked correct, and the database was configured. However, the form refused to work. After hours of debugging I discovered the issue was network configuration, not the application code. The backend EC2 instance’s security group did not allow traffic on the required port, preventing the frontend from reaching the API. Updating the security group and fixing the API endpoint restored communication between all three layers instantly.

Takeaways

  • Building a 3‑tier architecture turns a theoretical concept into a practical, maintainable system.
  • Clear separation of concerns simplifies scaling and troubleshooting.
  • Proper network and security configurations are crucial for inter‑layer communication.

Project Code

The full project code is available here:

Link to repository (replace with actual URL).

0 views
Back to Blog

Related posts

Read more »