3

AMI creation takes a long time. Are there ways to make it happen faster?

E.g. perhaps by changing some of the AMI creation settings, perhaps regarding IOPS, volume type, device, etc. I don't know how to change these or if it could help. So I am not sure of any ways speed up the AMI creation process at this stage.

stevec
  • 41,291
  • 27
  • 223
  • 311

1 Answers1

6

An AMI uses the same 'backup' mechanism as a snapshot. Any blocks that are modified from the original AMI/snapshot need to be copied to Amazon S3.

So, in theory, if you launched an instance from an AMI, and then immediately made a new AMI from the instance, it should be created rather quickly because comparatively few blocks should have changed.

On the other hand, if an instance had been running for a long time and had updated lots of data on the disk, it would take longer to copy the 'changed' blocks to S3.

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.

If you experiment with this, let us know how you go!

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
  • This answer is somewhat useful. But only somewhat. The problem is I (not never, but) rarely want to make an AMI from an instance that was very recently created from an AMI. Usually, it's from an instance that's been running for some time and which I have been working on for some specific purpose. I appreciate it and will keep it in mind though. – stevec Jul 11 '19 at 17:53
  • If you take snapshots at regular intervals, the AMI creation should be quicker. – John Rotenstein Jul 12 '19 at 00:00
  • @JohnRotenstein from about 20 tests I have done over the past 2 days, your theory seems very on point. An AMI set up from an instance that was a few weeks old took >10 minutes. Whereas identical AMIs made from that very same instance took ~1 minute. Great knowledge – stevec Jul 13 '19 at 08:08
  • @JohnRotenstein Do you know if checking the 'No Reboot' option when creating an AMI makes a difference? – stevec Jul 17 '19 at 16:33
  • 1
    The "No Reboot" option would have no impact on AMI creation time. It simply controls whether the instance restarts the operating system, creating the AMI while the OS is not running. It provides a consistent snapshot. Otherwise, it's a bit like pulling the power plug out of a computer, which then has to do extra clean-up work when it next starts. – John Rotenstein Jul 17 '19 at 22:04