1. Go to this page and download the library: Download tuscanicz/php-aws-snapshots 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/ */
tuscanicz / php-aws-snapshots example snippets
$awsCliPath = '/usr/local/bin/aws';
$date = date('Y-m-d');
$volumes = [
new \AwsSnapshots\Options\VolumeIntervalBackupOptions('vol-123af85a', 7, '1 day', 'dev-server-backup'),
new \AwsSnapshots\Options\VolumeIntervalBackupOptions('vol-321bg96c', 4, '1 week', 'image-server-' . $date),
new \AwsSnapshots\Options\VolumeBackupOptions('vol-987ab12a', 10, 'cache-backup-backup'),
];
$awsCliHandler = new \AwsSnapshots\Cli\AwsCliHandler($awsCliPath);
$snapshots = new \AwsSnapshots\Snapshots($awsCliHandler);
$snapshots->run($volumes);
bash
# run the cron job every night at 3:00 am
00 03 * * * /usr/bin/php /root/scripts/run-snapshots.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.