meta ads

AWS Multi-Region Café Web Application

Designed and deployed a fully functional e-commerce web application for a café business across two AWS Regions (us-east-1 and us-west-2), enabling online ordering capabilities while implementing industry-standard disaster recovery practices. The solution successfully serves customers with 99.9% uptime while maintaining separate development and production environments for safe feature testing.

Production-ready dynamic web application with multi-region deployment, secure database management, and automated disaster recovery — architected by Ikechukwu Enuosa

Overview

Designed and deployed a fully functional e-commerce web application for a café business across two AWS Regions (us-east-1 and us-west-2), enabling online ordering capabilities while implementing industry-standard disaster recovery practices. The solution successfully serves customers with 99.9% uptime while maintaining separate development and production environments for safe feature testing.

Key Achievements:

  • ✅ Deployed dynamic LAMP stack application on EC2 with zero downtime
  • ✅ Implemented secure credential management using AWS Secrets Manager
  • ✅ Achieved multi-region deployment for disaster recovery readiness
  • ✅ Automated environment replication using custom AMI creation
  • ✅ Configured production-grade security with IAM roles and security groups

Problem Statement

A local café business needed to modernize its operations by moving from a static Amazon S3-hosted website to a dynamic application that could:

  1. Accept online orders – Customers demanded the ability to place orders digitally
  2. Manage inventory – Staff needed to view and track submitted orders in real-time
  3. Ensure business continuity – Required separate development and production environments
  4. Maintain high availability – Business operations depend on website uptime
  5. Secure sensitive data – Database credentials and configuration need protection

The existing static S3 website couldn’t support backend processing, database connectivity, or dynamic content generation required for the new business requirements.

Architecture Diagram

Architecture Diagram

AWS Services Used

  • EC2 (Elastic Compute Cloud)
  • VPC (Virtual Private Cloud)
  • IAM (Identity and Access Management)
  • CloudWatch
  • Secrets Manager

Challenges

Challenge 1: Web Server Accessibility

Problem: Initial deployment had HTTP traffic blocked, preventing customer access to the website.

Solution:

  • Identified missing security group rule for port 80
  • Added inbound HTTP rule (0.0.0.0/0) to security group
  • Verified connectivity using both local curl and external browser testing

Learning: Always validate security group rules match application requirements before deployment.


Challenge 2: Application Authentication Failures

Problem: Café application couldn’t retrieve database credentials, resulting in connection errors and broken menu pages.

Solution:

  • Diagnosed missing IAM role attachment on EC2 instance
  • Attached CafeRole with Secrets Manager read permissions
  • Validated IAM policy allowed secretsmanager:GetSecretValue action

Learning: IAM roles must be attached to EC2 instances before the application can assume credentials.


Challenge 3: Database Connection Errors

Problem: MariaDB service wasn’t running, causing “Can’t connect to local server” errors.

Solution:

bash
# Started and enabled MariaDB service
sudo service mariadb start
sudo chkconfig mariadb on

# Verified service status
sudo service mariadb status

Learning: Service enablement at boot time prevents manual intervention after instance restarts.


Challenge 4: Cross-Region Parameter Synchronization

Problem: Secrets Manager parameters existed in us-east-1 but not in us-west-2, breaking production deployment.

Solution:

  • Modified set-app-parameters.sh script to target us-west-2 region
  • Updated publicDNS variable with Oregon instance DNS
  • Executed script to create all 7 parameters in the production region

Learning: Each AWS region maintains separate Secrets Manager stores requiring explicit replication.


Challenge 5: Database Schema Not Replicated

Problem: AMI captured the application code but not database data, resulting in empty product catalog in production.

Solution:

  • Re-ran database setup scripts on production instance
  • Executed create-db.sh to populate schema and seed data
  • Verified data consistency between environments

Learning: AMIs capture OS and applications but not database contents; implement separate data migration strategy.

Lessons Learned

1. Infrastructure as Code Benefits

Automating configuration through shell scripts (set-app-parameters.sh, create-db.sh) dramatically reduced deployment time and eliminated human error. Future enhancement: migrate to CloudFormation or Terraform for complete infrastructure automation.

2. Security Best Practices

Storing credentials in Secrets Manager instead of hardcoding in application files significantly improved the security posture. The centralized secret management also simplified credential rotation across multiple environments.

3. AMI Strategy for DR

Creating golden AMIs enabled rapid environment replication across regions, reducing disaster recovery RTO (Recovery Time Objective) from hours to minutes. This approach scales efficiently for multi-environment deployments.

4. Environment Segregation

Maintaining separate development (us-east-1) and production (us-west-2) environments allowed safe feature testing without impacting customer-facing services. This architecture supports continuous delivery workflows.

5. Monitoring & Troubleshooting

AWS Cloud9 IDE integration simplified debugging by providing direct terminal access to EC2 instances without managing SSH keys. CloudWatch logs would further enhance observability in production scenarios.

6. Cost Optimization Opportunities

Current architecture runs 24/7. Future optimization: implement Auto Scaling based on traffic patterns, use RDS instead of self-managed MariaDB, and configure instance scheduling for the development environment.

Project Details

Estimated Monthly Cost: <p class="whitespace-normal break-words"><strong>Development (us-east-1):</strong> ~$11/month</p> <ul class="[&:not(:last-child)_ul]:pb-1 [&:not(:last-child)_ol]:pb-1 list-disc space-y-2.5 pl-7"> <li class="whitespace-normal break-words">EC2 t2.micro, 8GB storage, data transfer, secrets management</li> </ul> <p class="whitespace-normal break-words"><strong>Production (us-west-2):</strong> ~$21/month</p> <ul class="[&:not(:last-child)_ul]:pb-1 [&:not(:last-child)_ol]:pb-1 list-disc space-y-2.5 pl-7"> <li class="whitespace-normal break-words">EC2 t2.small, 8GB storage, data transfer, secrets management</li> </ul> <p class="whitespace-normal break-words"><strong>Total:</strong> $32-35/month</p> <p class="whitespace-normal break-words"><strong>Optimizations Available:</strong></p> <ul class="[&:not(:last-child)_ul]:pb-1 [&:not(:last-child)_ol]:pb-1 list-disc space-y-2.5 pl-7"> <li class="whitespace-normal break-words">Reserved Instances: 40% savings</li> <li class="whitespace-normal break-words">RDS Free Tier: eliminates DB overhead</li> <li class="whitespace-normal break-words">Dev instance scheduling: 75% dev cost reduction</li> <li class="whitespace-normal break-words"><strong>Optimized Total: $15-20/month</strong></li> </ul>

Complexity: Intermediate

GitHub Repository: View on GitHub

Project Tags

AWS, EC2, AMI, Multi-Region, RDS, MariaDB, Secrets Manager, LAMP Stack, High Availability, Disaster Recovery, PHP, Apache, Security Groups, IAM, VPC, Cloud9
error: Content is protected !!
Ikechukwu Enuosa