How to create an AMI Image in AWS

In my next AWS article I wanted to cover creating custom AMI Images.  Creating images in AWS can be time saving by having all of your base requirements completed and ready to go for faster deployments.  Think of them like VMware templates in vCenter for my VMware people out there.

Previous article on creating an EC2 instance:

Below you will see the output from going to the webpage to confirm the expected results.  When we deploy a new instance from the image, we should see the same results without having to script it like before.

Web page served by the source EC2 instance before creating the reusable AMI.
EC2 Instances page with a running instance selected and Image, Create Image chosen from the Actions menu.

Right click on the instance or click the actions button.  Image > create image

Create Image dialog with the AMI name, description, root volume, and snapshot settings.

Takes snapshot of the root directory where files are stored

EC2 confirmation dialog showing the create image request was received and the AMI is pending.
EC2 AMIs page showing the newly created image with available status.

Since we want to test the results to see if we get the same output on a webpage or any output, lets deploy a new instance from the image.

EC2 AMIs page with the new image selected and Launch chosen from the Actions menu.

Once you right click and launce image the same wizard we all love will appear.  Here is where you could customize the instance, for example put it in a different subnet.

EC2 launch wizard showing the instance type selection for the AMI-based instance.
EC2 launch wizard Configure Instance Details step for the new instance created from the AMI.
EC2 launch wizard Add Storage step showing the root volume inherited from the AMI.

Snapshot is your AMI

EC2 launch wizard Add Tags step for an instance created from the AMI.
EC2 launch wizard configuring the security group for an instance created from the AMI.

I advise putting it into the same SG as before unless this instance will be associated with a different project.

EC2 launch review page summarizing the instance type, security group, storage, and other settings.

Launch

EC2 launch dialog with an existing key pair selected and access to the private key acknowledged.

Now we can launch the instance.

Web browser showing the expected page served by the EC2 instance launched from the new AMI.

Now we take the public IP of the new instance and place it into a web browser.  As expected, we got the exact same results.

Summary:
As you can see creating an image is relatively easy but also it saves a large amount of time by not having to script the full install of apache and creating the web page content.  As always, I hope y’all found this useful.

Leave a Reply

Discover more from Digital Thought Disruption

Subscribe now to keep reading and get access to the full archive.

Continue reading