Search code examples
amazon-web-servicesamazon-ec2amazon-ami

Is it possible to automate the creation of AMIs in AWS?


These are steps I found in an AWS document: You can create an AMI using the AWS Management Console or the command line.

The following diagram summarizes the process for creating an Amazon EBS-backed AMI from a running EC2 instance. Start with an existing AMI, launch an instance, customize it, create a new AMI from it, and finally launch an instance of your new AMI.

Is it possible for these to be automated? I am not sure which service to use at the moment or if it even is possible. any ideas appreciated


Solution

  • There are many ways to build an AMI. An AMI is built through creating an image of an existing instance.

    This instance can be configured manually or using a configuration tool (such as Ansible, Chef or Puppet).

    By using the tools you can automate the build of your servers to always follow a suite of instructions that are reproducible. A workflow known as pre-baked/golden AMIs involves running these configuration tools over a new server and then create the image from that server. This would then be rolled out replacing other servers.

    Amazon have a blog post on the Golden AMI Pipeline that helps to explain how this can be automated.

    AWS also have recently launched a tool named the EC2 Image Builder which allows full automation as well a validation of the AMI after it has been created.