Scheduled Aurora Read Replica Scaling

0

Hi! We are currently using Amazon Aurora and want to scale the Read Replicas based on schedule instead of a Target Tracking Policy. While this is not natively available through the console, we plan on doing it through a Lambda function and an EventBridge rule. Is there a better way to approach our method?

1 Answer
1
Accepted Answer

Hello

Since you mentioned target tracking, I assume you have AutoScaling setup on the Aurora cluster. You can use Scheduled Scaling policies, which are a native part of Application AutoScaling (the service which tells RDS when to scale)

https://docs.aws.amazon.com/cli/latest/reference/application-autoscaling/put-scheduled-action.html

This will be simpler and cheaper (no Lambda costs) than EventBridge -> Lambda. Make sure you select a timezone when you set it up if you live in a country with time changes to account for those.


Summary: if you're only using scheduled actions and not target tracking, just set both the Min and Max in each scheduled action to the same value, and that's what the desired capacity will change to. If you're also using target tracking to handle bursts, you'll want to set the Min to the value you want desired to be at when scaling-out, and have the max be a bit higher to allow for additional scale-out to handle unexpected bursts of traffic

Details: The scheduled action sets the min and/or max values of the scalable target. If the desired capacity would be outside this new min/max range, then it will get dragged along with the new min/max values. A couple quick examples for scale-out, but the same concepts apply for scale-in (first column values before the action; middle column is the min/max set in the scheduled action; last column the values after the scheduled action triggers. NULL means the value wasn't included in the scheduled action)

Min/Max/DesiredMin/MaxMin/Max/DesiredComment
0/0/02/22/2/2Min and max set to 2, so desired gets increased to 2 to not be below min
0/1/1NULL/40/1/4Desired didn't go up since only the Max increased, and desired was still between Min and Max
0/1/22/42/2/4Desired went up by 1 so that it wasn't below Min. Max is 4 to allow for dynamic scaling
1/4/42/62/4/6Desired doesn't change since it was already higher (presumably from target tracking), and is still between Min and Max after the scheduled action.
AWS
answered 2 years ago
  • Thank you so much for this! I hope AWS will make this available through the console as well, not just via CLI.

    Cheers!

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions