AMAZON MACHINE IMAGE (AMI)— AWS Solution Architect Associate Series — Part 7

Ata Erdemir
8 min readFeb 15, 2024

--

When bringing up an Instance on AWS, we do it through EC2 when bringing up an AMI. If you’ve noticed, you’ll see a pattern like AMI-asd02230d2. These are referred to as AMAZON MACHINE IMAGES. They have some functions included. They are listed below:

1. Root Volume Template

1.2. OS (operating system)

1.3. Pre-installed applications

2. Installation/Boot permissions
3. Preventing Device Matching

Here, when installing, expressions like t1, t2, a1 mean “instance type”. Expressions like small or medium next to them indicate their capacities.
Types of cloud servers consist of a prefix that identifies the workload type they are optimized for, followed by a size. For example, the cloud server type c5n.xlarge can be broken down as follows:

First position — The first position, c, specifies the instance family. This indicates that this instance belongs to a family optimized for processing.
Second position — The second position (5) indicates the generation of the instance. This instance belongs to the fifth generation.
Letters remaining before the period — In this case, n specifies additional features such as local NVMe storage.
After the Period — After the period, xlarge specifies the instance size. In this case, it is large.

EC2 Family

General Purposes:
General-purpose cloud servers balance computing, memory, and network resources and can be used for various workloads. As a usage scenario, they are ideal for applications that evenly utilize these resources, such as web servers and code repositories.

Compute Optimized:
Compute-optimized instances are ideal for compute-intensive applications that benefit from high-performance processors. Usage scenarios include batch processing workloads, media encoding, high-performance web servers, high-performance computing (HPC), scientific modeling, dedicated gaming servers, ad serving engines, machine learning inference, and other compute-intensive applications.

Memory Optimized:
Memory-optimized instances are designed to provide fast performance for workloads processing large datasets in memory. Applications that heavily use memory, such as high-performance databases, distributed in-memory caches for web scaling, medium-sized in-memory databases, real-time big data analytics, and other enterprise applications, benefit from memory-optimized instances.

Accelerated Computing:
Accelerated computing instances use hardware accelerators or auxiliary processors to perform functions such as floating-point calculations, graphics processing, or data model matching more efficiently than possible in software running on CPUs. Usage areas include machine learning, HPC, computational fluid dynamics, computational finance, seismic analysis, speech recognition, autonomous vehicles, and drug discovery.

Storage Optimized:
Storage-optimized instances are designed for workloads requiring high sequential read and write access to large datasets in local storage. They are optimized to provide tens of thousands of low-latency random I/O operations per second (IOPS) to applications that copy their data across different instances. Usage includes NoSQL databases (Cassandra, MongoDB, and Redis), in-memory databases, horizontally scalable transactional databases, data warehousing, Elasticsearch, and analytics.

HPC Optimized:
High-performance computing (HPC) cloud servers are specially designed to offer the best price-performance for running HPC workloads at scale on AWS. Ideal for applications benefiting from high-performance processors, such as large, complex simulations and deep learning workloads.

Architecting for High Availability

For performance and highly available service, it’s crucial to plan our infrastructure accordingly. If you aim to provide a high-performance, highly available service on AWS, it’s recommended to utilize at least 2 Availability Zones by AWS in practice. Supporting your infrastructure with multiple EC2 instances within each Availability Zone helps to establish a sort of cluster architecture, mitigating losses and ensuring high availability.

EC2 Life Cycle

Under this heading, we’ll take a closer look at the lifecycle of the “Instance,” or virtual servers, that we deploy on AWS. If you’re curious about what happens in the background when we say “Launch,” the diagram below, prepared by AWS, illustrates the process.

Pending:
At this stage, the “Instance” with your chosen operating system is being prepared for launch. To put it in real-world terms, think of it as the process of booting up your laptop. In this case, it’s equivalent to booting up a virtual computer. In other words, the Pending stage is where AWS performs all the necessary actions to set up a cloud server, such as copying the AMI content to the root device and allocating required network components.

Running:
This stage marks when the “Instance” has been launched and is running, also signaling the beginning of billing. During this stage, actions can be performed on the “Instance.”

Rebooting:
When you reboot an “Instance,” it differs from performing a stop and then a start action. Rebooting an instance is equivalent to restarting the operating system. The “Instance” retains its public DNS name (IPv4) and both private and public IPv4 addresses. If there’s an IPv6 address, it remains on the same host, and it preserves both public and private IP addresses in addition to the data on the instance storage volumes.

Stopping:
When you stop an “Instance,” it enters the stopping and then stopped state. This is similar to shutting down your laptop. You can stop and start a cloud server. When you stop and then start an “Instance,” it may be placed on a new underlying physical server. Your instance retains private IPv4 addresses, and if your instance has an IPv6 address, it retains the IPv6 address. When you put an “Instance” into a stop-ready state, it enters the stopped state but saves the instance’s last information or content to memory, allowing for a faster start-up process.

Terminate:
When you terminate an “Instance,” the instance storage volumes are deleted, and you lose both the public and private IP addresses of the machine. Terminating an “Instance” means you no longer have access to the machine. When the status of a cloud server changes to shutting down or terminated, you stop being charged for that cloud server.

Pricing of Instances

On-Demand Instance:
You pay for compute capacity by the hour or second depending on the instances you run on the cloud servers. This is the default and generally used method. There are no long-term commitments or upfront payments required. Billing starts when the cloud server is running, and billing stops when the cloud server is stopped or terminated. You can scale your compute capacity up or down to meet the demands of your application and pay only for the cloud servers you use at the specified hourly rates.
On-Demand Instances are recommended for the following use cases:

Users who prefer the low cost and flexibility of Amazon EC2 without upfront payments or long-term commitments.

Applications with short-term, spiky, or unpredictable workloads that are not interrupted.

Applications developed or tested for the first time on Amazon EC2.

Spot Instance:
Amazon EC2 offers Spot Instances for applications with flexible start and end times. With Amazon EC2 Spot Instances, you can request spare Amazon EC2 compute capacity at discounts of up to 90% off the On-Demand price. Spot Instances are recommended for the following use cases:

Applications with flexible start and end times.

Applications that can only be run at very low compute prices.

Users with fault-tolerant or stateless workloads.

You set a price limit for how much you want to pay per cloud server hour with Spot Instances. This is compared to the current Spot price set by AWS. Spot Instance prices are adjusted gradually based on long-term trends in supply and demand for Spot Instance capacity. If the amount you pay exceeds the current Spot price and capacity is available, you get the instance.

Saving Plans:
Saving Plans are a flexible pricing model that offers low usage prices for a one-year or three-year commitment for consistent usage amounts. Saving Plans apply to Amazon EC2, AWS Lambda, and AWS Fargate usage and provide savings of up to 72% on AWS compute usage.
Saving Plans can offer significant savings compared to On-Demand Instances for workloads with predictable and consistent usage. Saving Plans are recommended for the following use cases:

Workloads with consistent and steady-state usage.

Customers who want to use different types of cloud servers and compute solutions in different regions.

Customers who can commit to using Amazon EC2 for 1-year or 3-year terms.

Reserved Instances:

Amazon EC2 offers Reserved Instances for applications with steady-state usage that may require dedicated capacity. With this option, you can save up to 75% compared to On-Demand pricing. You can choose from three payment options: All Upfront, Partial Upfront, or No Upfront. You can choose a one-year or three-year term for each of these options.
Reserved Instances allow you to choose the most appropriate type for your application needs.

Standard Reserved Instances: These provide the most significant discount (up to 72% off On-Demand pricing) and are best suited for steady-state usage.

Convertible Reserved Instances: These offer a discount (up to 54% off On-Demand pricing) and allow for changing the specifications of the Reserved Instance if it results in creating Reserved Instances of equal or higher value through a modification. Like Standard Reserved Instances, Convertible Reserved Instances are also best suited for steady-state usage.

Scheduled Reserved Instances: These can be started at reserved times. With this option, you can match your capacity reservation with a predictable recurring schedule that requires only a portion of a day, a week, or a month.

Dedicated Host:
A Dedicated Host is a physical Amazon EC2 server dedicated to your use. Dedicated Hosts can help reduce costs because you can use existing software licenses tied to the host, such as Windows Server, SQL Server, and Oracle licenses. They can also help you meet compliance requirements. Amazon EC2 Dedicated Host is integrated with AWS License Manager, a service that helps you manage your software licenses, including Microsoft Windows Server and Microsoft SQL Server licenses.

Dedicated Servers can be purchased on demand (hourly).

Dedicated Servers can be purchased as a Reservation with discounts of up to 70% off On-Demand pricing.

The next topic will be about Creating Employee Directory Application.

Have fun!

--

--