AWS Builder Center
Deploying a Docker-Based LAMP Expense Analyzer on AWS EC2

Deploying a Docker-Based LAMP Expense Analyzer on AWS EC2

I recently built and containerized an Expense Analyzer application using Docker and a LAMP stack (Linux, Apache, MySQL, PHP). To gain hands-on AWS experience, I deployed the application on an Amazon EC2 instance and configured persistent storage using Docker volumes.

Project Overview

The Expense Analyzer application allows users to:
  • Add, edit, and delete expenses
  • Generate spending insights
  • Visualize expenses through charts
  • Import CSV files
  • Filter expenses by category
  • View monthly and yearly reports

Architecture

User
│
▼
AWS EC2 Instance
│
┌────────┴────────┐
│ │
▼ ▼
Docker Engine Security Group
│
┌──────┴──────┐
│ │
▼ ▼
Apache + PHP MySQL Container
Container │
│ │
└──────┬────────┘
│
▼
Docker Volume


Architecture Components

Component
Purpose
User
Accesses the application through a web browser
AWS EC2 Instance
Hosts the complete application stack
Docker Engine
Runs and manages application containers
Apache + PHP Container
Serves the Expense Analyzer web application
MySQL Container
Stores application data and expense records
Docker Volume
Provides persistent database storage
Security Group
Controls inbound and outbound network traffic

Request Flow

  1. User accesses the Expense Analyzer application using the EC2 public IP or domain name.
  1. The request reaches the EC2 instance through the configured Security Group.
  1. Apache serves the PHP application from the Docker container.
  1. The PHP application communicates with the MySQL container.
  1. MySQL stores and retrieves expense data using persistent Docker volumes.
  1. The application returns processed results and visual reports to the user.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article