DEV Community

Cover image for Building Highly Available Applications with Aurora Serverless
Sushant Gaurav
Sushant Gaurav

Posted on

Building Highly Available Applications with Aurora Serverless

Amazon Aurora Serverless is a dynamic, on-demand version of Aurora that automatically scales database capacity based on application needs. This eliminates the need for manual database provisioning, making it ideal for applications with unpredictable workloads.

Why Choose Aurora Serverless for High Availability?

Traditional databases require predefined instance sizes, leading to either over-provisioning (wasted costs) or under-provisioning (performance bottlenecks). Aurora Serverless addresses these challenges by:

  • Auto-scaling database capacity in real time.
  • Pay-per-use pricing, charging only for consumed resources.
  • Instant pause and resume, reducing operational costs.
  • Multi-AZ replication, ensuring high availability and durability.

How Aurora Serverless Works

Aurora Serverless runs on an Aurora Storage Layer that automatically adjusts capacity based on query demand. It operates through the Aurora Capacity Unit (ACU), which measures compute and memory resources.

Image description

  • Aurora Serverless Proxy: Manages database connections dynamically.
  • Aurora Compute Layer: Adjusts based on ACUs.
  • Aurora Storage Layer: Automatically scales up to 128TB.

Deploying an Aurora Serverless Database

To create an Aurora Serverless database, use the AWS CLI:

aws rds create-db-cluster \
    --engine aurora-mysql \
    --engine-mode serverless \
    --db-cluster-identifier my-aurora-serverless \
    --master-username admin \
    --master-user-password mypassword \
    --scaling-configuration MinCapacity=2,MaxCapacity=8
Enter fullscreen mode Exit fullscreen mode
  • --engine-mode serverless: Enables the Serverless mode.
  • MinCapacity=2,MaxCapacity=8: Defines scaling limits in ACUs.

Best Practices for High Availability

To maximize high availability with Aurora Serverless, follow these best practices:

Use Multi-AZ Deployment

  • Enable automatic failover across multiple AWS Availability Zones.
  • Reduces downtime to under 30 seconds during failures.

Optimize Connection Management

  • Use Amazon RDS Proxy to efficiently manage thousands of connections.
  • Reduces latency spikes from connection overhead.

Configure Auto-Pause for Cost Efficiency

  • Set idle timeout to pause Aurora Serverless when not in use.
  • Example CLI configuration:
aws rds modify-db-cluster \
    --db-cluster-identifier my-aurora-serverless \
    --scaling-configuration AutoPause=true,SecondsUntilAutoPause=300
Enter fullscreen mode Exit fullscreen mode
  • AutoPause=true: Enables automatic pausing.
  • SecondsUntilAutoPause=300: Pauses after 5 minutes of inactivity.

Monitor Performance with CloudWatch

  • Enable Amazon CloudWatch for tracking:
    • Query latency (DatabaseConnections)
    • Auto-scaling events (ServerlessDatabaseCapacity)
    • Read/write throughput (WriteIOPS, ReadIOPS)

Use Cases for Aurora Serverless

Aurora Serverless is ideal for:

  • Event-driven applications: Scales with demand (e.g., ticketing systems).
  • Multi-tenant SaaS platforms: Handles unpredictable workloads.
  • IoT and analytics workloads: Runs queries on-demand.
  • Development and testing environments: Cost-effective database instances.

Aurora Serverless vs. Provisioned Aurora

Feature Aurora Serverless Provisioned Aurora
Scaling Auto-scaling Manual scaling
Pricing Pay-per-use Fixed instance pricing
Pause & Resume Yes No
Multi-AZ Failover Yes Yes
Use Case Unpredictable workloads Constant workloads

Conclusion

Amazon Aurora Serverless enables high availability, auto-scaling, and cost efficiency, making it ideal for applications with variable traffic patterns. By leveraging multi-AZ replication, RDS Proxy, and auto-pause configurations, businesses can maximize database availability while reducing costs.

In our next article, we will explore Amazon Redshift, its architecture, and how it enables fast, scalable data warehousing. Stay tuned!

Top comments (0)