1
votes

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

2

2 Answers

4
votes

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.

0
votes

I think the best tool you can try among the existing tool is packer. Out of the box, Packer comes with support to build images for Amazon EC2, CloudStack, DigitalOcean, Docker, Google Compute Engine, Microsoft Azure, QEMU, VirtualBox, VMware, and more.

Modern, Automated

HashiCorp Packer automates the creation of any type of machine image. It embraces modern configuration management by encouraging you to use automated scripts to install and configure the software within your Packer-made images. Packer brings machine images into the modern age, unlocking untapped potential and opening new opportunities.

Here is repo that contain complete life cycle

This Packer AMI Builder creates a new AMI out of the latest Amazon Linux AMI, and also provides a cloudformation template that leverages AWS CodePipeline to orchestrate the entire process. packer

enter image description here

All you need

git add .
git commit -m "SHIP THIS AMI"
git push origin master

ami-builder-packer

This Packer AMI Builder creates a new AMI out of the latest Amazon Linux AMI, and also provides a cloudformation template that leverages AWS CodePipeline to orchestrate the entire process.

Also packer provide cross-cloud service provider AMI builder AWS, Azure and Google cloud etc.