If you are using AWS services, you probably feel the pain of bills being too high. The results can be pretty dramatic, but the good news is that most definitely there is the way to reduce AWS costs by improving the configuration. We at CoreQ audited dozens of clients’ accounts, and based on that experience we can say that, on the average, the bills can be reduced by 30%. Even AWS itself has issued the guide on cost optimization.
So, where do we start?
1. Obvious things first. If you have any unused EC2 instances – shut them down to reduce AWS costs.
The important thing is that if you stop the instance but don’t terminate it – EBS costs will still be running, as your volume will still be stored. Terminating EC2 instances will terminate both EC2 and EBS costs. The same applies to other instance types, e.g., Elastic Cache.
2. Reduce oversized instances and volumes.
You have to analyze your metrics before making these decisions. Please do not rely on short-term data. You can use one month of data, but please also check if you have seasonal peaks. Another thing worth mentioning is that you can’t actually reduce the EBS volumes. So you’ll have to create a new volume of the right size and copy the data from the old one.
3. Using Private IPs whenever possible.
Using public IPs inside of the AWS EC2 network triggers Intra-Region Data Transfer charges being added to your AWS bill, even is your instances belong to the same availability zone. The same happens if you use Elastic IP address or Elastic Load Balancer.
4. Delete unattached EBS volumes.
Another obvious thing to do to reduce AWS costs – pretty simple this time.
5. AWS Savings Plan.
If your business is stable and you’re pretty sure about the minimum amount of resources you will consume, you can do a one- or three-year long commitment for EC2 and Fargate usage. This way, you can receive a 30%+ discount for the agreed usage amount. And everything that exceeds that amount will be charged as per regular on-demand prices.
6. Reserved instances.
Reserved instances are available for services such as EC2, RDS, Elastic Cache, and Redshift. When you reserve an instance, you pay 24/7 for all the period of reservation (which is one or three years). Thus, they are just great to handle the baseline load. You can also consider buying convertible EC2 instances instead of standard. These instances can be upgraded and even sold on the AWS Marketplace. (However, the selling option will be available only for US-registered companies.) With reserved instances, you can save up to 77% of the AWS cost.
7. Reserved EC2 instances bought on the AWS Marketplace.
You can also consider purchasing reserved instances from the AWS Marketplace. On the bright side, this can help you save even more money, but on the downside – finding the instance with the right type, availability zone, and reserved period left can be really tricky. Still, you can change the availability zone after you buy the instance, which increases the number of options.
8. Spot instances.
They are indeed the best cost saver. You can achieve as much as 90% savings with them! The trick is that AWS can terminate them with almost no warning, so you probably shouldn’t use them for critical parts of the infrastructure. But they are just great for those processes where uptime is not critical.
You may also consider using the services that detect when a spot instance is terminated and replace them.
9. AWS Auto Scaling.
Obviously, having autoscaling configured properly can save you much money, as you won’t have to pay for the instances that are not in use most of the time. You just set up triggers to automate instances start and stop, and you can further tune-up by using vertical and horizontal autoscaling. By the way, autoscaling is one of the use cases when spot instances come in handy.
10. Selection of region and availability zones.
AWS costs vary by region. On top of that, additional charges are taken for regional data transfers and transfers between availability zones. So the best thing to do is to centralize your operations is as little regions as possible, and use single availability zones.
11. Use S3 for backups.
For the most cost-efficient setup, use incremental backups and delete old backups and buckets periodically. Also, you should carefully evaluate what’s the best storage model and storage class. Moving data between storage classes will result in additional charges, so it’s better to make the right decision from the first attempt.
12. Use CDN to reduce S3 costs.
You can save as much as 500% of the related AWS costs by simply doing this.
Using it is already a cost-saver; still, CloudFront costs can be optimized as well with usage of Private Contract & Volume Pricing. However, you won’t be able to connect other CDN services being on the Private Contract & Volume Pricing commitments, meaning you should also consider SSL charges. If you’re using CloudFront Custom SSL, the costs can be high compared to the alternatives.
14. Data transfer volume discount.
If your account is really big and data transfers are huge, you can also try applying for a Data transfer volume discount.
15. Watch out for new instance types release by the AWS.
Sometimes new generation instances are at the same time more productive and less expensive!
16. Enable enhanced networking.
If your packets-per-second rate appears to have reached its ceiling, you should consider moving to enhanced networking.
17. And a few more obvious things at the end.
You can set up budget limitations and budget threshold alarms. Additionally, it’s always a good thing to analyze AWS costs breakdown in cost explorer or bills.