0
0
AwsHow-ToBeginner · 3 min read

How to Scale an AWS RDS Instance Easily and Safely

To scale an AWS RDS instance, you can modify its instance class to a larger size for more CPU and memory, or increase storage size for more capacity. Use the AWS Management Console, CLI, or SDK to apply these changes, which usually cause a brief downtime during the update.
📐

Syntax

Scaling an RDS instance involves modifying its properties like DBInstanceClass for compute power and AllocatedStorage for storage size.

You can do this using AWS CLI with the modify-db-instance command:

  • --db-instance-identifier: The name of your RDS instance.
  • --db-instance-class: The new instance size (e.g., db.m6g.large).
  • --allocated-storage: New storage size in GB.
  • --apply-immediately: Whether to apply changes right away or during the next maintenance window.
bash
aws rds modify-db-instance \
  --db-instance-identifier mydbinstance \
  --db-instance-class db.m6g.large \
  --allocated-storage 100 \
  --apply-immediately
💻

Example

This example shows how to scale an RDS instance named mydbinstance to a larger instance class and increase storage to 100 GB immediately using AWS CLI.

bash
aws rds modify-db-instance \
  --db-instance-identifier mydbinstance \
  --db-instance-class db.m6g.large \
  --allocated-storage 100 \
  --apply-immediately
Output
{ "DBInstance": { "DBInstanceIdentifier": "mydbinstance", "DBInstanceClass": "db.m6g.large", "AllocatedStorage": 100, "DBInstanceStatus": "modifying", "Engine": "mysql", "Endpoint": { "Address": "mydbinstance.abcdefg.us-east-1.rds.amazonaws.com", "Port": 3306 } } }
⚠️

Common Pitfalls

  • Not applying changes immediately: If you omit --apply-immediately, changes wait for the maintenance window, delaying scaling.
  • Choosing unsupported instance classes: Some instance classes may not be compatible with your database engine or version.
  • Insufficient storage increase: Storage size can only be increased, not decreased, so plan accordingly.
  • Ignoring downtime: Scaling usually causes a short downtime; plan for it to avoid service disruption.
bash
aws rds modify-db-instance \
  --db-instance-identifier mydbinstance \
  --db-instance-class db.t2.micro

# This is a smaller instance class and may cause performance issues if scaling down unintentionally.

# Correct approach:
aws rds modify-db-instance \
  --db-instance-identifier mydbinstance \
  --db-instance-class db.m6g.large \
  --apply-immediately
📊

Quick Reference

  • Instance Class: Controls CPU and memory (e.g., db.m6g.large).
  • Storage Size: Increase only, in GB.
  • Apply Immediately: Use --apply-immediately to avoid waiting.
  • Downtime: Expect brief downtime during scaling.

Key Takeaways

Scale RDS by modifying instance class for compute or storage size for capacity.
Use --apply-immediately to apply changes right away and avoid waiting.
Storage size can only be increased, not decreased.
Expect a short downtime during scaling operations.
Choose instance classes compatible with your database engine and version.