DEV Community

Cover image for Scaling to Zero with Amazon Aurora Serverless v2
Anuj Tyagi
Anuj Tyagi

Posted on

Scaling to Zero with Amazon Aurora Serverless v2

Amazon Aurora Serverless v2 takes serverless database management to the next level by supporting scaling down to zero Aurora Capacity Units (ACUs). This feature allows you to optimize costs during periods of database inactivity while benefiting from the robust capabilities of Aurora Serverless. Whether you're running a development environment, testing, or applications where a cold start is acceptable, this feature can significantly cut costs without compromising scalability.

What is Amazon Aurora Serverless v2?

Aurora Serverless v2 is an on-demand, auto-scaling configuration for Amazon Aurora. It automatically adjusts database capacity based on workload requirements and measures capacity in ACUs. One ACU includes approximately 2 GiB of memory, along with CPU and networking resources equivalent to provisioned Aurora instances. With scaling options now ranging from 0 to 256 ACUs, Aurora Serverless v2 offers unparalleled flexibility and cost optimization.


Why Scale to 0 ACUs?

The automatic pause and resume feature enables Aurora Serverless v2 to pause database activity after a specified idle period. During this pause, no compute costs are incurred—only storage costs are billed. When user activity resumes, Aurora seamlessly scales up to meet the demand. This process typically takes less than 15 seconds.

Ideal Use Cases

  • Development and Testing: Cost-efficient for environments with sporadic usage.
  • Cold Start Applications: Suitable for workloads that tolerate a short resume time.

How to Enable Scaling to 0 ACUs

Prerequisites

Ensure your Aurora version is compatible:

  • Aurora PostgreSQL-Compatible Edition: Version 13.15 or higher
  • Aurora MySQL-Compatible Edition: Version 3.08.0 or higher

Configuring Automatic Pause

You can configure this feature while creating a new database or modifying an existing one. To set up the automatic pause:

  1. Set the minimum capacity to 0 ACUs.
  2. Specify the idle timeout duration (300 to 86,400 seconds) before pausing.

Example AWS CLI command:

aws rds create-db-cluster \
  --db-cluster-identifier my-serverless-v2-cluster \
  --region us-east-1 \
  --engine aurora-postgresql \
  --engine-version 16.3 \
  --serverless-v2-scaling-configuration MinCapacity=0,MaxCapacity=4,SecondsUntilAutoPause=600 \
  --master-username myuser \
  --manage-master-user-password
Enter fullscreen mode Exit fullscreen mode

Understanding the Pause and Resume Mechanism

When a database is paused:

  • The status remains Available, but compute billing halts.
  • Metrics like CPUUtilization and ACUUtilization report 0% in Amazon CloudWatch.
  • Cluster-level events are logged, including pause initiation and completion.

Scenarios Preventing Auto-Pause

  • Open user connections.
  • Logical or binlog replication enabled.
  • Aurora RDS Proxy maintains active connections.
  • Global database configurations (primary cluster writer instance).

When resuming, the database scales up based on workload demands. It’s important to implement retry logic in your client applications to handle resume delays gracefully.


Deployment Patterns

Development Environments

  • Single-AZ Cluster with automatic pause enabled to save compute costs.

High-Availability Applications

  • Multi-AZ Clusters with both writer and reader instances configured as Aurora Serverless v2.

Mixed Activity Workloads

  • Combine Aurora Serverless v2 with provisioned instances for critical components, while using auto-pause for low-priority readers.

Considerations for Automatic Pause

  • Reader instances with failover priority 0 or 1 will follow the writer instance's behavior.
  • Instances in secondary global clusters or with zero-ETL Redshift integration do not auto-pause.
  • Scheduled engine-specific jobs (e.g., autovacuum in PostgreSQL) do not trigger auto-resume.

Conclusion

By enabling 0 ACUs scaling, Aurora Serverless v2 delivers a cost-effective solution for databases with intermittent usage patterns. With the ability to scale up seamlessly when demand returns, this feature provides a perfect balance of cost savings and operational efficiency. Whether you're managing test environments or architecting cost-sensitive applications, Aurora Serverless v2 is a powerful tool for modern database management.

Reference: https://aws.amazon.com/blogs/database/introducing-scaling-to-0-capacity-with-amazon-aurora-serverless-v2/

Top comments (0)