亚马逊ec2 实例删除
第一部分:使用Cron计划快照 (Part One: Scheduling Snapshots Using Cron)
Skill Level: IntermediateOperating System(s): Linux
技能级别:中级操作系统: Linux
哲学 (Philosophy)
99.999% Uptime. That is a wonderful goal, and in order to get there we must plan for the inevitable outages and problems that cause our servers to break.
正常运行时间为99.999%。 这是一个绝妙的目标,为了达到目标,我们必须为不可避免的停机和导致服务器故障的问题进行计划。
The best we can do is to be prepared with the Three P’s: Planning, Process, and Practice.
我们能做的最好的事情就是准备三个P:计划,流程和实践。
So how do we plan for the worst? Make backups, of course! The best kind are those that:
那么我们如何计划最坏的情况呢? 当然要备份! 最好的是:
- Run automatically, 自动运行
- Are stored someplace other than the server that is being backed up, 存储在备份服务器以外的其他地方,
- Fast and easy to restore, 快速简便地还原,
- Don’t cost a fortune to run or keep. 无需花费大量财富即可运行或保留。
Since we are on AWS, that is very easy to accomplish.
由于我们使用的是AWS,因此非常容易实现。
计划 (The Plan)
Configure a daily event to create a backup copy of our entire EC2 instance.
配置每日活动以创建整个EC2实例的备份副本。
We will use the cron command to schedule an AWS Elastic Block Store (EBS) snapshot, which makes a point-in-time image of the entire filesystem at the time the snapshot is run, and may be used later to recover the instance in the event of a failure. Note that only AWS instances that are EBS-backed may use this method.
我们将使用cron命令安排一个AWS Elastic Block Store(EBS)快照,该快照将在运行快照时为整个文件系统创建一个时间点映像,以后可用于在快照中恢复实例。故障事件。 请注意,只有具有EBS支持的AWS实例可以使用此方法。
先决条件: (Prerequisites:)
access to your AWS Account» Security Credentials page
访问您的AWS账户 »“安全凭证”页面
access to the AWS Management Console Web GUI
root access to a running AWS EC2 EBS-backed Linux instance – for example:
对正在运行的由AWS EC2 EBS支持的Linux实例的root访问权限–例如:
ssh -i AWSKeyPair.pem ec2-user@{yourInstance_FQDN_or_IP} % sudo su root@yourInstance#
安装所需的工具 (Install the Needed Tools)
In order to do this we will need the following things:
为此,我们需要执行以下操作:
AWS X.509证书和私钥文件 (AWS X.509 Certificate and Private Key Files)
These two files allow your server to execute AWS EC2 instance commands securely.
这两个文件使您的服务器可以安全地执行AWS EC2实例命令。
![alt](https://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2011/10/aws_x509.jpg)
They are obtained from the AWS Account » Security Credentials page. Towards the bottom of the page locate three tabs: “Access Keys”, “X.509 Certificates”, and “Key Pairs”. Once found, click the middle one, “