I have api gateway set up with cdk code. I set up different alarms for ServerError and Latency. I also would like to set up a throttling alarm. I see how to set up throttling itself but I couldn't find how to set up alarm. All other alarms I set using aws-cloudwatch lib but api gateway doesn't have metricThrottles()
. What's a proper way to create throttling alarms with cdk for api gateway?
CodePudding user response:
It's a DIY job. API Gateway sends 4XX
error metrics to CloudWatch, but not 429
errors alone. To isolate throttles using the CDK, you would:
- capture the API logs in CloudWatch
- create a MetricFilter to isolate the
429
events - set an Alarm on that custom metric