Skip to content

How to Monitor API Gateway Request Count(SUM) in CloudWatch Without Enabling Logs

0

Hi everyone,

I need help understanding how to monitor which API Gateway (both REST API and HTTP API) has generated the highest request count using CloudWatch. My goal is to identify which API is contributing the most to my request-related costs for this month.

I’ve checked CloudWatch Metrics under AWS/ApiGateway and found the Count metric, but I’m unsure how to break it down by API name or endpoint without enabling CloudWatch Logs.

What I’m looking for: A way to track request counts per API without enabling API Gateway logging.

Insights into which specific API (or endpoint) is responsible for the highest request fees this month.

Whether I can use CloudWatch Metrics, Insights queries, or other AWS tools to achieve this.

If anyone has experience with this or knows a better way to track API-related costs efficiently, I’d really appreciate your insights!

Thanks in advance!

2 Answers
1

To monitor API Gateway request counts per API without enabling CloudWatch Logs, follow these steps:

  1. Navigate to CloudWatch:

    • Open the AWS Management Console.
    • Go to the CloudWatch service.
  2. Select Metrics:

    • Click on “Metrics” in the left navigation pane.
    • Choose “API Gateway” under the “AWS Namespaces” section.
  3. View Metrics by API:

    • Filter by specific API names or endpoints using dimensions like ApiName or Stage.
  4. Create a Graph:

    • Select the Count metric for each API you want to monitor.
    • Add each API’s Count metric to the graph for comparison.
  5. Use API Gateway Dashboard:

    • Open the API Gateway service in the AWS Management Console.
    • Go to the “Dashboard” section to view an overview of your APIs, including request counts.

For more detailed information, refer to the AWS API Gateway Metrics documentation.

AWS
answered 10 months ago
  • Thanks for sharing.

    I follow Create a Graph:

    Select the Count metric for each API you want to monitor. Add each API’s Count metric to the graph for comparison.

    But what I would like to understand, for example, over the past 7 days, how many times each API was called in total. How can I calculate this?

    Thanks again.

0

You can monitor API Gateway request counts and identify which APIs are generating the highest traffic without enabling CloudWatch Logs. Here's how you can accomplish this:

  1. Use CloudWatch Metrics: CloudWatch automatically collects metrics for API Gateway, including the Count metric which represents the total number of API requests. You can view these metrics in the CloudWatch console.

  2. Filter by API: To break down the metrics by specific API, you can use dimensions. The 'ApiId' dimension allows you to filter metrics for a particular API. You can also use the 'ApiId, Stage' dimension to further narrow down to a specific stage of an API.

  3. View in CloudWatch Console: In the CloudWatch console, navigate to Metrics, then choose "All metrics". Select "AWS/ApiGateway" namespace. You can then choose "By Api Name" to view metrics grouped by API.

  4. Use CloudWatch Metrics Insights: For a more detailed analysis, you can use CloudWatch Metrics Insights. This allows you to run SQL-like queries on your metric data. For example, you could run a query to identify the top APIs by request count.

  5. Create a Dashboard: To track this information over time, consider creating a CloudWatch dashboard. You can add widgets that display the Count metric for each of your APIs, allowing you to easily compare traffic across different APIs.

  6. Set up Alarms: If you want to be notified when an API's request count exceeds a certain threshold, you can set up CloudWatch Alarms based on the Count metric.

Remember, these methods don't require enabling detailed CloudWatch Logs, which can incur additional costs. They use the standard metrics that API Gateway automatically sends to CloudWatch.

For cost tracking, keep in mind that API Gateway pricing is tiered based on the total number of requests across all your APIs. While identifying high-traffic APIs is useful for optimization, your actual costs will depend on the total requests across all APIs.

By using these CloudWatch features, you should be able to effectively monitor your API request counts, identify your highest-traffic APIs, and make informed decisions about your API usage and costs.
Sources
Monitor REST API execution with Amazon CloudWatch metrics - Amazon API Gateway
Monitor CloudWatch metrics for HTTP APIs in API Gateway - Amazon API Gateway
View API Gateway metrics in the CloudWatch console - Amazon API Gateway
AWS API usage metrics - Amazon CloudWatch

answered 10 months ago

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.