Amazon Relational Database Services (AWS RDS) provides customers with an easy-to-manage avenue to set up, operate, and scale databases in the cloud. However, the flexibility and scalability offered by AWS RDS come at a price. Multiple factors contribute to the RDS cost for a resource, including DB class and instance type, DB storage, backups, and data transfer. These costs can quickly spiral out of control if not backed with appropriate due diligence.
With RDS rightsizing, organizations can optimize RDS configuration on AWS for individual workload requirements and generate huge cloud cost savings. The objective is achieved by continually monitoring instance utilization and usage patterns for the workloads and rightsizing overprovisioned instances.
This article delves into the best practices for RDS rightsizing and optimization, which will help reduce cloud costs with no — or negligible — performance impact.
The table below summarizes the Amazon RDS rightsizing concepts we will explore further in this article.
Best practices | Description |
---|---|
Rightsize your RDS Instances | Analyze performance data (CPU utilization %, Memory utilization %, Disk IOPS) for AWS RDS instances to understand if resources are under-provisioned or over-provisioned. Rightsize an instance by migrating to a different SKU within the same instance family or from another instance family. |
Optimize Database Storage | Understand your workload requirements to choose the correct RDS storage option. Analyze AWS metrics, including ReadIOPS, WriteIOPS, ReadLatency, and WriteLatency, to inform a view of the appropriate IOPS rate for the database workload. |
Utilize RDS Reserved Instances | Purchase reserved capacity for a 1-year or 3-year term. Reservations for RDS provide up to a 60% discount over on-demand prices of comparable instance types. Customers can choose from available payment options – No upfront, All upfront, and partial upfront. |
Modernize RDS instances with Aurora | Migrate from AWS RDS instances to AWS Aurora instances for MySQL and PostgreSQL DBs workloads with low latency and high throughput requirements. Leverage serverless architecture to optimize costs for databases with intermittent workloads. |
General RDS optimization considerations | Follow best practices while setting up your RDS instances. For example, Select the correct region and instance family based on the price-to-performance ratio, turn off multi-AZ deployments for non-critical workloads, optimize queries, and remove non-critical backups. |
Amazon RDS provides users the flexibility and scalability to upsize or downsize the provisioned resources based on their application’s current and future requirements.
Without proper supervision, engineering teams frequently over-provision instance sizes and storage, which results in excessive cloud costs. Through rightsizing, you can match RDS configuration on AWS with workload requirements to improve resource utilization and reduce costs. Teams can achieve this objective by migrating to a different instance size within the same family (ex: 2xlarge to xlarge) or cross-family to a different instance type (ex: db. r5 to db.m5)
RDS Instance Class | RDS Instance family | RDS Instance size |
---|---|---|
General purpose | db.m3, db.m4, db.m5, db.m6g, db.m6i, db.m7g | Large, xlarge, 2xlarge, 4xlarge, 8xlarge, 12xlarge, 16xlarge, 24xlarge |
Memory Optimized | db. r4, db. r5, db.r6i, db.r6g, db.r7g | Large, xlarge, 2xlarge, 4xlarge, 8xlarge, 12xlarge, 16xlarge, 24xlarge |
Burstable – performance | db.t2, db.t3, db.t4g | Micro, small, medium, large, xlarge, 2xlarge |
Optimized Reads | db. r6id, db. r6gd | Large, xlarge, 2xlarge, 4xlarge, 8xlarge, 12xlarge, 16xlarge |
RDS Instance Families and sizes (Source)
Spend less time optimizing Kubernetes Resources. Rely on AI-powered Kubex - an automated Kubernetes optimization platform
Free 60-day TrialRightsizing an AWS RDS instance involves a series of steps:
1) Evaluate monitoring data
RDS performance metrics should be monitored and evaluated over a full business cycle (typically 60-90 days) to gain insights into historical usage patterns and identify peak usage times for the resource. Useful metrics for evaluating RDS rightsizing decisions include:
The metric utilization combined with application requirement analysis can help inform decisions regarding whether a resource is idle and should be deleted, whether a resource is overprovisioned and should be downsized or whether a resource is under-provisioned and should be upgraded.
Densify enables organizations to automatically collect and aggregate their RDS CloudWatch metrics data at a granular level. It then categorizes resources as under-provisioned or over-provisioned using advanced data aggregation and customer defined rules to aid decision-making for the application owners.
Utilization metrics for RDS instances
2) Selecting the right instance type
AWS provides customers the flexibility to choose between instance families and sizes based on workload requirements. Once you have analyzed your historical usage patterns and workload requirements, you can rightsize an RDS instance by either migrating to:
or
The decision to migrate to another instance type should be evaluated carefully based on workload requirements, as each instance type supports a certain number of vCPU, memory, disk bandwidth, and network capabilities.
Automated solutions like Densify leverage machine learning algorithms to select amongst thousands of instance types segregated by region, instance families, DB engine, performance specifications, and cost considerations.
Monitoring the instance resource post-rightsizing and ensuring continuous feedback and optimization is essential to ensure optimal resource allocation without impacting performance.
RDS Utilization post-rightsizing
Spend less time optimizing Kubernetes Resources. Rely on AI-powered Kubex - an automated Kubernetes optimization platform
Free 60-day TrialAmazon RDS provides you with the option of selecting from three types of storage:
AWS typically categorizes gp2/gp3 disks as ideal for small to medium workloads that don’t require high sustained IOPS performance. The Provisioned IOPS SSD is a more advanced offering where you can provision the IOPS required for your workloads. This offering suits workloads requiring high throughput, low latency, and sustained performance.
But before committing provisioned IOPS SSD, it is important to assess the performance of gp3 storage for the same workload. Based on empirical observations, gp3 disks are sufficient for most small to medium workloads and provide low latency and consistently high throughput for production applications.
The most important metrics you need to monitor to decide between storage options for your DB are:
A transition to gp3 disks can save up to 50% over the corresponding provisioned IOPS disks. Unlike gp2 disks, gp3 disks decouple storage and IOPS and provide an option to provision IOPS based on workload requirements.
The storage type for an RDS instance can be changed through the AWS Console or AWS CLI.
Sample CLI Code:
aws rds modify-db-instance \ --db-instance-identifier YourDBInstanceIdentifier \ --storage-type gp2
Selecting the right storage type based on the application and workload requirement can generate consistent savings.
Reserved Instances provide an effective way for you to make your RDS costs predictable and use discounted pricing to save cloud costs. Specifically, RIs allow users to reduce RDS costs by committing to a fixed usage over a 1-year or 3-year period. With this commitment to a fixed number of DB instances, you can get up to a 60% discount over the on-demand price of the RDS instance.
Several pricing factors influence the discounts that you can get over the on-demand price:
These discounts will apply only to the instance costs. Other RDS cost components like storage, data transfer, provisioned IOPS, etc., are not covered by Reserved Instances. RDS RI discounts apply only to a specific instance family, and unlike convertible EC2 RIs, users can’t transfer them to a different instance family. Within the same instance family, AWS provides instance size flexibility. Ex: 1 reserved m6g.xlarge RI can cover usage for two m6g.large RDS instances.
There is also a risk of over-committing and purchasing more Reserved Instances than needed. This overprovisioning can result in low utilization for RIs and lead to wastage. Therefore, evaluating current RDS utilization and estimating future RDS usage is vital before committing to a particular instance type, region, or payment term. Densify can help avoid the underutilization of Reserved Instances by syncing rightsizing recommendations with RI utilization and deferring recommendations until RIs expire.
RDS Price Comparison (Region: US East, Engine: MySQL)(Source)
Spend less time optimizing Kubernetes Resources. Rely on AI-powered Kubex - an automated Kubernetes optimization platform
Free 60-day TrialAWS Aurora is designed as a cloud-native solution that can be used to power performance-intensive applications with very high availability and scalability. In certain cases, Aurora databases can provide more than 3x the performance of MySQL and PostgreSQL without modifying the underlying workloads.
In addition to superior performance, these instances offer several other advantages:
Scalable performance
In traditional RDS instances, IOPS must be provisioned beforehand by the engineering team. This frequently results in increased costs due to over-provisioning. AWS Aurora solves this challenge by scaling I/O automatically without the need for manual provisioning.
Greater availability
MySQL and PostgreSQL instances’ failover processes, though robust, are slow, which can affect the availability of workloads in case of a disaster. Aurora allows for more than 3x the read replicas of traditional RDS instances and supports automated backups. Its faster architecture allows for instant failovers and reduces the chances of downtime.
Cost-effective
Aurora Serverless provides a cost-effective and scalable option for organizations with workloads that have fluctuating traffic. It provides an on-demand autoscaling configuration that scales database configuration automatically to meet workload requirements while retaining all functionalities of AWS Aurora.
AWS Aurora is an ideal solution to modernize enterprise applications like CRM and ERP and can be used to support high-performance SaaS applications.
The migration of RDS from PostgreSQL or MySQL to Aurora instance is easy and can be performed by using a snapshot or using an Aurora Read Replica.
Other general RDS considerations that can help you control your RDS costs significantly are:
Manual snapshots created by users are one of the overlooked cost components of AWS RDS. These snapshots persist and get charged even after you have deleted your database instance. AWS doesn’t delete the backups unless explicitly requested by the users. Therefore, it is essential to periodically review the snapshots for RDS and remove backups that are no longer required.
Selecting the correct region for your database can have a significant influence on your RDS bill in the future. Users need to analyze their usage and requirements and make an informed decision to select the region that offers the best tradeoff of latency and cost.
RDS Price Comparison across Regions (Engine: MySQL) (Source)
Multi-AZ deployments are another factor that needs to be optimized to reduce RDS costs. The multi-AZ deployment can enhance the availability and reliability of the workloads by replicating it in a different AZ. While this resiliency type is typically advisable for production workloads, it is generally not required for dev and test workloads.
To disable Multi-AZ for an RDS instance, you can use the following AWS CLI command:
aws rds modify-db-instance \ --db-instance-identifier YourDBInstanceIdentifier \ --no-multi-az-az
Other database elements like unused tables, indexes, views, and partitions will drive up the cost of RDS storage. Performing regular DB cleanups can reduce the unnecessary redundancy and reduce storage costs.
Similarly, it is important to incorporate engineering best practices while running queries, which would minimize continuous scaling up of instance usage. Users can leverage tools like Performance Insights, an AWS feature that shows database and OS information pinpointing where a query is slow (due to I/O, load, or CPUs).
Spend less time optimizing Kubernetes Resources. Rely on AI-powered Kubex - an automated Kubernetes optimization platform
Free 60-day TrialAmazon Relational Database Services (AWS RDS) is a powerful offering that allows customers to provision resources as per the application’s requirement and scale this resource up and down whenever required. This flexibility can result in rising cloud costs and bills if not appropriately monitored.
This post aims to give users practical insights to rightsize their AWS RDS resources. For actionable change, an organization must understand its database requirements and operations. Only then can customers make decisions that generate cost savings without compromising on performance or innovation.
Densify is a resource optimization solution that can help you with this challenge of rightsizing RDS instances to reduce both risk and waste. Densify’s patented, policy-based analytics engine learns the operational workload patterns of each instance and applies customer refined-policy to produce precise and accurate recommendations. When ready, the implementation of recommendations can be automated.