Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to duplicate an AWS EC2 instance without any downtime?

I've got an AWS EC2 instance that I would like to create a spin off of in order to do some testing. I know I can create an AMI of the running instance, then launch that. But when I create the AMI, the machine goes down for a couple minutes (at least the network connection).

Is there a setting somewhere that I am missing?

I generate the AMI by right clicking the machine in the management console and selecting "Create AMI."

Thanks

like image 247
Tyler DeWitt Avatar asked Feb 08 '12 18:02

Tyler DeWitt


People also ask

Can you duplicate an EC2 instance?

There is no clone feature available in AWS EC2 service. However, you can create an image of your EC2 instance and create a new instance out of that image. You can use the Amazon Machine Image (AMI) feature of EC2 service to create an image of your EC2 instance.

Can I upgrade EC2 instance without downtime?

Upgrading an EC2 Instance with Zero DowntimeThe best way to achieve a zero-downtime upgrade is with a blue/green deployment. This involves creating a new instance of the desired tier, readying it for production, swapping traffic over to it, then terminating the old instance.

How do you replicate AWS instance?

Log in to the AWS Management Console. If required, use the region selector in the top right corner to switch to the region where your instance was launched. Select your instance and then select the “Create Image” option in the “Actions” menu.

What happens when EC2 instance is stopped and started again?

When you stop an instance, we shut it down. We don't charge usage for a stopped instance, or data transfer fees, but we do charge for the storage for any Amazon EBS volumes. Each time you start a stopped instance we charge a minimum of one minute for usage. After one minute, we charge only for the seconds you use.


2 Answers

No. Not in a technical sense. The machine must reboot when you create an AMI. You are not losing network connection, your machine is actually restarting.

One thing you could do is copy your disk to another disk, but that is not easy to do.

Amazon EC2 powers down the instance, takes images of any volumes that were attached, creates and registers the AMI, and then reboots the instance. -http://docs.amazonwebservices.com/AWSEC2/2011-05-15/UserGuide/index.html?Tutorial_CreateImage.html

EDIT: I am looking at this answer again, and AWS now has the ability to check "no reboot" when creating an AMI. This is probably not a great idea for volumes with a lot of writes, but it is nice to have.

like image 96
chantheman Avatar answered Oct 07 '22 01:10

chantheman


Amazon now allows a "no-reboot" option when creating an AMI, presented in a checkbox. However, the "file system integrity on the created image can't be guaranteed" so you'll have to weigh the integrity vs. downtime.

  • http://docs.amazonwebservices.com/AWSEC2/2011-05-15/UserGuide/index.html?Tutorial_CreateImage.html

  • http://docs.amazonwebservices.com/AWSEC2/latest/CommandLineReference/ApiReference-cmd-CreateImage.html

like image 42
jhchen Avatar answered Oct 06 '22 23:10

jhchen