PHP code example of jdelaune / aws-ec2-snapshot-management

1. Go to this page and download the library: Download jdelaune/aws-ec2-snapshot-management library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jdelaune / aws-ec2-snapshot-management example snippets





// myScript.php

ment\Manager;

/**
 * Create a new EC2 Snapshot Manager
 *
 * You don't need to supply any arguments if calling from the command line.
 *
 * @param string    $volume         EC2 Volume Identifier (optional).
 * @param string    $region         EC2 Region Identifier (optional).
 * @param boolean   $quiet          Quiet mode, no output (optional).
 * @param boolean   $noOperation    No operation mode, nothing will get deleted (optional).
 * @param boolean   $verbose        Verbose, tells you exactly what it's doing (optional).
 * @param string    $description    Description of new snapshot if creating one (optional).
 */
$manager = new Manager('vol-abcdefgh', 'eu-west-1', false, true, true, 'My Data Backup');

/**
 * Cleans up existing old snapshots
 */
$manager->cleanupSnapshots();

/**
 * Take a new snapshot
 */
$manager->takeSnapshot();
shell
# Install Composer
curl -sS https://getcomposer.org/installer | php
shell
php myScript.php -v="vol-abcdefgh" -r="eu-west-1" -d="My Server Backup" -n -o