- Nathan Besh, Cost Lead Well-Architected
If you wish to provide feedback on this lab, there is an error, or you want to make a suggestion, please email: [email protected]
- View your cost and usage by service
- View your cost and usage by account
- View your Savings Plan coverage
- View your Elasticity
- View your Reserved Instance coverage
- Create a custom EC2 report
- Tear down
- Rate this Lab
AWS Cost Explorer is a free built in tool that lets you dive deeper into your cost and usage data to identify trends, pinpoint cost drivers, and detect anomalies. We will examine costs by service in this exercise.
-
Log into the console as an IAM user with the required permissions, go to the billing dashboard:
-
You will be presented a list of pre-configured and saved reports. Click on Monthly costs by service:
-
This is the monthly costs by service for the last 6 months, broken down by month (your usage will most likely be different):
-
We will change to a daily view to highlight trends. Select the Monthly drop down and click on Daily:
-
The bar graph is difficult to read, so we will switch to a line graph. Click on the Bar dropdown, then select Line:
-
This is the same data with daily granularity and shows trends much more clearly. There are monthly peaks - these are monthly recurring reservation fees from Reserved Instances (Purple line):
-
We will remove the RI recurring fees. Click on More filters then click Charge Type filter on the right, click the checkbox next to Recurring reservation fee, select Exclude only to remove the data. Then click Apply filters:
-
We have now excluded the monthly recurring fees and the peaks have been removed. We can see the largest cost for our usage during this period is EC2-Instances:
-
We will remove the EC2 service to show the other services with better clarity. Click on the Service filter from the right, click the checkbox next to EC2-Instances, select Exclude only, and click Apply filters:
-
EC2-Instances has now been excluded, and all the other services can been seen easily:
You have now viewed the costs by service and applied multiple filters. You can continue to modify the report by timeframe and apply other filters.
We will now view usage by account. This helps to highlight where the costs and usage are by linked account. NOTE: you will need one or more multiple accounts for this exercise to be effective.
-
It will show the default last 6 months, with a monthly granularity.
-
As above, change the graph to Daily granularity and from a bar graph to a Line graph:
-
Here is the daily granularity line graph. You can see there is one account which has the most cost, so lets focus on that by applying a filter:
-
On the right click on Linked Account, select the checkbox next to the account we want to focus on, then click Include only and Apply filters:
-
Lets see the services breakdown for this account, click on Service to group by services and change it to a line graph:
-
You can see the service breakdown for this account. Lets see the instance type breakdown for this account, click on Instance Type and change it to a line graph:
-
You can see the instance type breakdown for this account. Lets see the usage type breakdown for this account, click on Usage Type and change it to a line graph:
You have now viewed the costs by account and applied multiple filters. You can continue to modify the report by timeframe and apply other filters.
To ensure you are paying the lowest prices for your resources, a high coverage of Savings Plan is required. A typical goal is to aim for approximately 90% of your baseload resources ("always on") covered by Savings Plans, here is how you can check your coverage.
-
Scroll down to the table, click on the arrow next to On-demand spend to sort from the largest spend to the lowest. This helps show your opportunity for cost savings:
NOTE: This exercise requires you have enabled hourly granularity within Cost Explorer, this can be done by following the instructions here - AWS Account Setup, Step 5 item 5 - Enable Cost Explorer. There are additional costs to enable this granularity.
A key part of cost optimization is ensuring that your systems scale with your usage. This visualization will show how your systems operate over time.
-
Click the down arrow to change the period, select 14D and click Apply:
-
You will now have in depth insight to how your environment is operating. You can see in this example the EC2 Instances scaling every day, you can see a period of large ELB usage, and EC2-Other, which includes charges related to EC2 such as data transfer.
To ensure you are paying the lowest prices for your resources, a high coverage of Reserved Instances (RIs) is required. A typical goal is to aim for approximately 80% of baseload ("always on") instances covered by RI's, here is how you can check your coverage.
-
You will see the default RI Coverage report. It is for the Last 3 Months, and is for the instances within the EC2 service:
-
Scroll down below the graph and you can see a summary of the costs and usage. Note that depending on the instance type and size, the On-Demand costs will be different per hour:
-
To help focus where you need to, click on the down arrow next to ON-DEMAND COST to sort by costs descending. This will put the highest on-demand costs at the top, which is where you should focus your RI purchases:
You have now viewed your RI coverage, and have insight on where to increase your coverage.
We will now create some custom EC2 reports, which will help to show ongoing costs related to EC2 instances and their associated usage.
-
From the left menu click Cost Explorer, click Reports, and click and click Monthly costs by service:
-
You will have the default breakdown by Service. Click on the Service filter on the right, select EC2-Instances (Elastic Compute Cloud - Compute) and EC2-Other, then click Apply filters:
-
click on Purchase Option, select On Demand and click Apply filters, which will ensure we are only looking at On-Demand costs:
-
These are your on-demand EC2 costs, you should setup a report like this for your services that have the highest usage or costs. We will now save this, click on Save as...:
-
Now click on the Service filter, and de-select EC2-Instances, so that only EC2-Other is selected:
-
Now you can clearly see what makes up the Other charges, typically these are EBS volumes, Data Transfer and other costs associated with EC2 usage. Click Save as... (do NOT click Save):
-
Here you can see both reports that were saved, note they do not have a lock symbol - which is reserved for AWS configured reports:
We will delete both custom reports that were created.