How-To
Bring Down Your AWS EC2 Storage Costs by Finding Orphaned Volumes
Normally, when you terminate an EC2 instance, the Elastic Block Store (Amazon EBS) volume that is associated with that instance is automatically deleted. However, this isn't always the case. It is possible for example, to modify a volume's DeleteOn Termination attribute so that root volumes are retained even when the instance is terminated.
Sometimes orphaning EBS storage volumes is completely justified. If for example, an organization decides that it wants to reduce costs by terminating an unused instance, but is not 100 percent sure that the instance's local storage will never be needed again, then it might choose to terminate the instance but retain the instance's volumes. In such a situation, the organization will see an immediate cost savings because the instance is no longer being used, but the organization will still be billed for the storage space consumed by the orphaned storage volumes.
If the organization eventually decides it no longer needs the volumes, then an admin can delete the volumes at that point. What often ends up happening instead however, is that the volumes are eventually forgotten about and the organization keeps paying for them long after the volumes have outlived any potential usefulness.
This raises the question of how you can track down and remove orphaned EBS volumes that are no longer needed? The most obvious option is to sift through the EBS console and look for volumes that might not be in use. While this method works, it probably isn't going to be very practical. After all, organizations that rely heavily on EC2 usually have large numbers of EBS volumes, making it tedious and time consuming to track down an elusive volume.
A better, more practical option is to use the AWS Trusted Advisor. You can find Trusted Advisor on the list of services in the Management and Governance section.
When you open Trusted Advisor, you will initially be taken to a dashboard screen, similar to the one that is shown in Figure 1. As you look at the figure, you will notice several tabs on the left side of the screen. Click the Cost Optimization tab.
The Cost Optimization screen, shown in Figure 2, lists a number of different checks that you can perform related to cost optimization. One thing that you will notice in the figure is that all of these cost optimization checks are currently grayed out. The reason for this is that you will have to upgrade your AWS support plan before you will be able to run the cost optimization checks.
When an organization opens an AWS account, it is automatically enrolled in Amazon's Basic support plan. The Basic Support Plan includes access to seven core Trusted Advisor checks. This is also true of the Developer Support Plan. In order to access all of the available Trusted Advisor checks, you will need either a Business or an Enterprise Support Plan. The starting costs for the Business and Enterprise Support Plans are currently $100 and $15,000 per month respectively. Check out the full plan and cost details for more information (link requires log in).
Assuming that you do have a support plan that allows you to run cost optimization checks, the way to track down orphaned EBS volumes is to run the Underutilized EBS Volumes check, which you can see listed in Figure 2.
The Underutilized EBS Volumes check determines which volumes are being underutilized by looking at the number of IOPS associated with the volume. While the absence of IOPS is a good indication that a volume is not being actively used, it's important to look at the volume's input/output operations per second (IOPS) over time. It's one thing for a volume not to produce any IOPS in the last hour or in the last day, but it's another thing entirely if there have been no IOPS over the past several weeks.
Keep in mind that while the Trusted Advisor is a great tool for helping you to identify EBS volumes that are no longer being used, the Trusted Advisor is only able to provide you with its best guess as to whether or not a volume is still in use. It will ultimately be up to you to make the final determination.
About the Author
Brien Posey is a 22-time Microsoft MVP with decades of IT experience. As a freelance writer, Posey has written thousands of articles and contributed to several dozen books on a wide variety of IT topics. Prior to going freelance, Posey was a CIO for a national chain of hospitals and health care facilities. He has also served as a network administrator for some of the country's largest insurance companies and for the Department of Defense at Fort Knox. In addition to his continued work in IT, Posey has spent the last several years actively training as a commercial scientist-astronaut candidate in preparation to fly on a mission to study polar mesospheric clouds from space. You can follow his spaceflight training on his Web site.