Anyone familiar with creating cloudwatch alarms or...
# help
d
Anyone familiar with creating cloudwatch alarms or datadog monitors that monitor across an entire apigateway for 5xx errors? I can see options to create a metric/alarm per lambda in cloudwatch, but unable to see an option to create an "umbrella"/catchall alarm.
f
Hey @Dennis Dang, if you are using
sst.Api
for your Api, access log is enabled by default. And the access log from all routes goes to the same Log Group. You shouldn’t be creating metric/alarm on Lambda log for 5xx errors?
d
@Devin Blair Maybe we can formulate some better questions here for help.
@Frank yeah not trying to that for lambdas. Was hoping to abstract over the gateway itself. Still digging around, but if you have any intuition to achieve this, would love to know
f
You can try:
Copy code
api.httpApi.metricServerError().createAlarm(this, "ApiErrorAlarm", {
  threshold: 100,
  evaluationPeriods: 2,
});
So Api has a set of built-in metrics, and you create alarms for them https://docs.aws.amazon.com/cdk/api/latest/docs/aws-cloudwatch-readme.html#alarms
d
This looks promising. Thank you!
We will look into this.
Any experience implementing this? If so, have you integrated this with Slack?
d
As we've discussed, we can likely use the chatbot cdk as well to integrate with the alarm.
f
Oh wow didn’t know about AWS Chatbot 😂 Interesting!