DEV Community

Cover image for Aurora Serverless v2 scales to zero.. but how fast?
Paul SANTUS for AWS Community Builders

Posted on

11

Aurora Serverless v2 scales to zero.. but how fast?

During Pre:Invent season, AWS announced that Aurora Serverless v2 now scales down to zero, leaving no cost (except storage costs) to the customer.

Last week, I tuned one of my demo databases to use that feature... and it is so satisfying to actually see the "ServerlessDatabaseCapacity" metric go down to zero!

Image description

How fast does it resume?

Now, a database that scales to zero and takes 5min to wake up is a great opportunity to save money for a test environment, but certainly not for production. However, Aurora Serverless does much better, with an announced 15s time-to-full-capacity!!

I wanted to measure how fast this process does.. so I used my demo application, a Lambda-based PHP app (read this post!), an triggered a single HTTP call.

Here are the results:

Image description

First, the Lambda took 12 seconds to proceed (see the red dot in the top right corner in the previous screenshot). This is consistent with the information I got from the RDS DescribeEvents API:

<DescribeEventsResponse xmlns="http://rds.amazonaws.com/doc/2014-10-31/">
  <DescribeEventsResult>
    <Events>
      <Event>
        <Date>2024-12-06T14:05:43.121Z</Date>
        <SourceArn>arn:aws:rds:eu-west-1:REDACTED_FOR_SECURITY:cluster:aurora-cluster-demo</SourceArn>
        <SourceIdentifier>aurora-cluster-demo</SourceIdentifier>
        <SourceType>db-cluster</SourceType>
        <EventCategories>
          <EventCategory>serverless</EventCategory>
          <EventCategory>notification</EventCategory>
        </EventCategories>
        <Message>Initiated resume for the DB instance: DB_REDACTED_FOR_SECURITY due to user activity</Message>
      </Event>
      <Event>
        <Date>2024-12-06T14:05:56.374Z</Date>
        <SourceArn>arn:aws:rds:eu-west-1:REDACTED_FOR_SECURITY:cluster:aurora-cluster-demo</SourceArn>
        <SourceIdentifier>aurora-cluster-demo</SourceIdentifier>
        <SourceType>db-cluster</SourceType>
        <EventCategories>
          <EventCategory>serverless</EventCategory>
          <EventCategory>notification</EventCategory>
        </EventCategories>
        <Message>Successfully resumed the DB instance: DB_REDACTED_FOR_SECURITY</Message>
      </Event>
    </Events>
  </DescribeEventsResult>
  <ResponseMetadata>
    <RequestId>5cd9cbef-REDACTED_FOR_SECURITY-4ee987b34cb4</RequestId>
  </ResponseMetadata>
</DescribeEventsResponse>

Enter fullscreen mode Exit fullscreen mode

So, in that 12 seconds period, Aurora Serverless v2 was able to resume my DB instance and perform a query listing all the blog posts!!! Quite amazing!

This makes Aurora Serverless v2 scale-to-zero a suitable option, not only for your test environments, but also for all production workloads that have periods with no usage, and can sustain a "not-so-fast" response to first query. That includes a wide range of corporate apps (who uses your HR app at midnight??)

Pro-tip : to profit from this, make sure your app healthcheck don't perform any SQL queries!

Image of Datadog

Learn how to monitor AWS container environments at scale

In this eBook, Datadog and AWS share insights into the changing state of containers in the cloud and explore why orchestration technologies are an essential part of managing ever-changing containerized workloads.

Download the eBook

Top comments (0)

Create a simple OTP system with AWS Serverless cover image

Create a simple OTP system with AWS Serverless

Implement a One Time Password (OTP) system with AWS Serverless services including Lambda, API Gateway, DynamoDB, Simple Email Service (SES), and Amplify Web Hosting using VueJS for the frontend.

Read full post

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay