Created
March 8, 2012 15:48
-
-
Save bminer/2001606 to your computer and use it in GitHub Desktop.
Simple PHP script to backup EC2 EBS volumes. Nice to include as a daily Cron job.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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
Hmmm... yeah.... can't get any more simple than this, I'm afraid. :-/