Creating a Custom AMI in AWS
Recommended by 0 users
Create a Custom AMI
An Amazon Machine Image (AMI) provides the information required to launch an instance, which is a virtual server in the cloud. You specify an AMI when you launch an instance, and you can launch as many instances from the AMI as you need. You can also launch instances from as many different AMIs as you need.
The sole purpose of this tutorial is to customize an existing AMI and to understand the procedure involved in it.
AWS OpsWorks supports two ways to customize instances: custom Amazon Machine Images (AMIs) and Chef recipes. Both approaches give you control over which packages and package versions are installed, how they are configured, and so on. However, each approach has different advantages, so the best one depends on your requirements.
The following are the primary reasons to consider when using a custom AMI:
- You want to prebundle specific packages instead of installing them after the instance boots.
- You want to control the timing of package updates to provide a consistent base image for your layer.
- You want instances—load-based instances in particular—to boot as quickly as possible.
Now that we have customized our Amazon EC2 instance using the Amazon Machine Image (AMI), we can save and launch future environments with this configuration. AMI is specified while launching an instance and as many instances as you need can be launched.
To create an AMI from a running Amazon EC2 instance
- Open the Amazon EC2 console at https:// console.aws.amazon.com/ ec2/.
- In the Navigation pane, in the Region list, click US East (Virginia).
- In the Navigation pane, click Instances.
- On the Instances page, right-click your running instance, and then click Create Image (EBS AMI).
- In the Create Image dialog box, fill in a unique image name and an optional description of the image (up to 255 characters), and then click Create This Image.
Amazon EC2 terminates the instance, takes images of any volumes that were attached, creates and registers the AMI, and then relaunches the instance.
- In the Navigation pane, click AMIs.
- View the status of the AMI.
- While the new AMI is being created, its status is pending.
- Record the AMI ID; as you might need it in a later task.
It takes a few minutes for the whole process to finish and for AMI to be created. Once it is finished, it appears in AMIs view in AWS explorer.
- When the status of your AMI changes to available, go to the Snapshots page by clicking Snapshots in the Navigation pane. View the new snapshot that was created for the AMI. Any instance, that you launch from the new AMI uses this snapshot as its root device volume.
Eventually, you’ll probably want to have multiple Amazon EC2 instances running across multiple Availability Zones. If one Availability Zone becomes unavailable, the traffic will be rerouted to another Availability Zone. An Elastic Load Balancer will enhance the availability of your application, whether all of your instances are in the same Availability Zone or in multiple Availability Zones. To create an Elastic Load Balancer, move on to further post Create an Elastic Load Balancer.