Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating AMI takes so long

I'm creating an AMI for a server with 100G files. It's been like an hour and it's still not finished. (The AMI still says pending) Is there something wrong with it? What should I do?

like image 925
jackhao Avatar asked Sep 29 '13 05:09

jackhao


People also ask

How long does it take for an AMI to be created?

Depending on the size of the volumes, it can take several minutes for the AMI-creation process to complete (sometimes up to 24 hours). You might find it more efficient to create snapshots of your volumes before creating your AMI.

How do you speed up AMI creation?

You should be able to speed the AMI creation process by taking a recent snapshot of the volume, which would copy the changed blocks to S3. Then, when making an AMI soon after, there would be rather few blocks changed.

How long does it take to copy AMI?

Even now in 2018 a 100GB AMI takes over an hour to complete. Interestingly, a 30GB AMI takes only ~5 minutes usually, so the time taken seems to increase exponentially with size.

How much does it cost to create an AMI?

You are only charged for the storage of the bits that make up your AMI, there are no charges for creating an AMI. EBS-backed AMIs are made up of snapshots of the EBS volumes that form the AMI. You will pay storage fees for those snapshots according to the rates listed here.


2 Answers

Alright so at this moment this seems like a stupid question. But I was very worried during that time :-)

Just to let other people know, this process could take very, very long. My 100 GB AMI takes like 2.5 hours to create and the progress bar jumps from 0 to 100 directly after that. So don't worry.

like image 157
jackhao Avatar answered Oct 06 '22 00:10

jackhao


This answer pertains to a retirement situation where there is potentially a hardware failure for an instance with a EBS root volume. In this situation, AWS recommends creating an AMI of the instance to be retired, and starting a new instance from this AMI. In my situation, the instance was not responding before starting the AMI creation process.

The AMI creation step failed to complete after >8 hours.

I next tried stopping the instance. This also failed to complete in >10 minutes, so I tried force stopping the instance (by issuing the stop command again). The force stop did complete after a few minutes. After the instance was stopped, the AMI creation succeeded in <10 minutes.

This AWS forum message seemed relevant to my case: https://forums.aws.amazon.com/thread.jspa?messageID=372982&#372982

like image 33
mattm Avatar answered Oct 06 '22 00:10

mattm