DEV Community

Cover image for Which EC2 is right for you?
Helen Anderson
Helen Anderson

Posted on • Updated on • Originally published at

Which EC2 is right for you?

Amazon EC2 provides virtual machines in the cloud and you only pay for the amount of storage you use. You can choose among several instance types that meet different use cases.

What do the letters and numbers mean?


Source: AWS re:Invent 2018 Slides

Instance family - Different instance types with resources for different use cases.

Instance generation - AWS phase out older technologies and bring in new ones with more resources using these numbers to show which is which.

Instance size - Resources go up in a linear fashion, as well as the price that goes with it.

How do I pick an instance type?


EC2 comes in a variety of instance types specialised for different roles:

  • General purpose - a balance of compute, memory and networking resources.
  • Compute optimised -ideal for compute-bound applications that benefit from the high-performance processor.
  • Memory optimised - fast performance for workloads that process large data sets in memory.
  • Accelerated optimised - hardware accelerators, or co-processors.
  • Storage optimised - high, sequential read and write access to very large data sets on local storage.

Use cases


For websites and applications. You may need an instance type with a good balance of network resources, compute and memory like the general purpose M series or T series that can 'burst' when you need it.

Big data processing

For CPU intensive tasks that need to scale up and then be shut down when the number crunching is complete. Depending on how big the data-crunching workload is the R or X series could be an option.

Video creation

For video creation services, 3D visualisations and streaming graphics-intensive applications consider the G series.

Learn more using the instance type table in the AWS Documentation.

What are the storage options?

Instance storage - The hard drive attached to the instance. It deletes when the instance is terminated.

Block storage (EBS) - Like a network hard drive that persists separately from the EC2 for databases, application hosting, and storage.

Object storage - S3 and Glacier

File storage (EFS) - a managed network file system that can be shared across multiple Amazon EC2 instances and is scalable depending on workload. By default, you can have up to 10 file systems per account per region.

How does security work?

  • For security, a public/private key pair should be generated and used when you connect.

  • Region-specific security groups can be set up as a virtual firewall which allows access to different ports.

  • Rules can only allow - you can’t specifically deny traffic with security groups

How do I pay for all this?

There are four ways to pay for Amazon EC2 instances:


  • Pay for capacity by per hour or per second.
  • No commitment.
  • Good for apps being developed or with unpredictable usage spikes.

Reserved instances

  • Provide a reservation at 75% off the on-demand price,
  • Gives you the ability to launch instances when you need them.
  • Reduced price as you need to commit to one or three-year terms and decide if you will pay 'all upfront', 'partial upfront', or 'no upfront'.

Spot instances

  • Request spare AWS EC2 computing capacity for up to 90% off the On-Demand price.
  • Flexible start and end times.
  • If you’re outbid the instance is terminated and you don't pay for the hour.
  • If you stop the instance you will pay for the hour.
  • Good for those background jobs which aren't critical.

Dedicated hosts

  • Provides capacity on dedicated physical servers.
  • Good for when can’t share capacity due to regulatory reasons or for licensing requirements.

Savings plan

  • Provides the benefits of reserved instances but with more flexibility.
  • You will need to commit to a one or three year term but can change instance type within the same family while taking advantage of savings.

How do I manage costs?

AWS provides a Cost and Usage report containing a detailed dataset including metadata about AWS services, pricing, and reservations.

This can be delivered to an S3 bucket and can be used in conjunction with AWS Athena or simply downloaded as a csv to 'slice and dice'

Getting started

To get started with EC2, the Free Tier offers 750 hours of t2 micro of EC2 compute services. If you exceed the limits the standard rates apply.

To learn more check out the 10-minute tutorials from AWS.

This post first appeared on

Discussion (4)

andrewbrown profile image
Andrew Brown 🇨🇦

Calculating Monthly Server Cost

The Most common question I get asked. So there is roughly 730 hours in a month, so you grab the pricing per hour from the On-Demand Pricing Page

So if you want t2.medium than expect to pay

0.0464 * 730 = 33.87 USD

Instances Always Double in Size

When should you upgrade to the next instance size? It easy. t2.large is double the size of t2.medium and t2.xlarge is double the size of t2.large

A good way to save money is to spin up two instance of the smaller type and then use load balancing and auto scaling group (ASG). ASG can spin up the instance only in time of need so you can keep costs low. a load blanacer (ELB) will run you around ~14 USD per month but even if you are running one EC2 instance I consider it a necessary cost for other reasons such as being able to attach WAF, ACM and Guard Duty

Burstable Instances

The T2 line (and probably also T3) has the ability to burst beyond its CPU capacity. So just like a video game where you have a special power where that bar fills up over time, T2 instances accumlate CPU credits over time, so when you go beyond you means with a spike of CPU usage you get more CPU and expend those credits. This allows you to avoid upgrading to a more expensive instance.

Take Spot and RI with a grain of salt

Spot Pricing can save up to 90% and RI (Reserved Instances) can save up to 75% but in practice you don't normally get these rock bottom prices. You do save money but for Spot Pricing its based on the demand of the market and what type of instance you use. You should expect with Spot Pricing more to be around 60-70% than the 90% and RI at 50-60% than 75%.

karimbk profile image
Karim Belkhiria

Very good explained here :)

helenanders26 profile image
Helen Anderson Author • Edited on

Thank you Andrew!

vinayhegde1990 profile image
Vinay Hegde • Edited on

This is very helpful, thanks Helen!

In case anyone here finds the AWS EC2 Pricing page confusing as I do due to the plethora of options, please check to compare between 2 or more types.