The title says it all. Let’s not drag this article too much by writing too much, instead let’s explore the possible ways you can optimize your cloud costs, keeping the application healthy and happy.
Elastic Block Storage — EBS
Upgrade your GP2 EBS volumes to GP3.
In Ohio, 1TB of GP2 volume costs 102.40 USD whereas 1TB of GP3 volume costs 81.92 USD. Upgrading GP2 volumes is a straight forward process. You’d just right click on the volume > Modify volume > Select the ‘Volume Type’ to GP3 and hit ‘Modify’
Elastic IPs/Public IPs
Consider releasing unused Elastic IPs
Though it may not be always possible, try to re-architecture your application to not depend on public/elastic IPv4. Effective February 1, 2024 a charge of $0.005 USD per IP per hour for all public/elastic IPv4 addresses was imposed by Amazon. So imagine you have one hundred servers with Public IP/Elastic IP attached, you will incur 365.00 USD a month.
NAT Gateway costs around 30.00 USD, Load Balancer costs around 15.00 USD. Group those one hundred servers and come up with a solution that utilizes these technologies while running your application in a more private and secure environment.
Data Lifecycle Manager
Configure policies to take snapshots and AMIs
You Can Choose Either Count or Age
Instead of manually taking or writing any custom script to take a Snapshot/ AMIs, your life will become simpler when you configure Lifecycle Policies to take Snapshot/AMIs. You will be able to specify the number/age of Snapshots/ AMIs to retain so that the older resources will be under control.
Rightsizing the EC2 Instances
Monitor EC2 Usage
Know the type of workload you’re running in the instances and choose an instance type accordingly.
- For General Purpose use either T or M
- CPU intensive application — use C
- Memory intensive — use R or X
- Storage intensive — use I
Once you provision the server, continuously monitor the usage for a few weeks. Upgrade or downgrade the instance type as per the observed metrics. Turn on the AWS Compute Optimizer Service and follow the recommendations it observes.
PS. While most of the recommendations would advise you to convert the instance type from Intel to Graviton, make your application thoroughly tested on a Graviton processor.
Cloudwatch Log Groups
Monitor the usage of Put Log Event API
It is very easy to configure the services to log to Cloudwatch Log Groups. If you encounter heavy write operations to these log groups, your Cloudwatch bill is gonna spike. For example, when you turn on VPC Flow Logs:
- For 10GB log ingested in Cloudwatch Log Groups, you will have to pay 5.00 USD
- For 10GB log ingested in S3, you just need to pay 2.50 USD
So you decide on the storage type. Also, if a custom application is configured to write DEBUG logs to Cloudwatch Log Group or when you turn on VPC Flow Logs on a heavy-traffic VPC, you might end up paying the majority of your AWS bill for the Cloudwatch.
Cloudwatch Detailed Monitoring for EC2 Instances
Turn off Detailed Monitoring if not needed
Option to enable detailed Cloudwatch Monitoring
Detailed monitoring records your metrics with one minute granularity. However, when you click this simple check box while provisioning an EC2 Instance, you are also paying 2.10 USD per month per instance. So in our one hundred EC2 instances example, the total bill for detailed monitoring will be 210.00 USD.
RDS — Storage Type
Change the default RDS Storage Type
When you click the ‘Create database’ button in Amazon RDS Service and select MySQL from the list, you will be able to see the storage type is io2 and the allocated storage is 400GB by default.
- Cost is 300.00 USD for 400GB io2
- Cost is 92.00 USD for 400GB gp3
In most cases GP3 storage would suffice. So watch out carefully and go through ALL the options while creating the instance.
RDS — Extended Support
Upgrade your database to 8.x
If you want to run an older version — 5.x of MySQL in an m5.large instance for a month, add 292.00 USD towards MySQL Extended Support Plan. To bypass this charge, you would need to upgrade the instance to 8.x. This upgrade would need a change in your application code/logic. Please carefully plan the upgrade.
RDS — Performance Insights
Use it free for seven days or spend cash
Performance Insights is RDS ‘way of showing extended MySQL metrics that helps troubleshoot and optimize queries. The price is based on the number of vCPUs of the provisioned RDS instance.
This feature is free for seven days. If you want to retain metrics for one month for.
- m5.large instance with 2vCPU — 3.00 USD
- m5.xlarge instance with 4vCPU — 6.00 USD
RDS — Backup Storage
Plan your backup strategy
Backup storage is free till the 100% of the original database size. That said, out of the previously provisioned 400GB of storage in RDS we are using 200GB for database and backup of size 200GB is free. Anything beyond will cost us.
Example:
Instance Size — 400GB
Database Size — 200GB
Daily Incremental Size — 10GB (5% of Database Size)
Keep the backup for 30 days — 10GB x 30 days = 300GB
Free allocation of 200GB — 300GB — 200GB = 100GB
Price per GB backup storage — 0.095USD
Final calculation — 100GB x 0.095USD = 9.5USD
Build Smarter Data Solutions on AWS
Curious About AWS Best Practices?
Our AWS consulting team brings years of enterprise cloud experience to help you architect, optimize, and secure your cloud infrastructure. Let’s explore the possibilities!