DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Vineet K
Vineet K

Posted on

So what is Amazon EC2 then..?

AMIs and Instances

  • Amazon Machine Image (AMI) is a template that consists of software configurations. Think of it like a blueprint for your instances.

  • Instance is a copy of AMI that runs as a virtual server on the cloud.

  • Launch instance of any type from an AMI.

  • The root device for your instance contains an image that is used to boot the instance. This root device is either an Amazon Elastic Block Store (Amazon EBS) volume or an instance store volume.

Types of EC2 instances

βœ”οΈ General purpose instances:

  1. They provide a balance of compute, memory and networking resources.
  2. It’s use case scenarios include:
    • Application servers
    • Backend servers for enterprise applications
    • Gaming servers
    • Small and medium databases

πŸŽ› Compute optimized instances:

  1. These types of instances are ideal for compute intensive tasks like -
    • Dedicated gaming servers
    • High performance web & application servers
    • Scientific modelling
  2. These are also ideally used for batch processing workloads which requires processing many transactions in a single group.

⏱ Memory optimized instances:

  1. These serve workloads that process large datasets in the memory.
    • Memory is basically a temporary space that holds all the data and instructions required by the CPU to process.
    • So before a program or software on any machine is able to run, all the necessary and required data/instructions are preloaded into the memory from the storage and is directly accessible to the CPU for processing.
  2. Say your requirement is to have a large unstructured data to be pre-loaded (so that your application gets performant by faster data processing) before running any application, then Memory optimized EC2 instances should be your ideal choice.

πŸ’Ύ Storage optimized instances:

  1. These are specifically designed for workloads that consist of high, sequential read and write access to large datasets on local storage.
  2. It’s use case scenarios include:
    • Distributed file systems
    • Data warehousing applications
    • High-frequency online transaction processing (OLTP) systems.
  3. In the computer world, we use the term Input Output Operations per Second(IOPS) as a metric to measure the performance of a storage device.
  4. Say you want to host an application that involves data entered into the database(input) and then analyse this data as output, you need a machine with high IOPS requirement that can in-turn provide faster low-latency results.

🚝 Accelerated computing instances:

  1. These instances use hardware accelerators or co-processors to perform intensive tasks more efficiently than running them on traditional CPUs.
  2. Its use case scenarios include:
    • Floating point number calculations
    • Graphics processing
    • Data pattern matching
    • Game and video streaming
  3. In the computer world, a hardware accelerator is a component that can speed up data processing.

Now let's talk about money too 😏

Amazon EC2 pricing models

With Amazon EC2, you pay only for the compute time that you use.

The pricing options are as follows:

On-demand

  • Ideal for irregular workloads that cannot be interrupted and for applications with unpredictable usage patterns.
  • No upfront costs or minimum contracts apply.

Savings plan

  • It enables us to reduce compute costs by committing to a consistent amount of compute usage for a 1-year or 3-year term.
  • Any usage up to the commitment is charged at the discounted plan rate (for example, $10 an hour). Any usage beyond the commitment is charged at regular On-Demand rates.
  • It can give savings of up to 66% over On-Demand costs.

Reserved instances

🚧 Work in progress...

Spot instances

  • Ideal for workloads with flexible start and end times; or that can withstand interruptions - example if you have a background processing job like a customer survey that you can manually start or stop at any time without affecting the overall operations of your business. If you make a spot request and if the capacity is available, the instance launches immediately. If the capacity is not available, the launch is delayed until available. Moreover, once the instance is launched and there is no more capacity left for other requests, any further increase in demand/requests can impact your launched instance but it does not effect you background job processing.
  • These types of instances are basically unused Amazon EC2 computing capacity.
  • These can offer you cost savings at up to 90% off of On-Demand prices.

Dedicated hosts

  • These are physical servers with Amazon EC2 instance capacity that is fully dedicated to your use.
  • You can use your existing per-socket, per-core, or per-VM software licenses to help maintain license compliance.
  • You can purchase On-Demand Dedicated Hosts and Dedicated Hosts Reservations.
  • These are the most expensive among all.

Scaling Amazon EC2

Amazon EC2 Auto-scaling enables you to automatically add or remove EC2 instances depending upon the changing application demand.

There are two approaches to scaling Amazon EC2:

  • Dynamic scaling: responds to changing demand
  • Predictive scaling: automatically schedules the right number of Amazon EC2 instances based on predicted demand.

Auto-scaling group:

It is a logical grouping of Amazon EC2 instances for the purposes of auto scaling and management

  • Both maintaining the number of instances in the auto scaling group and the automatic scaling are the core functionality of the Amazon EC2 auto-scaling service.

Scaling configurations:

When you create an Auto Scaling group, you can set the minimum number of Amazon EC2 instances. The minimum capacity is the number of Amazon EC2 instances that launch immediately after you have created the Auto Scaling group.

You can set the desired capacity at two Amazon EC2 instances even though your application needs a minimum of a single Amazon EC2 instance to run.

  • If you do not specify the desired number of Amazon EC2 instances in an Auto Scaling group, the desired capacity defaults to your minimum capacity.
  • The size of an Auto Scaling group depends on the number of instances that you set as the desired capacity. You can adjust its size to meet demand, either manually or by using automatic scaling.

The third configuration that you can set in an Auto Scaling group is the maximum capacity. For example, you might configure the Auto Scaling group to scale out in response to increased demand, but only to a maximum of four Amazon EC2 instances.

You can use scaling policies to increase or decrease the number of instances in your group dynamically to meet changing conditions. When the scaling policy is in effect, the Auto Scaling group adjusts the desired capacity of the group, between the minimum and maximum capacity values that you specify, and launches or terminates the instances as needed.

Because Amazon EC2 Auto Scaling uses Amazon EC2 instances, you pay for only the instances you use, when you use them.

Elastic Load Balancing

Elastic Load Balancing automatically distributes your incoming traffic across multiple targets, such as EC2 instances, containers, and IP addresses, in one or more Availability Zones.

  • Using a load balancer increases the availability and fault tolerance of your applications.
  • It monitors the health of its registered targets, and routes traffic only to the healthy targets.
  • It scales your load balancer as your incoming traffic changes over time.

To use Elastic Load Balancing with your Auto Scaling group, attach the load balancer to your Auto Scaling group. This registers the group with the load balancer, which acts as a single point of contact for all incoming web traffic to your Auto Scaling group.

Limitations

  • The load balancer and its target group must be in the same Region as your Auto Scaling group.
  • The target group must specify a target type of instance. You can't specify a target type of ip when using an Auto Scaling group.

Phew 😡, that was a lot around EC2..!!
But I know it's worth noting them all...😍

Top comments (1)

Collapse
 
lstan44 profile image
Stanley Lalanne

Hey, nice post.. you break down AWS EC2 in details.

πŸ€” Did you know?

🌚 You can turn on dark mode in Settings