Cannot find HTTP API by name in Cloudwatch metrics

1

I have an HTTP API (API Gateway v2) and I have enabled the metrics.

Now, when I go to Cloudwatch and create a dashboard widget, I can't find this HTTP API in metrics by NAME. I can only find it by ID, but that's not what I want. I would like to find it by name.

Any chance you could point me to what went wrong, please?

1 個回答
1

According to the API Gateway documentation, the HTTP APIs CloudWatch metrics use their ApiId dimension as API ID. This is different from v1 REST API which uses ApiName for ApiName dimension.

A workaround I can think of within CloudWatch is to set a custom name for each graph in the dashboard to specify an API name. Another way would be using a REST API instead of HTTP API.

AWS
Taka_M
已回答 2 年前
  • Thank you for answer. Is there any chance you can provide more info about this part "set a custom name for each graph in the dashboard to specify an API name."? Also, is this doable using CloudFormation? Thank you again

  • You can name your graph or rename existing ones. Please see this documentation. For CloudFormation, when creating a AWS::CloudWatch::Dashboard resource, you specify the DashboardBody for the dashboard structure. You can leverage the title field for each widget to define the graph name.

  • Taka_M, the real issue is that I am deploying using serverless and sometimes I have to delete the CloudFormation stack which means the API Gateway gets deployed with a different ID. The real question is how do I keep the dashboard in sync with this Api ID that can change sometimes?

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南