Last updated on August 8th, 2024 at 06:23 am
Amazon Web Services (AWS) is the most widely used cloud infrastructure platform that offers a wide range of services. However, if you don’t keep an eye on AWS costs it can turn out to be an expensive affair. In this article we will look at the most common reasons businesses overspend on AWS and some effective AWS cost optimization techniques. Here are the top AWS cost optimization best practices you can adopt for your organization.
Why Optimize AWS Cost
There are several reasons why it is essential to regularly monitor and reduce AWS costs. Here are some of the important points:
- Too Many Options – AWS offers hundreds of services with too many pricing options to keep track of. In addition, it keeps launching newer resources that offer same services at lower pricing, without retiring the older ones. So if you are still running older resources, you may want to upgrade to newer ones to reduce costs
- Underutilized Resources – Most EC2 instances are underutilized. In other words, you are paying for computing power that you do not need. Same is true with other AWS services such as Simple Email Service. So it is good to review service usage and downgrade it to the most optimal one.
- Not Using Reserved Instances – On-demand services are costlier than reserved instances. If your business is growing at a regular pace, then you are likely to save money by opting for Spot or reserved instances that can save up to 80% of your costs.
- Faulty Auto Scaling – Many system admins setup auto scaling option allowing AWS to automatically upgrade your services in case of increased demand. If this is not optimized, you may end up spending a lot of money.
Top AWS Cost Optimization Best Practices
The most common reason organizations overspend on AWS is due to unutilized resources. So we will look at different ways to identify such resources and use them more effectively. Here are some easy to implement AWS cost optimization best practices for organizations.
1. Use the right EC2 instance
EC2 costs occupy the biggest fraction of AWS bills. The most common reason why businesses lose money on AWS is because they use an expensive EC2 instance for their workloads, which could have been done using lighter EC2 instances. For example, they use a large instance when a medium instance is enough to get the work done.
The key is to match your EC2 instance with your workload. If your EC2 instance’s peak CPU usage is less than 40% it might be a good idea to downgrade your instance a step. It is always good to periodically do load testing on your server for this purpose.
AWS offers 3 different types of pricing for each EC2 instance – On-Demand, Spot and Reserved. On Demand pricing has hourly pricing and delivers stable processing power. They are great for production environments. Spot instances offer up to 90% discounted pricing but can be interrupted any time with 2 minute notice. So they are suitable for testing and development. Reserved instances are like on demand instances but with a lock-in period of at least 1 year. Consequently, they offer a discounted pricing. They are useful if you run a small online business with predicable workload.
In fact, Amazon has also come up with LightSail servers that are bundled hardware for predictable workloads such as simple websites, WordPress Blogs and so on. They are much cheaper than EC2 instances. If your business does not require heavy computations and data processing, it might be a good idea to switch to a LightSail server. Here is a detailed comparison between EC2 instance and LightSail server.
Bonus Read : Top 5 Log Management Tools
2. Schedule on/off times
Did you know you can schedule an EC2 instance to automatically start/shutdown?
There are so many cases such as development, staging, testing and QA where you don’t need to run an EC2 instance 24×7. In such cases, you can schedule it to automatically turn off in the evening and start again in the mornings.
You can save as much as 65% of running if you schedule such as EC2 instances to be on from 8.00 AM – 8.00 PM, Monday to Friday.
Bonus Read : How to Install memcached in Apache
3. Manage Reserved Instances Better
Reserved Instances are much cheaper than On-Demand Instances but you need to be careful with them. If you don’t fully utilize them you will be wasting money.
AWS prices keep falling every year. If you purchase the wrong type of reserved instance or get a standard reserved instance, it might happen that their prices have fallen over your reservation term by more than what they save in the first place.
So make sure that you utilize Reserved Instances fully. Stop them if you do not need them.
Alternatively, sell reserved instances that you do not need on Reserved Instance Marketplace.
Bonus Read : Top 5 Broken Link Checker Tools
4. Delete Unutilized resources
Delete unattached EBS volumes and old snapshots. When you terminate an EC2 instance, its EBS volume will not be deleted automatically unless you checked “Delete on Termination” while launching the instance. They will continue to remain unattached and add to your AWS bill.
Similarly, you can optimize AWS cost by deleting unnecessary snapshots of your EC2 instances. Usually, you only need the most recent snapshot of your instances. However, AWS bills you for all snapshots in your account. So it is a good idea to delete the older snapshots.
Also, release unutilized elastic IP addresses. Elastic IP addresses are public IP addresses that can be attached to instances to make them publicly accessible. Each unattached IP address costs $0.01 per hour. So if you have 5 unattached elastic IP addresses, you will incur an extra $36 (720 x 5 x 0.01) every month.
Bonus Read : Top 5 Server Monitoring Tools
5. Upgrade Instances
Every year AWS releases next generation EC2 instance that have superior technology and are cheaper than previous generation ones. So you can get more bang for your buck or get same performance at lower costs, if you upgrade your EC2 instance to the latest generation. For example, many website use medium instances due to their stable performance. Some are using M1.Medium while some are using M3.medium. Did you know that AWS has released M7.medium instances? They are much cheaper and powerful than older generation instances such as M1 and M3.
6. Pick Right Storage Option
AWS offers different types of storage options such as HDD, Magnetic Tapes and SSD. SSD storage is the default option for most EC2 instances and cost twice as much as HDD storage. So if you are using AWS EBS storage, then look at the cost difference between Optimized Throughput HDD (st1) vs General Purpose SSD (gp2).
7. Reduce Data Transfer
AWS charges you every time data is transferred from your EC2 instance to public internet. So you may want to cache most of your content on Amazon Cloudfront to save costs.
Also, AWS data transfer is free within the same region but not across different regions. So if you are using multiple AWS services that communicate with each other, such as EC2, SES and Amazon S3, then it is better to run them in same region.
Even within the same region, use private IP address to transfer data, since it is free. If you refer to different services within same region using their public IP address, then you will be charged for data transfer.
Tools to Optimize AWS Cost
AWS provides several free useful tools to monitor and optimize costs. Review them regularly to identify cost saving opportunities.
- Billing & Cost Management – This section provides many useful information such as cost summary, last month’s cost, forecasted cost for current month. It also provides a graphical breakdown of costs by service, accounts, regions, cost category. It also allows you to enable a cost optimization hub to discover cost saving areas.
- Amazon Cloudwatch – It allows you to configure alarms on various metrics for your various services. For example, you can set an alarm if the monthly cost of your EC2 instance exceeds a maximum threshold value. On the other hand, you can also set an alarm to inform you if EC2 utilization falls below a minimum threshold value.
- AWS Cost Explorer – This is a popular tool among AWS users. It provides a graph of monthly costs for past 13 months, and breaks it down by region, service and other dimensions. You can easily slice and dice this data on their dashboard and measure ROI.
There are many other tools such as Cost Anomaly Detection, Trusted Advisor, AWS Budgets and more. Also, AWS is constantly adding new tools as well as adding more features to existing tools. So it is important to keep an eye on them.
Conclusion
In this article, we have learnt several common reasons why your AWS bill swells up real quick. We have also described many simple ways to easily reduce AWS costs. It is a good practice to annually, if not quarterly, review your AWS costs and look for ways to reduce them. The key is to move your site to the right location and use the right EC2 instance, or its alternative such as Lightsail.
Of course, there are more than 25 different ways to optimize AWS costs. We have tried to cover the ones that will give you big savings instead of small ones. Although there are several components to AWS bills, EC2 instances and EBS storage volume incur most costs. If you can somehow reduce these items, you can save a lot of money. Hopefully, the above AWS cost optimization best practices will help lower your monthly bills.
Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI & software development.