Creating an AMI

An Amazon Machine Image (AMI) is a master image used for creating virtual servers on the Amazon cloud. An AMI contains instructions to launch an EC2 instance, and includes information pertaining to an operating system, a machine architecture of 32 bit or 64 bit, the software stack of your applications, launch permissions, disk sizes, and so on. Typically, you will start with a basic AMI provided by Amazon, the user community, or the marketplace, and then customize it as per your requirements. You can also create an AMI from a pre-existing EC2 instance.

An AMI is a prerequisite for creating and using an auto scaling group. The way it works is that whenever a scale out is required, auto scaling uses the AMI to create an EC2 instance and adds it to the group. We will use the A1ElectronicsEcommerce instance that we created in Chapter 3AWS Components, Cost Models, and Application Development Environments, to create the AMI:

  1. From the EC2 navigation pane, click on Instances to view all your EC2 instances. Select the A1ElectronicsEcommerce instance and then right-click to view all the actions you can perform on the selected instance. Select Image and then click on the Create Image option from the menu to create an AMI:
  1. The next step is to name the AMI and allocate some disk space to it. On this screen, you only need to be aware of the following configuration parameters:
    • No reboot: By default, Amazon EC2 shuts down the instance and takes a snapshot of attached volumes and then creates and registers the AMI. If this option is checked then the EC2 instance will not shut down, and the integrity of the filesystem cannot be guaranteed while creating the AMI.
    • Delete on Termination: During Auto Scaling, the EC2 instance will be created and terminated depending on the configured metrics. During the launch of an EC2 instance, the EBS volumes will be created and referenced by the AMI (in our case, it is the Root volume), and when the EC2 instance is terminated the associated volume is not deleted, so over a period of time you could have many EBS volumes for which you are unnecessarily paying. As our application is stateless and does not store any user data on the EBS volume, we can safely delete the EBS volume at the same time as the instance.

Now, click on the Create Image button:

  1. You should see the following message. Click on the Close button:

You should see the AMI listed with the Status as available, which you can see in the following screenshot:

In the next step, we will create the ELB for our application.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.172.146