Searching for methods to receive alerts when Hosted Zone records nearing limit

I want to get alerts when my Hosted Zone records get close to the limit. Can’t find a cloudwatch method. Any ideas?

For context:

AWS has a 10,000 record limit on hosted zones. With our set up, we hit that limit regularly and need to request limit raises. I want to never forget or have to check because AWS or Grafana tells me when we’re 500 records away.

I can’t find a CloudWatch alarm method. Does anyone have ideas on how this might be accomplished?

i would’ve thought this might have existed in Trusted Advisor through the GetAccountLimit API. but it is not.

Might have to run a lambda that queries total records in a hosted zone, Event trigger as when a new record is added perhaps. The put in a custom metric alarm that alerts you when a threshold is breached.

Right. I think I’ll need to do it with CLI. I don’t see any other way

aws route53 get-hosted-zone --id "zoneID" | jq -r '.HostedZone.ResourceRecordSetCount'

You could run that in a lambda, each time a new record is put. Say if you’re 100 record away from the limit, alarm you to raise a support request (or automate this part too)

It’s probably a bit overkill if all you care about is route53 records in a specific hosted zone, but AWS has a reference implementation for monitoring quotas here: https://github.com/aws-solutions/quota-monitor-for-aws