DEV Community

Cover image for Resizing AWS RDS and Aurora Instances with Minimal Downtime: A Comprehensive Guide
Guille Ojeda for AWS Community Builders

Posted on • Updated on • Originally published at blog.guilleojeda.com

Resizing AWS RDS and Aurora Instances with Minimal Downtime: A Comprehensive Guide

If you're managing your databases in the cloud with AWS RDS or Aurora instances, choosing the right instance size is crucial. You want to ensure that your instance can handle the traffic generated by your application while also avoiding overprovisioning and keeping costs down. In this guide, we will provide you with best practices for rightsizing your AWS RDS or Aurora instance.

Understanding AWS RDS and Aurora Instances

Before diving into rightsizing, it's essential to know the basics of AWS RDS and Aurora instances. RDS is a fully managed service that makes it easy to set up, operate, and scale a relational database in the cloud. Aurora, on the other hand, is a MySQL and PostgreSQL-compatible relational database engine that is fully managed and designed to be more performant than RDS. Both RDS and Aurora instances come in different sizes, or "instance types," that are optimized for different workloads.

Understanding AWS RDS Instance Types

The different instance types available can be divided into several families, each with their unique characteristics. The most commonly used instance families are:

  • db.r6g: This family is designed for memory-intensive workloads, such as in-memory databases, high-performance computing, and data-intensive workloads.

  • db.t4g: This family is designed for low-cost, general-purpose workloads, including development and test environments, small-scale production workloads, and applications that don't require a lot of CPU power.

  • db.m6g: This family is designed for general-purpose workloads and is optimized for a balance of compute, memory, and network resources.

Picking the Initial Size for RDS Instances

Selecting the appropriate initial size for your RDS or Aurora instance is crucial to ensure it can handle the expected workload. To do so, you should consider several factors, including the workload, traffic, and expected growth. AWS RDS and Aurora instance types and families can serve as a guide to select the right initial size for your workload.

For example, if you're expecting a moderate amount of read and write requests, with a moderate amount of data and simple queries, you can start with a db.t4g.medium instance type. If you're expecting a high amount of read and write requests, with a large amount of data and complex queries, you can start with a db.m6g.large instance type.

Once you have launched the instance, it's essential to monitor its performance using AWS RDS and Aurora performance metrics. These metrics, such as CPU utilization, memory usage, and I/O operations, can help you evaluate the instance's performance and identify when to resize.


If you're interested in learning AWS, subscribe to the free newsletter Simple AWS. 1500 software experts already have.


Identifying When to Rightsize RDS Instances

Rightsizing your RDS or Aurora instance involves adjusting the resources to match the actual usage of your workload. This can include adjusting the CPU, memory, and storage of your instance to better match the needs of your application. Several methods can be used to identify when to rightsize, including:

CloudWatch Metrics

  • Step 1: Go to the CloudWatch Console.

  • Step 2: Select the desired time range for your metrics.

  • Step 3: Locate your RDS or Aurora instance and select the "DBInstanceIdentifier"

  • Step 4: Check the metrics for CPU, Memory and Storage usage.

  • Step 5: Compare the usage with the current configuration of your instance and determine if there is an opportunity to rightsize.

Performance Insights

  • Step 1: Go to the RDS or Aurora Console.

  • Step 2: Select your RDS or Aurora instance.

  • Step 3: Click on the "Performance Insights" button.

  • Step 4: Check the metrics for CPU, Memory and Storage usage.

  • Step 5: Compare the usage with the current configuration of your instance and determine if there is an opportunity to rightsize.

SQL Query

  • Step 1: Connect to your RDS or Aurora instance using SQL client.

  • Step 2: Run the following query: "SHOW STATUS WHERE variable_name = 'Threads_connected'"

  • Step 3: Check the value of the "Threads_connected"

  • Step 4: Compare the value with the current configuration of your instance and determine if there is an opportunity to rightsize.

By using a combination of these methods, you can gain a better understanding of the usage patterns of your RDS or Aurora instance and make informed decisions about when to rightsize.

Resizing RDS Instances with Minimum Downtime

Resizing your RDS or Aurora instance involves modifying its instance type or storage capacity. When resizing, it's important to keep downtime to a minimum to avoid impacting your application's availability and business continuity. To minimize downtime, you can take the following steps:

  • Step 1: Create a read replica of your RDS or Aurora instance in the same Availability Zone as the original instance.

  • Step 2: Verify that the read replica is in a "Ready" state.

  • Step 3: Promote the read replica to be a standalone database. This ensures that any data written to the original instance during the migration process is also available on the new instance.

  • Step 4: Modify the DNS entry or connection string of your application to point to the new primary instance.

  • Step 5: After the DNS change propagates, ensure that your application can successfully connect to the new instance.

  • Step 6: Test your application thoroughly to ensure that it works as expected.

  • Step 7: Finally, delete the original DB instance.

By following this process, you can resize your RDS instance with minimal downtime and without losing any data. However, it's important to note that there may still be a short period of downtime during the switch-over process, typically around 1-2 minutes. It's also a good idea to take a snapshot of your RDS instance before resizing it, in case you need to roll back the changes.

Conclusion

Choosing the right size for your AWS RDS or Aurora instance is crucial to ensure optimal performance and cost efficiency. By understanding the basics of instance types and families, picking the right initial size, identifying when to rightsize, and resizing with minimum downtime, you can optimize your database performance and reduce unnecessary costs. Remember to regularly monitor the performance of your instances and make adjustments as needed to keep your applications running smoothly.


Thanks for reading!

Subscribe to the Simple AWS newsletter.

Join 1500+ software experts learning how to solve complex problems in AWS with simple solutions and best practices.

  • Real scenarios, solutions and best practices

  • A new issue every Friday

  • Completely free

Also, enjoy a 25% discount on the book Node.js on AWS: From Zero to Highly Available Hero using discount code SIMPLEAWS.

If you'd like to know more about me, you can find me at www.guilleojeda.com

Latest comments (2)

Collapse
 
yehorherasymchuk profile image
Yehor Herasymchuk

Great post, it's very informative and provides a step-by-step guide on how to rightsize your AWS RDS or Aurora instances. It's important to understand the basics of RDS and Aurora instances and the different instance types available, as this will help in picking the right initial size for your instance. The post also provides useful tips on how to monitor the performance of your instance and when to resize it. Overall, a great resource for anyone looking to optimize their RDS or Aurora instances for cost and performance.

Collapse
 
guilleojeda profile image
Guille Ojeda

Thank you for the kind words Yehor!