Best Practices for monitoring RDS in a Cost-Effective Way
AWS can be costly, and if you're using a tool like Finout to track your cloud spending, you may discover that Amazon RDS is making up a big part of your monthly bill.
Amazon's Relational Database Service allows you to offload the responsibility of managing a database, but as your database grows with time, so do your costs. In this article, we'll look at some strategies to reduce your Amazon RDS costs.
Choose the right database engine
The type of database technology you use on Amazon RDS will have a direct impact on your monthly costs.
Amazon offers six types of database engines: PostgreSQL, MySQL, MariaDB, MSSQL, Oracle and Aurora.
The first three are open source and generally the cheapest, with the latter three all being proprietary services. You can see a breakdown of their costs for the same instance type in the table below.
A comparison of cost for different RDS database engines (source)
Keep in mind that changing a database engine isn't easy. Your engineering team will need to know how to use the database and change the code to fit it. Still, if your use case allows you to make the switch and avoid licensing fees, you'll save a lot in the long run.
Rightsize your instances
Finding the right instance size for your workload is imperative to cutting Amazon RDS costs.
For example, Amazon RDS for PostgreSQL offers a total of 22 instances grouped into five families: “t”, “m”, “r”, “x” and “z”.
You should evaluate your database requirements like CPU, memory, and IOPs and then figure out what the best instance type for your usage is. After you choose your instance type, monitor the database via Cloudwatch. You can also enable Enhanced Monitoring (for a small fee). This will show how each process in the database is using memory and CPU. For example, if you have high memory with a chosen instance type, you can select a larger one or you can change the instance type after your monitoring process.
Each time you switch to a smaller instance, the database halves in size (except in some specific cases). This means a 50% savings on your monthly bill. Use Reserved Instances
Amazon lets you reserve a database instance for up to three years via Reserved Instances.
When you opt for a Reserved Instance plan, you can save a considerable amount on your overall spend. For example, reserving an instance for one year can save you up to 45% of your total cost.
When purchasing a Reserved Instance, you can choose between three payment options: All Upfront option, Partial Upfront, and No Upfront. The more you pay upfront, the greater the savings.
If you have a steady use case and a firm architecture for your system, using Reserved Instances is a great way to achieve substantial savings. Also, if you reserved and did not use some instances, you can list them for sale on the Amazon Marketplace.
Note: If you don't mind deploying and managing the database yourself, you can use EC2 instead of RDS and save up to 47% on your costs.
Rightsize database storage
AWS offers three types of storage which are General Purpose (SSD) Storage, Provisioned IOPS (SSD) Storage, and Magnetic Storage.
General Purpose SSD storage allocates a baseline IOPS performance and comes with bursting capacity. This means that the storage can throttle up IOPS, but only for short periods (in bursts).
Your goal is to choose a storage type with an IOPS rate that fits your workload. Choose one with too low of an IOPS rate, and your database will be slow to respond. Conversely, a storage type that has a high IOPS rate will result in waste and exorbitant costs.
You can use Cloudwatch metrics to monitor your current storage usage and set alarms whenever a set threshold is met. AWS won't charge you for this so it definitely makes sense to check things like memory, CPU, network I/O, open sessions and other metrics.
Clean your database
Cleaning your database from unused schemas, tables, columns and indexes will directly impact your RDS costs.
Caching and batching statements can improve performance and reduce RDS load and data transfer costs. You can use Enhanced Monitoring and database-specific tools like the MySQL slow query log to track and examine outliers that take up a lot of resources before optimizing them.
Remove manual snapshots
Manual snapshots in RDS . are retained even after you delete a database instance. Amazon will charge you for these according to its Backup Storage rate, which comes to $0.010 per GB per month (for the Ohio region). This means each TB of stored snapshots will cost you $10 per month. Make sure you review old snapshots and remove the ones you no longer need.
Disable multi-AZ in dev environment
Amazon RDS offers a type of deployment called Multi-AZ that creates a replicate of your database in a different Availability Zone in case the primary database fails.
Keep in mind that this feature doubles the hardware needed for database instances and storage, duplicating your cost in the process It's useful in production environments but it probably makes sense for you to disable it in development environments to reduce instance cost by 50%.
Optimize your queries and use read replica
Using read replicas helps to get reads from your databases faster and reduces the extra load on your main database.
For example, imagine you have a large column in your schema, and you need to get all that column via select, so if you do it in a production environment, it can be dangerous, and the database can get stuck in busy hours, but if you use read replicas, the select query will return result from read replicas and so your active database will not be affected from that query.
Choose the right region
There are many regions on AWS and it is important to select the right region for your system to avoid latency in a cost-effective way.
Some regions are more expensive than others, with the US and Europe generally being the cheapest. You should probably find out if it’s worth moving your database instances to a different region, though don't expect a huge impact on your price unless you're operating in an expensive region.
Reducing your Amazon RDS costs starts with considering your application's usage, scalability requirements, and key bottlenecks, which may affect the price and performance of your instances.
At Finout, we believe cloud costs should be easily understandable to teams across organizations. That's why we give teams a clear picture of their Amazon RDS costs and the ability to create custom dashboards to track metrics that matter to you.
Book a demo with one of our specialists to get a platform walkthrough.