简体   繁体   English

已安装所有内容的克隆EC2实例

[英]Clone EC2 instance with all things installed

I received a amazon email saying that i have to terminate my instance because of attacks but i worked really hard to install and setup everything on the instance. 我收到了一封亚马逊电子邮件,说我由于攻击不得不终止我的实例,但是我非常努力地安装和设置实例上的所有内容。

I've tried to create a image and on the AMI create a new instance and launch another instance like this. 我尝试创建映像,并在AMI上创建一个新实例并启动另一个这样的实例。 but it not worked. 但是没有用

So how can i create another instance with the stuff that i installed on the current instance? 那么,如何使用在当前实例上安装的内容创建另一个实例?

By the way have some way to copy everything on the instance? 顺便说一下,有没有办法复制实例上的所有内容?

Someone could please spare some hint? 有人可以保留一些提示吗?

thank's 谢谢

If the instance security is compromised you should really start from scratch. 如果实例安全性受到威胁,则应从头开始。

But if you need to access data from the older instance you can create a Volume snapshot and then attach it to the new instance. 但是,如果您需要访问旧实例的数据,则可以创建一个Volume快照,然后将其附加到新实例。

I know it's annoying to setup everything again, so I keep a shell script to configure everything remotely and I run it each time I create a new instance. 我知道重新设置所有内容很烦人,因此我保留了一个shell脚本来远程配置所有内容,并且每次创建新实例时都运行它。 If you were trying to setup a LAMP server, you could write an install.sh script with something like: 如果您尝试设置LAMP服务器,则可以编写具有以下内容的install.sh脚本:

#!/bin/sh

SERVER_IP= ...
SERVER_ADDR=ec2-user@$SERVER_IP
SERVER_PEM=/../../key.pem

sudo ssh -t -t $SERVER_ADDR -i $SERVER_PEM <<-EOF1
     sudo yum update -y
     sudo yum install -y httpd24 php56 mysql55-server php56-mysqlnd
EOF1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM