- Adit Modi
Users of Amazon Web Services are likely familiar with some AWS cost optimization best practices, but probably not all of them. Consequently, I have compiled a list of the ten best practices to optimize AWS costs, and also suggest a solution that ensures the costs of using Amazon Web Services remain optimized.
My Background: I am Cloud , DevOps & Big Data Enthusiast | 4x AWS Certified | 3x OCI Certified | 3x Azure Certified .
It’s not unusual to read headlines claiming businesses are overspending in the cloud, that a double-figure percentage of money is being wasted on unused services, or that millions of businesses provision resources with more capacity than they need. The most common “solutions” to the reported issues are rightsizing, scheduling, and purchasing Reserved Instances/Savings Plans for predictable workloads.
These three “solutions” are probably the AWS cost optimization best practices most AWS users are familiar with, but they’re not necessarily the “best” best practices. Sometimes they don’t save a fraction of the cost that it's claimed they will, while plenty of other, often overlooked, AWS cost optimization best practices can save a lot more. This is an issue we aim to address below.
The 10 AWS cost optimization best practices
1. Rightsizing EC2 Instances
As I have already mentioned rightsizing, scheduling, and Reserved Instances/Savings Plans, let’s start with these three AWS cost optimization best practices. The purpose of rightsizing is to match instance sizes to their workloads. Unfortunately, it doesn’t quite work like that because of the way in which instances double in capacity for each increase in size.
If you double the capacity when you go up one size, then you also half the capacity when you go down one size. Therefore, rightsizing is only a worthwhile best practice if there are instances whose peak utilization does not exceed ~45%. It’s still worth analyzing utilization metrics to find opportunities to move workloads to different families (other than “General Purpose”) that better suit their needs.
2. Scheduling on/off times
It’s worth scheduling on/off times for non-production instances such as those used for developing, staging, testing, and QA, as you will save around 65% of running these instances if you apply an “on” schedule of 8.00 a.m. to 8.00 p.m. Monday to Friday. However, it’s possible to save a lot more—especially if development teams work in irregular patterns or at irregular hours.
You can apply more aggressive schedules by analyzing utilization metrics to determine when the instances are most frequently used, or apply an always stopped schedule which can be interrupted when access to the instances is required. It’s worth pointing out that while instances are scheduled to be off, you’re still being charged for EBS volumes and other components attached to them.
3. Purchasing Reserved Instances and Savings Plans
Purchasing Reserved Instances is an easy way to reduce AWS costs. It can also be an easy way to increase AWS costs if you don’t utilize the Reserved Instance as much as you expected to, purchase the wrong type of Reserved Instance, or purchase a “standard” Reserved Instance only to find AWS prices fall over the term of your reservation by more than the reservation “saves”.
Therefore, rather than suggest that purchasing Reserved Instances is one of the best practices for AWS cost optimization, we’re going to recommend the effective management of Reserved Instances as an AWS cost optimization best practice—effective management consisting of weighing up all the variables before making a purchase and then monitoring utilization throughout the reservation’s lifecycle.
4. Delete unattached EBS volumes
Returning to Elastic Block Storage (EBS), when you launch an EC2 instance, an EBS volume is attached to the instance to act as its local block storage. When you terminate the EC2 instance, the EBS volume is only deleted if you checked the “delete on termination” box when the instance was launched. If the box wasn’t checked, the EBS volume still exists and is contributing toward the monthly AWS bill.
Depending on how long your business has been operating in the cloud and the number of instances launched without the delete box being checked, there could be thousands of unattached EBS volumes in your AWS Cloud. It’s certainly one of our AWS cost optimization best practices to consider, even if your business is relatively new to the AWS Cloud.
5. Delete obsolete snapshots
Snapshots are an efficient way to back up data on an EBS volume to an S3 storage bucket because they only back up data that’s changed since the last snapshot to prevent duplications in the S3 bucket. Consequently, each snapshot contains all of the information needed to restore your data (from the moment when the snapshot was taken) to a new EBS volume.
Usually, you’re only going to need the most recent snapshot to restore data if something goes wrong (although it’s advisable to keep snapshots for a couple of weeks depending on the frequency with which they’re taken), and although snapshots don’t cost very much individually, you could save thousands of dollars by deleting those you no longer need.
6. Release unattached Elastic IP addresses
Elastic IP addresses are public IPv4 addresses from Amazon’s pool of IP addresses that are allocated to an instance so it can be reached via the Internet. Businesses are allowed a maximum of five Elastic IP addresses per account because Amazon doesn´t have an unlimited pool of IP addresses. However, they are free of change when attached to running service.
Exceptions to the free of charge rule occur if you remap an IP address more than 100 times a month, or if you hang on to unattached Elastic IP address once you have terminated the instances to which they were attached. The charge for unattached Elastic IP addresses may only be 8,760 of waste per year.
7. Upgrade instances to the latest generation
Due to Amazon Web Services’ wide array of products and services, there are frequent announcements about how products have been upgraded or features introduced to support specific services. With regards to AWS cost optimization best practices, the announcements to look out for are those relating to latest generation instances.
When Amazon Web Services releases a new generation of instances, they tend to have improved performance and functionality compared to their predecessors. This means you can either upgrade existing instances to the latest generation, or downsize existing instances with borderline utilization metrics in order to benefit from the same level of performance at lower cost.
8. Purchase reserved nodes for Redshift and ElastiCache Services
One recent AWS announcement detailed how the discount program for Amazon Redshift and ElastiCache had changed. Previously, businesses could purchase advanced-payment “Heavy Utilization” discounts, but these have now changed to (almost) mirror Reserved Instance purchases for EC2 and RDS instances.
Reserved Nodes can be purchased for Redshift, ElasticCache, Redis, and Memcached Services for 1-year or 3-year terms, with the option of paying the full amount upfront or partially upfront, or paying monthly. One important note is that in order to take advantage of reservations on the ElastiCache Service, you must first upgrade Nodes to the latest generation.
9. Terminate zombie assets
The term “zombie assets” is most often used to describe any unused asset contributing to the cost of operating in the AWS Cloud—many typical zombie assets have already been mentioned (unattached EBS volumes, obsolete snapshots, etc.). Other assets that fall into this category include components of instances that were activated when an instance failed to launch and unused Elastic Load Balancers.
A problem businesses often encounter when trying to implement AWS cost optimization best practices is that some unused assets are difficult to find. For example, unattached IP addresses are notoriously difficult to locate in AWS System Manager or AWS Console.
10. Move infrequently-accessed data to lower cost tiers
Amazon Web Services currently offers six tiers of storage at different price points. Determining which storage tier is most suitable for data will depend on factors such as how often data is accessed (as retrieval fees apply to the lower tiers) and how quickly a business would need to retrieve data in the event of a disaster (as it may take hours to retrieve from a lower tier).
The savings from storing infrequently accessed, non-critical data in a lower cost tier can be substantial. The cost per month of storing up to 50TB of data in a standard S3 storage bucket is 0.00099 per GB per month. The six tiers of storage are:
S3 Standard S3 Intelligent Tiering S3 Infrequent Access S3 Infrequent Access (Single Zone) S3 Glacier S3 Deep Archive Glacier
AWS cost optimization is an ongoing process
Applying AWS cost optimization best practices is an ongoing process. Your AWS Cloud needs to be monitored at all times to identify when assets are being under-utilized (or not utilized at all) and when opportunities exist to reduce costs by deleting/terminating/releasing zombie assets. It’s also important to stay on top of Reserved Instances to ensure they’re being fully utilized.
Hope this guide helps you understand the things you can do today to reduce aws costs, feel free to connect with me on LinkedIn. You can view my badges here. If you are interested in learning more about AWS then follow me on github. If you liked this content then do clap and share it . Thank You .