问题
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.
回答1:
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!
来源:https://stackoverflow.com/questions/56971950/how-to-speed-up-creation-of-ami-amazon-machine-image