DEV Community

Cover image for What is EC2-Other?
Brian
Brian

Posted on • Edited on

What is EC2-Other?

This post was originally posted on getStrake.com.


EC2-Other is a cost category calculated by Amazon that causes a lot of heartburn for the Engineering community. If you are a heavy EC2 user, this could be your second largest cost category on your AWS Bill.

This post will dive into this category to help AWS users understand what they are getting billed for and how to isolate individual cost categories within 'EC2-Other'.


Understanding EC2 Costs

Before we can unpack what costs live in the 'EC2-Other' category, you have to understand what this category means to total EC2 costs and how EC2 costs are calculated in various AWS reporting tools.

After researching this problem, I put together this table for how different AWS reporting tools display total EC2 costs. Below the table, I summarize the different reporting methodologies and how these values relate. Please note that this is only true for on-demand EC2 usage.

Calculating Total EC2 Costs

AWS Bill CUR (ServiceCode) AWS Cost Explorer CUR (ProductCode)
Elastic Compute Cloud AmazonEC2 EC2-Instances AmazonEC2
Data Transfer (partial) AWSDataTransfer (partial) EC2-Other AmazonEC2

AWS Bill

The AWS Bill category 'Elastic Compute Cloud' combines EC2 instance running costs, NAT Gateway, EBS, and all EC2 costs except data transfer. A second category in the AWS Bill called 'Data Transfer' combines data transfer costs for many different AWS Services. Unfortunately, EC2 Data Transfer costs cannot be isolated using only your AWS Bill.

AWS Cost Explorer

When you search for 'EC2' under 'Service' in Cost Explorer, there are four options that come up:

  • EC2-Instances (Elastic Compute Cloud - Compute)
  • EC2-Other
  • EC2-ELB (Elastic Load Balancing)
  • EC2 Container Registry (ECR)

The first two combined, EC2-Instances and EC2-Other, make up your total EC2 costs (including data transfer for EC2). The second two, EC2-ELB and EC2 Container Registry, can be ignored because they are different services altogether.

The EC2-Instances category isolates the hourly cost of running your EC2 instances. One of the benefits of this category is that customers can quickly identify the instance costs that can be covered with reservations. EC2-Other is a calculation that combines all other costs driven by EC2 usage: EBS, NAT Gateway, EC2's portion of Data Transfer, and others.

With these two categories, EC2-Instances and EC2-Other, customers can get the total cost of running their EC2 instances. However, since this cost includes EC2's portion of data transfer costs, this will not be the same as the AWS Bill's cost for 'Elastic Compute Cloud' if there is any data transfer cost.

AWS Cost and Usage Report (CUR)

The CUR is the source of truth for all AWS billing. In the Developer's Guide to AWS, I go into much more detail about the CUR, provide a data dictionary, and share instructions for setting up the CUR in your AWS Account.

For this discussion about EC2-Other costs, there are two fields that matter:

  1. [lineItem/ProductCode] - the value 'AmazonEC2' captures all costs associated with running EC2 instances (including Data Transfer).
  2. [product/ServiceCode] - the valued 'AmazonEC2' will show all EC2 costs other than Data Transfer, and 'AWSDataTransfer' is used for data transfer costs by any AWS Service.

Data Sources Key Takeaways

There are three key takeaways from the different AWS data sources before we dig into the cost categories that make up EC2-Other.

  1. EC2-Other is a calculated metric from Cost explorer. This metric calculates the total cost of running your EC2 instances, less the fixed hourly instance running costs.
  2. If you want to dig into costs for categories on your AWS Bill, the top cost categories on the AWS Bill align to the CUR's [product/ServiceCode] fields:
AWS Bill Categories [product/ServiceCode] Values
Elastic Compute Cloud AmazonEC2
Data Transfer AWSDataTransfer
  1. The sum of EC2-Instances and EC2-Other from cost explorer:
    • IS equal to [lineItem/ProductCode] is 'AmazonEC2'
    • IS NOT equal to 'Elastic Compute Cloud' on the AWS Bill because this field does not include EC2's portion of Data Transfer costs.

Visibility into EC2-Other Costs

In the Developer's Guide to AWS Costs, the first service I posted a guide for was EC2. In this guide, I broke EC2 costs into three logical categories:

  1. Existence Cost - EC2-Instances in cost explorer - This identifies the cost of having an EC2 instance running regardless of the resource activity. This cost is based on an hourly rate determined by your instance type, region, and whether you're using contractual reservations or spot instances.
  2. Utilization Cost - part of EC2 - Other in cost explorer - On top of the flat rate for having an instance running, some costs come from how an EC2 instance is utilized. These costs are driven by a usage-based metric such as $ per GB-month. The most common Utilization cost for EC2 is data transfer.
  3. Subresource Cost - the second part of EC2 - Other in cost explorer - This is incurred for resources attached to or directly interacting with your EC2 instance. An easy example of EC2 is EBS Volumes used for EC2 instance storage.

I broke down the 'EC2-Other' category from Cost Explorer into Utilization and Subresource costs. Utilization focuses on how your EC2 resources are used, while Subresources isolates other resources (NAT Gateways or EBS Volumes, for example) that contribute to your total EC2 cost.


Total EC2-Other Costs

Utilization Costs

To isolate Utilization Cost, use the query below. This query isolates your EC2 instances using the [lineItem/ResourceId] field and filters out types [lineItem/UsageType] and [lineItem/Operation] fields that indicate Existence cost.

#Utilization Costs
##Utilization costs for EC2 by line item operation
SELECT
    [lineItem/Operation],
    round(sum([lineItem/UnblendedCost]), 4) as utilization_cost
FROM CUR
WHERE
    [lineItem/ProductCode] is 'AmazonEC2'
    and [lineItem/ResourceId] LIKE 'i-%'
    and [lineItem/UsageType] NOT LIKE '%BoxUsage%'
    and [lineItem/Operation] NOT LIKE 'RunInstances%'
    and [lineItem/LineItemType] is 'Usage'
GROUP BY
    [lineItem/Operation]
ORDER BY
    sum([lineItem/UnblendedCost]);
Enter fullscreen mode Exit fullscreen mode

Some of the sample values from [lineItem/Operation] that indicate Utilization costs include:

  • VPCPeering-In and VPCPeering-Out - VPC Peering connections between the VPCs allow you to route traffic using private IP Addresses. All VPC Peering connections in the same AWS Region are charged at $0.01/GB.
  • PublicIP-In and PublicIP-Out - These track the costs of transferring data 'in' or 'out' from a public or Elastic IPv4 address. This traffic is charged at $0.01/GB in each direction.
  • InterZone-In and InterZone-Out - These are the costs associated with transferring data 'In' or 'Out' of EC2. Data transfer 'In' from the internet is free, but there are charges for data transfer 'out' to either the internet or other AWS Services. If you want to see the costs from AWS that show data transfer costs from EC2 to each region or product, those are posted on the EC2 pricing page under Data Transfer.

If you add the [product/ServiceCode] field to the SELECT statement of this query, you will be able to see which costs are categorized as 'AWSDataTransfer' and which are 'AmazonEC2'.

#Utilization Costs
##Utilization costs for EC2 by product service code line item operation
SELECT
    [product/ServiceCode],
    [lineItem/Operation],
    round(sum([lineItem/UnblendedCost]), 4) as utilization_cost
FROM CUR
WHERE
    [lineItem/ProductCode] is 'AmazonEC2'
    and [lineItem/ResourceId] LIKE 'i-%'
    and [lineItem/UsageType] NOT LIKE '%BoxUsage%'
    and [lineItem/Operation] NOT LIKE 'RunInstances%'
    and [lineItem/LineItemType] is 'Usage'
GROUP BY
    [lineItem/LineItemType],
    [lineItem/Operation]
ORDER BY
    sum([lineItem/UnblendedCost]);
Enter fullscreen mode Exit fullscreen mode

Subresource Cost

There are three main categories of Subresources customers should have the ability to analyze in more detail:
EBS Volumes

  • EBS volumes are identified by filtering the [lineItem/ResourceID] field for items that contain vol-%.
  • There are two main types of costs for EBS Volumes that show up in the [lineItem/Operation] field:
    • IO Usage: read and write costs.
    • CreateVolume: costs for creating provisioned EBS Volumes.
#Subresource Costs
##Subresource costs for EBS Volumes
SELECT DISTINCT
    [lineItem/ResourceID],
    [lineItem/LineItemType],
    [lineItem/Operation],
    round(sum([lineItem/UnblendedCost]), 4) as subresource_cost
FROM CUR
WHERE
    [lineItem/ProductCode] is 'AmazonEC2'
    and [lineItem/ResourceId] LIKE 'vol-%'
GROUP BY
    [lineItem/ResourceID],
    [lineitem/lineitemtype],
    [lineItem/Operation]
ORDER BY
    sum([lineItem/UnblendedCost]);
Enter fullscreen mode Exit fullscreen mode

EBS Volume Snapshots

  • EBS volumes are identified by filtering the [lineItem/ResourceID] field for items that contain vol-%.
  • There are two main types of costs for EBS Volumes that show up in the [lineItem/Operation] field:
    • IO Usage: read and write costs.
    • CreateVolume: costs for creating provisioned EBS Volumes.
#Subresource Costs
##Subresource costs for EBS Volume Snapshots
SELECT DISTINCT
    [lineItem/ResourceID],
    [lineItem/LineItemType],
    [lineItem/Operation],
    round(sum([lineItem/UnblendedCost]), 4) as subresource_cost
FROM CUR
WHERE
    [lineItem/ProductCode] is 'AmazonEC2'
    and [lineItem/ResourceId] LIKE '%snapshot%'
GROUP BY
    [lineItem/ResourceID],
    [lineitem/lineitemtype],
    [lineItem/Operation]
ORDER BY
    sum([lineItem/UnblendedCost]);
Enter fullscreen mode Exit fullscreen mode

NAT Gateways

  • NAT Gateways are identified by filtering the [lineItem/ResourceID] field for items that contain %natgateway%.
  • There are many different cost categories for NAT Gateways, but they are primarily driven by data transfer or data processing fees.
#Subresource Costs
##Subresource costs for NAT Gateways
SELECT DISTINCT
    [lineItem/ResourceID],
    [lineItem/LineItemType],
    [lineItem/Operation],
    round(sum([lineItem/UnblendedCost]), 4) as subresource_cost
FROM CUR
WHERE
    [lineItem/ProductCode] is 'AmazonEC2'
    and [lineItem/ResourceId] LIKE '%natgateway%'
GROUP BY
    [lineItem/ResourceID],
    [lineitem/lineitemtype],
    [lineItem/Operation]
ORDER BY
    sum([lineItem/UnblendedCost]);
Enter fullscreen mode Exit fullscreen mode

Top comments (0)