Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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);
}
?>
@bminer

This comment has been minimized.

Copy link
Owner Author

@bminer bminer commented Mar 8, 2012

Hmmm... yeah.... can't get any more simple than this, I'm afraid. :-/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment