自动化 Amazon EBS 快照任何人在 Linux 上都有一个好的脚本或解决方案
我希望这是相当常规的,但找不到自动创建管理 EBS 快照的简单方法。
希望AWS控制台中有一个调度程序..可惜还没有。
如果有任何有关如何在 Ubuntu 上最好地执行此操作的建议,我们将不胜感激。
谢谢
I'd expect this to be fairly routine, but cannot find a simple approach for creating an managing EBS snapshots automatically.
Was hoping there'd be a shceduler in the AWS console.. alas not yet.
Would appreciate any suggestions as to how best to do this on from Ubuntu.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
查看 AWS 缺少的工具,尤其是 https://github.com/ colinbjohnson/aws-missing-tools/tree/master/ec2-automate-backup 这可以满足您的需要。
Take a look at AWS missing tools and especially to https://github.com/colinbjohnson/aws-missing-tools/tree/master/ec2-automate-backup This does what you need.
您可以轻松地编写一些脚本来为您执行此操作。
EC2_CERT
和EC2_PRIVATE_KEY
以便能够使用 API 工具ec2-describe-snapshots
的结果,结果如下所示:
然后您可以执行一些操作解析日期并排序并开始删除旧快照。
注意:我不知道我们是否可以相信排序顺序,但我从未见过它以从最旧到最新的方式排序。
要删除快照,请使用
ec2-delete-snapshot snap-xxxxxxxx
。剩下的部分我将作为一个简单的 Bash 脚本留给您,您可以每天调用该脚本,也可以根据需要从 cron 调用该脚本。
You can easily script something to do this for you.
EC2_CERT
andEC2_PRIVATE_KEY
in order to be able to use the API toolsec2-describe-snapshots
The results look something like:
You can then do some parsing of the dates and sorting and start removing the older snapshots.
NOTE: I don't know if we can trust the sort order but I've never seen it sort any other way than oldest to newest.
To delete a snapshot, use
ec2-delete-snapshot snap-xxxxxxxx
.The rest I leave to you as a simple Bash script that you can call daily or however often you need from cron.
无耻的插件,但是 - 你可以尝试一下 Ebs2s3:
https://github.com/ajmfulcher/ebs2s3
Rails 应用程序,用于自动创建快照并修剪旧快照。简介和一些截图在这里:
http://ajmfulcher.blogspot.com/2011 /04/ebs2s3-automated-backup-for-amazon-ebs.html
Shameless plug, but - you can give Ebs2s3 a go:
https://github.com/ajmfulcher/ebs2s3
Rails app to automate snapshot creation and prune old snapshots. Introduction and some screenshots here:
http://ajmfulcher.blogspot.com/2011/04/ebs2s3-automated-backup-for-amazon-ebs.html
我发现了这个,希望它有帮助:
请参阅:从命令行批量删除 EBS 快照(指南)。
I found this, hope it helps:
See: Bulk Delete EBS Snapshots From the Command Line (A Howto).
一个很棒的脚本来创建自动快照。
https://github.com/rakesh-sankar /Tools/blob/master/AmazonAWS/EBS/EBS-Snapshot.sh
只需复制代码并创建一个文件,然后在需要运行时添加一个 cronjob 即可。
A wonderful script to create an automatic snapshots.
https://github.com/rakesh-sankar/Tools/blob/master/AmazonAWS/EBS/EBS-Snapshot.sh
Just copy the code and create a file, then add a cronjob whenever you want it to run.