Managing EC2 AMIs – Provisioning Resources – SOA-C02 Study Guide

Managing EC2 AMIs

An EC2 AMI, or Amazon Machine Image, is used to launch an EC2 instance. You can manage AMIs via the Management Console by navigating to Services > EC2 > Images > AMIs. Once there, the following options are available:

Launch: Launch an EC2 instance from a selected AMI.

EC2 Image Builder: Build an AMI (that is, image) using a guided wizard provided by the Management Console.

Actions: This provides additional EC2 options, including the ability to copy an existing AMI and deregister an AMI.

Access the AWS Marketplace: Clicking the Find More Than 500 AMIs of Popular Open Source and Commercial Software From link takes you to the AWS Marketplace where other organizations have provided customized AMIs. These AMIs are broken into different categories, such as Business Applications, DevOps, and Machine Learning. Although some of these AMIs are free to use, many have some sort of fee associated with them.

ExamAlert

For the exam, be aware that you can create your own AMIs or deploy AMIs from the AWS Marketplace. Also, be aware that in addition to the charges incurred for having the AWS instance run, AMIs from the AWS Marketplace often have an additional cost, like a license fee.

AWS CloudFormation

Imagine a scenario in which you must routinely provision a collection of resources. For example, maybe each developer within your organization needs to have an EC2 instance in which to perform their work. The tedious task of managing these resources takes valuable time from your staff, resulting in higher employee costs.

Additionally, manually configuring systems sometimes results in misconfigurations caused by human errors. These misconfigurations are even more likely in a scenario in which a more complex collection of resources needs to be provisioned. For example, imagine your organization needs to routinely provision three EC2 instances within its own VPC, along with a Security Group and a Load Balancer.

AWS CloudFormation, an Infrastructure as Code (IaC) solution, is designed to make the managing of AWS Resources less time consuming. This is handled using CloudFormation templates, which are JSON- or YAML-formatted files that describe the details of the resources that you want to provision. The template is a key component to a CloudFormation Stack, which is the resource in CloudFormation that performs the provisioning operation when executed.

A complete CloudFormation template can contain hundreds of lines to define all of the parameters of the resources that you want to provision. The following simple example using YAML format provisions an EC2 instance:

Click here to view code image

Resources:

WebAppInstance:

Type: AWS::EC2::Instance

Properties:

ImageId: ami- 6d1c2007f840b45e9

InstanceType: t2.micro

The same resource can be provisioned using a JSON-formatted file, like the following:

Click here to view code image

{

“Resources”: {

“WebAppInstance”: {

“Type”: “AWS::EC2::Instance”,

“Properties”: {

“ImageId”: “ami- 6d1c2007f840b45e9”,

“InstanceType”: “t2.micro”

}

}

}

}