Currently my read replicas only scale out to keep the average cpu use at 70%, this leads to a brief period where there is very few and they're taking all the load making my application slow.
How do I preemptively scale them out in preparation for this sudden load, from what I see you can't actually trigger the scaling operations manually using cloudwatch alarms?
Since you wish to preemptively modify the number of read replicas, it is not possible to trigger the scaling from an Amazon CloudWatch Alarm (since the need to scale has not yet happened).
Instead, you could call modify_db_cluster()
, specifying a higher MinCapacity
. This will cause the cluster to launch at least that many Read Replicas, so it will be ready for your usage spike.
Later in the day, you could make another call to lower the MinCapacity
that it can scale down to.
You could put these calls in AWS Lambda functions, using Amazon CloudWatch Events to trigger the functions at the desired times.
Great idea, thank you
It's worth noting for future readers I was using aurora and modify_db_cluster() only allows the scaling policy to be modified when in serverless mode, which I was not, instead I changed my aurora replica policy via docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/…