Download the PHP package jdelaune/aws-ec2-snapshot-management without Composer
On this page you can find all versions of the php package jdelaune/aws-ec2-snapshot-management. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jdelaune/aws-ec2-snapshot-management
More information about jdelaune/aws-ec2-snapshot-management
Files in jdelaune/aws-ec2-snapshot-management
Package aws-ec2-snapshot-management
Short Description AWS EC2 Snapshot Manager for maintaining snapshots
License MIT
Homepage https://github.com/jdelaune/AWS-EC2-Snapshot-Management
Informations about the package aws-ec2-snapshot-management
EC2 Snapshot Management
- Introduction
- Installation
- Configuration
- Example
- Command Line Parameters
Introduction
AWS EC2 Snapshot Management is a php script which prunes EC2 snapshots as if they were backups. It's meant to be run from the command line, but can be called by other PHP scripts if you so desire. As well as cleaning up snapshots it can also be used to take new snapshots as well.
The cleanup function will keep snapshots made:
- Daily: In the last seven days.
- Weekly: One per week in the last month.
- Monthly: One per month.
It will always keep at least one snapshot even if it was made a year ago.
This script took inspiration from 'EC2 Manage Snapshots' made by Erik Dasque and previously Oren Solomianik. It however requires the AWS PHP SDK.
This script is provided under the MIT License.
Installation
The recommended way to install EC2 Snapshot Management is through Composer.
Next, run the Composer command to install the latest stable version of EC2 Snapshot Management:
After installing, you need to require Composer's autoloader:
Configuration
EC2 Snapshot Management uses the AWS PHP SDK. You will needed to setup your credentials by following the instructions given here:
http://docs.aws.amazon.com/aws-sdk-php/guide/latest/credentials.html#credential-profiles
It expects a profile called ec2snapshot
.
Example
You will need to create a sample script like the one below:
Or you can call the script you just created from the command line instead of passing parameters to the class constructor:
You will probably want to create two scripts to call each function independently!
Command line parameters
Parameter | Value |
---|---|
-v= | EC2 volume identifier (Required). |
-r= | EC2 region (Optional). Defaults to us-east-1.
|
-d= | Description, used when creating a snapshot (Optional). |
-o | Verbose mode. Tells you what it's doing (Optional). |
-q | Quiet mode. No output (Optional). |
-n | No operation mode. It won't actually delete or create any snapshots. Useful along with verbose mode to see what it will do the first time you run it (Optional). |