Computing Magazine

Automate Backup Of AWS EBS Volumes

Posted on the 31 July 2016 by Hean Hong Leong @hongster

https://github.com/hongster/aws-ec2-backup

I manage a number of EC2 instances on Amazon. I perform backup by creating snapshots of EBS volumes, as recovery is simple as creating EC2 instance from snapshot. My backup (PHP) script is published on Github.

How It Works

  1. Define a list of volumes in configuration file.
  2. A new snapshot is created for each volume, if there is no recently created snapshot within last 24 hours.
  3. Snapshots olders than 7 days (configurable) are deleted.
  4. Log is sent to an email recipient.

I scheduled a cronjob to run it once a day.

It Uses

  • AWS SDK for PHP
  • Custom logger that captues echo outputs and PHP error messages, then email it

Back to Featured Articles on Logo Paperblog