1. What is an Amazon EC2 Instance?
EC2 is short for Amazon Elastic Compute Cloud. But what does that mean?
Basically, an EC2 instance is a virtual server that replaces on-site, physical hardware. In a matter of minutes, you can spin up and configure an EC2 instance—or hundreds of them—with just a few clicks. The process is pretty simple: select an instance image (called an AMI), choose an instance type based on desired performance, and then add any storage needed.
Join other Dev’ops who love Metricly !
Get the monthly DevOps newsletter that rules them all.
Don’t like your settings?
They can be changed with ease. You just have to remember that when you terminate an EC2, your ephemeral storage (the storage that is part of your EC2) is erased, but if you use an Elastic Block Storage (EBS) then you can reattach your storage volume to the new EC2 once launched. You can also migrate certain instance types to other, better-suited performance families. The flexibility of changing EC2s ensures that you don’t have to fear spikes in usage or overpay for underused equipment.
What are the benefits of using EC2’s?
There are several benefits to migrating to EC2 instances. Here are just a few:
- Elasticity: Capacity needs can be met within a few minutes.
- Control: Keep root access for your instances. Stop or terminate instances via the API.
- Reliability: Amazon commits to an EC2 Service Level Agreement of 99.99%
- Cost: Choose from several payment models to get the most affordable rate.
Are all EC2s the same?
With every configuration accounted for, there are over 400,000 different iterations of EC2. For now, we’ll stick to the basic differences you might come across when provisioning or working with EC2s.
More than
60%
Lorem ipsum dolor sit amet
There are
25M
Lorem ipsum dolor sit amet
More than
80%
Lorem ipsum dolor sit amet
AMIs
Amazon provides a list of 35 stock AMIs for you to choose from. These range from Amazon Linux, to Ubuntu, to Microsoft Windows Server, and even a Deep Learning AMI. If you can’t quite find what you’re looking for, there’s also a marketplace for selling and buying custom AMIs.
Instance Families
EC2s are primarily categorized by performance family:
| Instance Families | Example |
|---|---|
| Accelerated Computing | F1 instances have Field Programmable Gate Arrays (FPGA) that allow you to create a customized hardware acceleration platform for your application. |
| Compute optimized | C5d instances use the Intel Xeon Platinum 8000 series (Skylake-SP) processor that can reach a Turbo CPU clock speed of 3.4GHz. |
| General Purpose | Offers instances with burstable CPU with T2 and T3 |
| Memory Optimized | High Memory Instances can contain up to 12 TB of memory and utilize bare-metal performance with direct access to host hardware. |
| Storage Optimized | D2 Instances can provide up to 3.5 GBps read / 3.1 GBps write disk throughput. |
Instance Types
Within those greater families are unique instance types. Here’s a list of instance types for just the General Purpose Family:
Notice that T2, T3, M4, M5, and M5d are the different instance types, each having varying sizing options that range from nano to 24xlarge. From left to right, these instance types go from oldest to newest in generation. Over time, AWS deprecates the older generations.
If you’d like a full breakdown on instance types, skip to our more in-depth section titled All About Instance Types.
It’s important to pick carefully when choosing your AMI, Instance Family, and Instance type. All three of these components factor greatly when determining the overall price per hour Amazon charges you.
Speaking of pricing, let’s take a look at amazon’s pricing options.
One of the most important things when choosing an EC2 instance, is picking the correct workload. Without that, you’re flying blind, and have no way to tell if something will need to be changed!
Brian Spindler
VP Engineering @ Metricly
2. EC2 Instance Pricing Options
When it comes to paying for Amazon Web Services, there are four main purchasing options: On-demand Instances, Reserved Instances, Spot Instances, and Dedicated Hosts. Each pricing option is tailored to benefit a particular usage behaviour.
Properly evaluating your environment to determine the best payment method for each instance is crucial to avoiding wasteful spending. But be careful not to get too aggressive when trying to save--choosing the cheapest available option is not always the smartest choice. Doing so may lead to performance issues for your application that would be difficult to diagnose in production (especially if it involves mis-allocation related to your disk I/O requirements).
After reading the following sections, you’ll have a clear understanding of when to leverage each pricing option
On-Demand Instances
On-Demand is the standard pay-as-you-use payment option. Usage is billed either per-hour or per-second, depending on the kind of instances being run.
On-Demand Instances are great for:
- Temporary projects
- Testing/Developing with EC2s for the first time
- Applications with unpredictable and spiky workloads
Essentially, these are a great first choice for anyone new to AWS who wants to learn without overcommitting. On-Demand Instances are also great for uncertain, flexible projects. This is because you’ll never have to pay for unused resources (which can happen with reservations) and your EC2 can still scale with growing workloads.
Spot Instances
You can obtain deep discounts of up to 90% by leveraging spot instances. How is that possible? It’s simple: spot instances are a limited pooled resource. They aren’t always available for the price you’re willing to pay. And when the price goes above your set bidding threshold, your spot instances are interrupted (via hibernation, stopping, or termination). So when choosing Spot Instances, it’s always best to pick fault-tolerant workloads and stateless distributed applications that can tolerate losing partial or full computing capacity without affecting your business processes.
Spot Instances are great for:
- Containerized workloads
- Big Data
- Test & Development workloads
Reserved Instances
For the forward-thinker, Reserved Instances are a great resource. You can save up to 75% in cost by choosing Reserved Instances over On-Demand ones. When using RIs, you also get the added optional benefit of reserving capacity in your preferred Availability Zones.
That sounds great, right? Why wouldn’t you just use RIs exclusively? Well, the downside is that you have to commit to a long-term contract of at least one year. This means continuing to pay a monthly amount even if your need goes away in six months. Also, to get the most savings possible, you have to pay upfront. That may not fit everyone’s budget.
Don’t worry, though. There’s also partial upfront and no upfront payment options for Reserved Instances--meaning you’ll still save on your EC2s, just not as much.
Reserved Instances are great for:
- Customers able to commit to 1 or 3 year contracts
- Applications that require steady state resources
- Applications that would benefit from reserved capacity
If you’re still unsure about committing to using RIs, consider the following:
- You can modify or exchange your reserved instances with convertible reservations
- Standard reserved instances can be put up for sale on the Reserved Instance Marketplace
There’s a lot more that can be said about Reserved Instances. Want to know more? Check out our Overview of Reserved Instances.
Dedicated Hosts
Still like the idea of having your own physical server and have full control of your hardware? Dedicated Hosts are your solution. AWS offers dedicated physical EC2 servers through the On-Demand and Reserved Instance payment methods.
Dedicated Hosts are great for:
- Avoiding the sharing of physical computing resources with other AWS customers
- Using your existing server-bound software licenses
- Meeting compliance requirements
Note that AWS also offers Dedicated Instances (vs. Hosts).
The difference is that Dedicated Instances may be provisioned on a different physical server each time (preventing you from using your own software licenses tied to a specific socket, core, or CPU serial number).
Plan Your Instances with Metricly’s
Calculator Tool
Metricly’s built a new EC2 Instances Calculator to help you search through thousands of current EC2 configurations in a simple user interface and plan for your environment.
3. How Does AWS Charge for EC2s?
In October of 2017, AWS announced that Amazon EC2 usage of Linux-based instances launched in On-Demand, Reserved and Spot form (along with provisioned EBS volumes) will be billed on one second increments, with a minimum of 60 seconds. This means that you would no longer pay for a full hour if you only use the instance in a running state for a few minutes. You also get the benefit of reserved instance pricing for multiple instances used within the hour. Remember that AWS EC2 pricing may still be expressed in the form of instance-hour on many of their pricing pages to preserve consistency.
Dedicated Instances, EBS Snapshots, and products in AWS Marketplace are still billed on an hourly basis.
Data Transfer Costs
Data transfer costs can be divided into two general categories:
Data transfers in between AWS services (like from EC2 to S3)
Across Availability Zones in Same Region:
$0.01/GB each direction
Within Same Availability Zone:
typically free
Across Regions:
varies by region
Data transfers from AWS to the public internet
IPV4 (Public or Elastic):
$0.01/GB either direction
IPv6 in Different VPC:
$0.01/GB either direction
Regional Out To Internet:
varies by region
The more data that is sent out from AWS, the less expensive it gets. Here are the current pricing tiers: 1GB, 9.999TB, 40TB, 100TB, 150TB, 500TB. AWS allows you to commit to a volume of data transfer per month in exchange for a more favorable pricing.
Remember, each of these tiers will have different pricing values for each region.
One-Time Dedicated Instance Costs
Dedicated Instances have two main costs:
Price varies by Region and AMI
$2 per region used regardless of the number of instances in them
How to Minimize Data Transfer Costs
A typical need for data transfer across Availability Zones or AZ (considered regional data transfer by AWS) or Regions is high availability. You may have a Cassandra ring for storing time-series data and provision it to span multiple regions in order to be resilient to any natural disaster, outages, or performance problems in a single geographic region
If resiliency is not your objective, then you can eliminate the data transfer fee by launching your EC2s that are transferring data within the same Availability Zone as long as you are using a private IP address (vs. Elastic IP address). Note that you can also reduce the fees by choosing different regions or by transferring data across AZs instead of across full Regions.
Looking for a tool to make your savings journey easier?
Consider Metricly’s AWS Cost reports.
We’re very proud of the granularity they provide, on a per-instance level, to help you reduce spend and proactively dodge unwanted surprises in your bill. If you’re just beginning your AWS journey and trying to plan your fleet, check out our free EC2 calculator tool.
