Search code examples
dockeramazon-ami

How to create AWS AMI from set of instructions/script like Dockerfile?


Is there any way that we can create AWS AMI from the set of defined steps/instructions like Dockerfile?

I usually create the AMI from the running EC2 instance. The problem is that anything inside that AMI is quite hidden. It's hard to tell the team how the AMI was built and what libs and/or programs have been installed on the AMI. We have to maintain a separate document to describe what has been done on the AMI. And the changes between each AMI version are also not transparent. We have to document everything to achieve that.

I wouldn't have to write the AMI document if it can be done like in the Dockerfile. It's self-documented for developers about that image.


Solution

  • Putting the "user data" of Ec2 in Cloudformation doesn't quite the right solution for me. It's still rerun the process every time I launch the EC2 instance.

    I just came across one service called "Image builder" which is exactly what I want. It also provides a way that we can test the image as well. https://aws.amazon.com/image-builder/