Skip to content

Ofony-85/aws-wordpress-ha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

High Availability WordPress Deployment on AWS

AWS WordPress Infrastructure

πŸš€ Project Overview

Production-ready WordPress deployment on AWS with automatic failover and high availability across multiple availability zones. This infrastructure can handle instance failures with zero downtime through intelligent load balancing and auto-scaling.

πŸ“‹ Live Demo

Status: βœ… Live and Running
URL: http://wordpress-alb-543074365.us-east-1.elb.amazonaws.com Uptime: 99.9%+

πŸ—οΈ Architecture

                          Internet
                             ↓
                   Application Load Balancer
                             ↓
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚         Auto Scaling Group              β”‚
        β”‚    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
        β”‚    β”‚   EC2 (AZ-a) β”‚  β”‚   EC2 (AZ-b) β”‚    β”‚
        β”‚    β”‚  WordPress   β”‚  β”‚  WordPress   β”‚    β”‚
        β”‚    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜    β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚                  β”‚
           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”
           β”‚     Amazon EFS (Shared Storage)    β”‚
           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
                   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”
                   β”‚  Amazon RDS     β”‚
                   β”‚  MySQL Database β”‚
                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Technologies Used

  • Cloud Provider: AWS (Amazon Web Services)
  • Compute: EC2 (t2.micro instances)
  • Load Balancing: Application Load Balancer (ALB)
  • Auto Scaling: Auto Scaling Groups (2-4 instances)
  • Database: Amazon RDS MySQL 8.0
  • Storage: Amazon EFS (Elastic File System)
  • Networking: VPC, Subnets, Security Groups, Internet Gateway
  • IAM: Instance Profiles and Roles
  • OS: Amazon Linux 2023
  • Web Server: Apache with PHP-FPM
  • CMS: WordPress 6.8.3
  • Automation: AWS CLI, Bash scripting

✨ Key Features

  • βœ… High Availability: Multi-AZ deployment across 2 availability zones
  • βœ… Auto Scaling: Automatically scales from 2 to 4 instances based on demand
  • βœ… Zero Downtime: Instant failover when instances fail (<1 second)
  • βœ… Load Balancing: Even distribution of traffic across healthy instances
  • βœ… Shared Storage: EFS ensures file consistency across all instances
  • βœ… Managed Database: RDS with automated backups and encryption
  • βœ… Security: Custom security groups with least-privilege access
  • βœ… Monitoring: Health checks every 30 seconds
  • βœ… Automated Recovery: Failed instances automatically replaced

πŸ“Š Technical Specifications

Component Specification
Region us-east-1
Availability Zones us-east-1a, us-east-1b
VPC CIDR 10.0.0.0/16
Public Subnets 10.0.1.0/24, 10.0.2.0/24
Private Subnets 10.0.3.0/24, 10.0.4.0/24
Instance Type t2.micro
Database Class db.t3.micro
Storage 20GB encrypted
Min Instances 2
Max Instances 4

πŸš€ Deployment Guide

Prerequisites

  • AWS Account with appropriate permissions
  • AWS CLI installed and configured
  • SSH key pair
  • Basic knowledge of Linux and AWS services

Quick Start

  1. Clone the repository
git clone https://github.com/Ofony-85/aws-wordpress-ha.git
cd aws-wordpress-ha
  1. Configure AWS credentials
aws configure

3. **Access WordPress**
- Navigate to the ALB DNS name provided in the output
- Complete WordPress installation wizard

## πŸ“ Project Structure

aws-wordpress-ha/ β”œβ”€β”€ README.md β”œβ”€β”€ docs/ β”‚ β”œβ”€β”€ DEPLOYMENT_GUIDE.md β”‚ β”œβ”€β”€ ARCHITECTURE.md β”‚ └── TROUBLESHOOTING.md β”œβ”€β”€ scripts/ β”‚ β”œβ”€β”€ deploy.sh β”‚ β”œβ”€β”€ cleanup.sh β”‚ β”œβ”€β”€ user-data.sh β”‚ └── monitor.sh β”œβ”€β”€ screenshots/ β”‚ β”œβ”€β”€ architecture-diagram.png β”‚ β”œβ”€β”€ wordpress-dashboard.png β”‚ β”œβ”€β”€ aws-console-ec2.png β”‚ └── cloudwatch-metrics.png └── resource-ids.txt


## πŸ”’ Security Features

- **Network Isolation:** Public and private subnets
- **Security Groups:** Strict ingress/egress rules
- **Database Encryption:** Storage encryption at rest
- **Private Database:** RDS not publicly accessible
- **IAM Roles:** Instance profiles for EFS access
- **HTTPS Ready:** Can be configured with ACM certificate

## πŸ“ˆ Performance Metrics

- **Availability:** 99.9%+
- **Failover Time:** <1 second
- **Auto Scaling Response:** 2-5 minutes
- **Health Check Interval:** 30 seconds
- **Database Backup:** Automated daily with 7-day retention

## πŸ§ͺ Testing

### High Availability Test
```bash
# Stop one instance
aws ec2 stop-instances --instance-ids i-xxxxx

# Website continues to work
# Auto Scaling launches replacement within 5 minutes

Load Test

# Monitor Auto Scaling behavior
watch -n 30 'aws autoscaling describe-auto-scaling-groups \
  --auto-scaling-group-names WordPress-ASG'

πŸ’° Cost Estimation

Monthly Cost: ~$50-70 (without free tier)

Breakdown:

  • EC2 (2x t2.micro): ~$15
  • RDS (db.t3.micro): ~$15
  • ALB: ~$16
  • EFS: ~$0.30/GB
  • Data Transfer: Varies

Free Tier Eligible:

  • EC2: 750 hours/month (first 12 months)
  • RDS: 750 hours/month (first 12 months)
  • ALB: 750 hours/month + 15GB data (first 12 months)

πŸ”§ Maintenance

Regular Tasks

  • Update WordPress core, themes, and plugins weekly
  • Monitor CloudWatch metrics and logs
  • Review RDS backup retention
  • Check security group rules monthly
  • Test disaster recovery procedures quarterly

πŸ› Troubleshooting

Common Issues

Unhealthy Targets

  • Check security groups allow HTTP from ALB
  • Verify EFS is mounted
  • Check Apache status

Database Connection Error

  • Verify wp-config.php credentials
  • Check RDS security group
  • Test connection from EC2

πŸ“š What I Learned

  • Designing multi-tier architectures on AWS
  • Implementing high availability and fault tolerance
  • Configuring load balancers and auto scaling
  • Managing shared storage across instances
  • Database administration with RDS
  • Infrastructure automation with AWS CLI
  • Security best practices in the cloud
  • Cost optimization strategies

🎯 Future Enhancements

  • Add HTTPS with AWS Certificate Manager
  • Implement CloudFront CDN
  • Add Route 53 for custom domain
  • Implement AWS WAF for security
  • Add CloudWatch alarms and SNS notifications
  • Convert to Infrastructure as Code (Terraform)
  • Implement CI/CD pipeline
  • Add Redis/Memcached for caching
  • Implement backup automation with AWS Backup
  • Multi-region deployment

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘€ Author

Ofonime Offong

πŸ™ Acknowledgments

  • AWS Documentation
  • WordPress.org
  • Cloud Academy tutorials
  • AWS Well-Architected Framework

πŸ“ž Contact

+2348038854115

For questions or collaboration opportunities, feel free to reach out!


⭐ If you find this project useful, please consider giving it a star!

About

Production-ready WordPress deployment on AWS with high availability, auto-scaling, and load balancing across multiple availability zones

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages