Set the AMI

Aug 2017
|

Standard AMI

An AMI is an Amazon Machine Image. This is a list of Operating Systems that you can have automatically installed when you create an EC2 Instance. An AMI can be thought of as an Image of an OS that is applied to your EC2 Instance, rather than going through a scripted installation from scratch. See a small AMI list below:
I have not found anywhere that lists all of the available AMIs and their IDs, I can see why because it is a rather long list and AMI numbers change between AZs as well (make note of that, your script will not work in any AZ just by changing the region value, you will need the AMI value for that region as well.)

Custom AMI

As well as the standard AMIs you can use Custom AMIs. A custom AMI can be something you have created, or it can be a community generated AMI. Please investigate carfully what costs might be associated with using a community AMI.
An example of using your own AMI might be that you created an EC2 instance, installed some software on it and did some configuration. This might have taken some time to perform. Well you can select your EC2 and create an AMI from it. You can then use this AMI to create more instances that will have all of the software and settings you want, automatically applied to each new instance, or automatically applied each time the instance is removed and re-created.
For this example, in the London AZ, lets say I am going to use the following AMI.

Red Hat Enterprise Linux 7.3 (HVM), SSD Volume Type - ami-40a8bf24

So my script will contain the following entry:

ami = "ami-40a8bf24"