By using AWS re:Post, you agree to the Terms of Use

Cannot find HTTP API by name in Cloudwatch metrics

0

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 Answers
2

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.

answered a month ago
  • 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?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions