Skip to content

Repository files navigation

MariaDB-EBS-Resillience

background

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.


Project Overview

OnyxPay Ltd needed a database that never loses data even if the server crashes, supports regular backups, and allows instant recovery from accidental deletions.


Architecture

Application/User
↓
EC2 Instance (Amazon Linux)
↓
MariaDB Database
↓
Mounted EBS Volume (/var/lib/mysql)
↓
EBS Snapshot (Backup)

Technologies Used

  • EC2 (Amazon Linux 2)
  • EBS Volume (separate persistent storage)
  • MariaDB (data directory on EBS)
  • EBS Snapshots (backup & recovery)
  • Linux Disk Management

Project Objectives

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

Implementation Steps

  1. 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
```    

onyxpay_db_server


  1. 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.

volume_id ebs_volume


  1. Configure Linux Disk

Steps performed:

  • Identify new disk using lsblk

  • Create partition

  • Format disk using ext4

  • Mount volume to:

    /var/lib/mysql Persistence configured using: sudo nano /etc/fstab

partitioning mounting


  1. 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

mariadb_status


  1. Validate EBS Storage Dependency

Test performed:

  • Stop MariaDB
  • Unmount EBS volume
  • Observe MariaDB failure
  • Remount volume
  • Restart MariaDB

ebs_storage_dependency

Result:

MariaDB only functions when the EBS volume is mounted, proving that database data resides on the EBS volume.


  1. Create Snapshot Backup

Snapshot created: onyxpay-db-backup-v1

Purpose:

  • Protect database data
  • Enable point-in-time recovery
  • Ensure disaster recovery capability

snapshot


  1. Simulate Data Loss

To simulate a real failure:

  • Database was deleted from Mariadb DROP DATABASE onyxpay_db; database_failure

Result:

  • Database became inaccessible
  • MariaDB returned errors

  1. 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

restored_db

Result:

The database was fully restored from the snapshot.


Lessons Learned

  • 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.

Future Improvements

  • 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.

Security Considerations

  • 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.

Author

Elochukwu Princewill

Cloud Computing • Cybersecurity


⭐ If you found this project helpful

Feel free to ⭐ star this repository and explore my other AWS hands-on projects as I continue building practical cloud engineering solutions.


About

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.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages