jdelaune/aws-ec2-snapshot-management
Composer 安装命令:
composer require jdelaune/aws-ec2-snapshot-management
包简介
AWS EC2 Snapshot Manager for maintaining snapshots
README 文档
README
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.
# Install Composer curl -sS https://getcomposer.org/installer | php
Next, run the Composer command to install the latest stable version of EC2 Snapshot Management:
composer require jdelaune/aws-ec2-snapshot-management
After installing, you need to require Composer's autoloader:
require 'vendor/autoload.php';
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:
<?php // myScript.php require 'vendor/autoload.php'; use EC2SnapshotManagement\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();
Or you can call the script you just created from the command line instead of passing parameters to the class constructor:
php myScript.php -v="vol-abcdefgh" -r="eu-west-1" -d="My Server Backup" -n -o
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). |
jdelaune/aws-ec2-snapshot-management 适用场景与选型建议
jdelaune/aws-ec2-snapshot-management 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 38 次下载、GitHub Stars 达 10, 最近一次更新时间为 2015 年 02 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「aws」 「backup」 「ec2」 「snapshots」 「snapshot management」 「ec2 backup」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jdelaune/aws-ec2-snapshot-management 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jdelaune/aws-ec2-snapshot-management 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jdelaune/aws-ec2-snapshot-management 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
AWS SDK for PHP - Use Amazon Web Services in your PHP project
A SDK for working with B2 cloud storage.
This package includes a script and fail2ban configuration that allows you to use fail2ban when utilizing AWS elastic load balancer (ELB) and an apache webserver.
This library reads parameters from AWS Parameter Store. It supports a path prefix, an optional shared context and multiple profiles. Returns an multi dimensional array of string|int|float|bool. Integrates directly with zendframework/zend-config-aggregator.
Elastic Driver for Laravel Scout
A sleek PHP wrapper around rclone with Laravel-style fluent API syntax
统计信息
- 总下载量: 38
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 12
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-02-28