Amazon Relational Database Services (RDS) enables any service to access a maintenance-free elastic relational database—at least maintenance-free from a user’s perspective. Minimal up-front engineering effort to use a relational database service does come with a cost.
RDS costs are a composite of EC2 compute, EBS data storage, IO, and outbound data transfers. These costs are measured by provisioned capacity and (in some cases) by consumed capacity (e.g., provision a,
On-demand monthly cost for a db.r3.4xlarge RDS instance running MySQL provisioned with 1000GB of gp2 storage would be $1494.70 ($1379.70 for db.r3.4xlarge instance + $115 storage). This is a minimum cost. Data transfers out of RDS add additional cost—as do backups. AWS charges customers for the provisioned capacity. It is your responsibility to optimize what you have paid for.
Customers may monitor RDS utilization information using AWS console and right-size RDS instances and attached storage. Alternatively, customers may use third party tools such as Apptio Cloudability to automate the entire process of monitoring and taking actions to keep RDS instances optimized all the time.
Other simple steps to manage RDS costs:
RDS offers great benefits of relational data models and convenient SQL queries. However, it is a relatively expensive way for storing data. Do an architecture assessment to make sure that a project really needs RDS. Use an e-commerce project as an example, RDS is appropriate for sales transaction data due to its ACID property. On the other hand, product descriptions and pictures could be stored in cheaper storage systems such as S3.
Do a small pilot project to try out different instance types and collect database usage patterns. When selecting an instance type, consider that a service workload may fluctuate during a day, on different day of a week, and throughout a year. There is no need to overprovision the instance based on unreliable workload predictions. There are always opportunities to switch instance types. Be aware that instance type switching requires downtime.
Create a data lifecycle management policy. For data that are not accessed for a while, have an automation tool to move them off RDS to a less costly storage service such as S3. Sometimes the raw is not needed after they are processed. For example, after monthly business reports are generated and stored in S3, the original data on RDS may no longer needed and can be removed from RDS. Company data retention policy also impacts how long data need to be kept in RDS.
Due to widespread knowledge of SQL and convenience of using RDS, resist the temptation of using it as a data dump. Set up a policy and train developers so that only data that need to be in RDS are stored in it. Review the schema periodically and optimize it for RDS.
Carefully design SQL queries to minimize the number of requests needed to generate a result. For example, instead of making multiple requests to produce a daily sales report, use SQL join or stored procedure to generate a sales table in one request.
Use a cache to reduce RDS load and data transfer cost. You may use AWS ElastiCache or your own cache mechanism. Adding a cache layer increases the complexity of your project. However, in the long run, cost saving as well as service performance could prove the benefit is well worth the effort.
For planned workload, smooth out RDS utilizations in the span of the workload. Typical provisions of RDS need to meet the peak workload requirements. Reducing peaks and valleys of workloads allows optimal provisions of RDS instance types.
Although following these steps seem to be a lot of work, they are already often taken for on-promise projects. The benefit of these steps may be vague for on-promise projects. But they are obvious in AWS when the monthly bill comes in.
Sometimes, simple housekeeping could reduce monthly AWS bill significantly. Apptio offers advanced machine learning driven RDS Optimization. Apptio customers automatically detect unused and under-utilized RDS instances and suggest corrective actions or schedules for utilization.
Editor's note: This post was originally published on the now retired FittedCloud blog (January 2018).
A hybrid IT approach offers the best of both on-premises and public cloud by keeping costs and risk low while increasing efficiency and speed. But monitoring and optimizing hybrid environments is complicated.
Apptio® Cloudability provides cost and resource optimization capabilities across all leading public cloud providers (AWS, Azure and Google Cloud) so IT leaders can increase the efficiency of public cloud spending and slash waste from over-purchase and underuse. Try Apptio Cloudability for free.