It looks like a very required and trivial task. But there is not outof the box solution in AWS. But fortunately it is easy to setup with few steps.
-
Opent SSH connection to your server.
-
Navigate to folder
$ cd /usr/local/
-
Clon this gist
$ git clone https://gist.github.com/9738785.git ec2
-
Go to that folder
$ cd ec2
-
Make
backup.php
executable$ chmod +x backup.php
-
Open releases of the AWS PHP SDK github project and copy URL of
aws.zip
button. Now download it into your server.$ wget http://docs.aws.amazon.com/aws-sdk-php/v3/download/aws.zip
-
Unzip this file into
aws
directory.$ unzip aws.zip -d aws
-
Edit
backup.php
php file and set all settings in line5-12
$dryrun = FALSE; $interval = '24 hours'; $keep_for = '10 Days'; $volumes = array('vol-********'); $api_key = '*********************'; $api_secret = '****************************************'; $ec2_region = 'us-east-1'; $snap_descr = "Daily backup";
-
Test it. Run this script
$ ./backup.php
Test is snapshot was created.
-
If everything is ok just add cronjob.
* 23 * * * /usr/local/ec2/backup.php
Tks for the code but i got a question about the $api_key and $api_secret ? where do i get those.