Simple PHP script to backup EC2 EBS volumes. Nice to include as a daily Cron job.
#! /usr/bin/env php | |
<?php | |
//Don't forget to setup credentials for the AWS API. | |
require_once('/usr/lib/aws-php-sdk-1.3.1/sdk.class.php'); | |
$ec2 = new AmazonEC2(); | |
$volumes = array( | |
'vol-xxxxxxxx' => '-- Your snapshot description here --', | |
'vol-xxxxxxxx' => '-- Your snapshot description here --', | |
'vol-xxxxxxxx' => '-- Your snapshot description here --' | |
); | |
foreach($volumes as $volumeID => $snapshotDesc) | |
{ | |
$response = $ec2->create_snapshot($volumeID, $snapshotDesc); | |
$OK = $response->isOK(); | |
if(!$OK) | |
var_dump($response); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Hmmm... yeah.... can't get any more simple than this, I'm afraid. :-/