Production-ready MariaDB database deployed on AWS EC2 with persistent EBS storage and automated snapshot backups. Includes full backup, data-loss simulation, and instant recovery — demonstrating real-world cloud resilience and disaster recovery skills.
OnyxPay Ltd needed a database that never loses data even if the server crashes, supports regular backups, and allows instant recovery from accidental deletions.
Application/User
↓
EC2 Instance (Amazon Linux)
↓
MariaDB Database
↓
Mounted EBS Volume (/var/lib/mysql)
↓
EBS Snapshot (Backup)
- EC2 (Amazon Linux 2)
- EBS Volume (separate persistent storage)
- MariaDB (data directory on EBS)
- EBS Snapshots (backup & recovery)
- Linux Disk Management
This project demonstrates the ability to:
- Deploy
- Create and attach EBS volumes
- Partition and format storage in linux
- Mount persistence storage
- Install and configure Mariadb
- Separate OS storage from database storage
- Create backups using snapshots
- Restore data after failure
- Launch EC2 Instance
- Amazon Linux 2
- Instance type: t2.micro
- Instance name: onyxpay-db-server
Security Group Configuration:
```
- SSH (22) – Administrative access
- MySQL (3306) – Database access
```
- Create and Attach EBS Volume
- Created a secondary EBS volume
- Size: 10–20GB
- Attached to the EC2 instance
Purpose:
Separate database storage from the operating system.
- Configure Linux Disk
Steps performed:
-
Identify new disk using lsblk
-
Create partition
-
Format disk using ext4
-
Mount volume to:
/var/lib/mysqlPersistence configured using:sudo nano /etc/fstab
- Install MariaDB
Commands used:
sudo dnf install mariadb105-server
sudo systemctl start mariadb
sudo systemctl enable mariadb
Database validation:
- Created database onyxpay_db
- Created test table
- Inserted sample records
- Validate EBS Storage Dependency
Test performed:
- Stop MariaDB
- Unmount EBS volume
- Observe MariaDB failure
- Remount volume
- Restart MariaDB
Result:
MariaDB only functions when the EBS volume is mounted, proving that database data resides on the EBS volume.
- Create Snapshot Backup
Snapshot created:
onyxpay-db-backup-v1
Purpose:
- Protect database data
- Enable point-in-time recovery
- Ensure disaster recovery capability
- Simulate Data Loss
To simulate a real failure:
Result:
- Database became inaccessible
- MariaDB returned errors
- Restore Database from Snapshot
Recovery process:
- Create new EBS volume from snapshot
- Detach damaged volume
- Attach restored volume
- Mount to /var/lib/mysql
- Restart MariaDB
Result:
The database was fully restored from the snapshot.
- Configured a production-ready MariaDB database on Amazon EC2.
- Attached and managed Amazon EBS volumes for persistent storage.
- Performed automated and manual snapshot backups.
- Simulated data loss and successfully restored the database from backups.
- Strengthened understanding of disaster recovery and data resilience in AWS.
- Integrate Amazon CloudWatch for database monitoring.
- Automate backup and recovery using AWS Lambda.
- Implement Infrastructure as Code with AWS CloudFormation or Terraform.
- Configure Multi-AZ or Amazon RDS for high availability.
- Add automated backup validation and recovery testing.
- Restrict database access using Security Groups.
- Enforce SSH key-based authentication for EC2 access.
- Apply the principle of least privilege with IAM roles.
- Regularly update the operating system and MariaDB packages.
- Encrypt EBS volumes and snapshots to protect sensitive data.
Elochukwu Princewill
Cloud Computing • Cybersecurity
Feel free to ⭐ star this repository and explore my other AWS hands-on projects as I continue building practical cloud engineering solutions.










