Skip to content
EBS Snapshot scripts for php. Will create a snapshot and delete old ones.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


I uploaded an example file of how the php class is implemented. This can be added to cron to make backing up the database simple.

### Understanding the Constructor ###
public function __construct($ec2ToolsPath, $cert, $key, $snapDescription, $dbHost, $dbName, $dbUser, $dbPass, $volume, $snapToKeep)

$ec2ToolsPath - This is the path to the tools so that we can run the correct command.

$cert - This is the Amazon cert you get from your Amazon account.

$key - The matching key obtained from your Amazon account.

$snapDescription - The description of your snapshot. It need to be 'something_' . date("Y-m-d"). THIS IS VERY IMPORTANT. If you look at the sorting I explode the array of snapshots by the _ (underscore). And I use date to sort them.

$dbHost - The host of the database. Make sure your security groups are opened correctly. 

$dbName - Name of the database to connect to.

$dbUser - Database user who has permissions to connect.

$dbPass - Password for $dbUser

$volume - The volume to snapshot

$snapToKeep - The number of snapshots to keep.
Something went wrong with that request. Please try again.