# API Gateway Latency alarm by Resource and Method (REST API)

CloudWatch alarms · Updated 17 November 2026

**Short answer:** The per-method variant alarms on p90 Latency with the ApiName, Stage, Resource and Method dimensions, firing at 2,500 ms or more for 5 of 5 one-minute periods. Use it when endpoints in the same stage have different response-time expectations; it requires detailed CloudWatch metrics on the stage.

## Why split latency by endpoint

A stage-wide p90 blends fast and slow endpoints together. If `GET /health` and `GET /products` make up most of the traffic, a checkout endpoint can triple in latency without moving the stage figure. The opposite also happens: one legitimately slow export endpoint keeps the [stage-level alarm](https://cloudconsole.dev/alarms/api-gateway-latency) close to its threshold all day.

Per-method alarms let you give each important endpoint its own limit. Keep the stage alarm as a backstop and add these for the handful of endpoints where response time is part of the product.

## Recommended settings

| Setting | Value |
|---|---|
| Namespace | `AWS/ApiGateway` |
| Metric | `Latency` |
| Dimensions | `ApiName`, `Stage`, `Resource`, `Method` |
| Statistic | `p90` |
| Period | 60 seconds |
| Datapoints to alarm | 5 |
| Evaluation periods | 5 |
| Comparison operator | `GreaterThanOrEqualToThreshold` |
| Threshold | 2500.0 (milliseconds) |

Settings from AWS's [recommended alarms](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Best_Practice_Recommended_Alarms_AWS_Services.html) page. `Resource` is the path template (for example `/orders/{orderId}`), and `Method` the HTTP verb. Detailed metrics must be switched on for these dimensions to exist.

## Setting a threshold for each endpoint

Use 2,500 ms only as a placeholder. For each endpoint you alarm on:

1. Graph its p90 over two weeks and note the highest healthy value, ignoring known incidents.
2. Write down what users would call "slow" for that action: a search box and a PDF export have very different tolerances.
3. Set the threshold between the two, nearer the user expectation.

Low-volume endpoints produce jumpy percentiles. If an endpoint gets fewer than ten requests a minute, add `--evaluate-low-sample-count-percentile ignore`, or alarm over a longer period. Leave missing data as `notBreaching` so idle minutes are not treated as slow.

## Create it

```
aws apigateway update-stage --rest-api-id a1b2c3d4e5 --stage-name prod \
  --patch-operations op=replace,path=/*/*/metrics/enabled,value=true
```

```
aws cloudwatch put-metric-alarm \
  --alarm-name orders-api-get-order-p90 \
  --namespace AWS/ApiGateway \
  --metric-name Latency \
  --dimensions Name=ApiName,Value=orders-api Name=Stage,Value=prod Name=Resource,Value=/orders/{orderId} Name=Method,Value=GET \
  --extended-statistic p90 \
  --period 60 \
  --evaluation-periods 5 \
  --datapoints-to-alarm 5 \
  --threshold 2500 \
  --comparison-operator GreaterThanOrEqualToThreshold \
  --treat-missing-data notBreaching \
  --alarm-actions arn:aws:sns:eu-west-2:123456789012:ops-alerts \
  --region eu-west-2
```

The braces in `{orderId}` are literal; they must match the resource path exactly as defined.

## When it fires

- Compare this method's `Latency` with its `IntegrationLatency`. Close together means the backend for this endpoint is slow; investigate that integration specifically (a missing database index for one query is a common culprit).
- If only this endpoint's integration latency rose after a deploy, roll back or check the changed code path.
- If integration latency is flat, look at endpoint-specific gateway work: a request validator or mapping template on this method, or a different authorizer.
- The re:Post guide on [API Gateway latency with Lambda](https://repost.aws/knowledge-center/api-gateway-high-latency-with-lambda) and the article on [locating latency for edge-optimised APIs](https://repost.aws/knowledge-center/source-latency-requests-api-gateway) cover deeper diagnosis.

## Questions

### How do I get API Gateway latency per endpoint?

Enable detailed CloudWatch metrics on the stage. API Gateway then publishes Latency with Resource and Method dimensions as well as the stage totals.

### Do detailed metrics cost money?

Yes, they are billed as custom metrics, one set per resource and method, so enable them where you need the detail.

### Should I remove the stage-level latency alarm?

No. Keep it as a broad safety net and use per-method alarms for endpoints with their own targets.

## When this happens away from your desk

Slow checkout is a revenue problem even when everything else is fast. CloudConsole, a phone app for AWS, is built to show per-endpoint latency alarms and their history on a phone.

[About the CloudConsole app](https://cloudconsole.dev/aws-console-app) · [Download on the App Store](https://apps.apple.com/app/cloudconsole-for-aws/id6835419710)

## Sources

- [Recommended alarms for AWS services (Amazon CloudWatch User Guide)](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Best_Practice_Recommended_Alarms_AWS_Services.html)
- [API Gateway metrics and dimensions (REST APIs)](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html)

## Related

- [CloudWatch alarm for API Gateway Latency (REST API stage)](https://cloudconsole.dev/alarms/api-gateway-latency)
- [API Gateway Count alarm by Resource and Method (REST API)](https://cloudconsole.dev/alarms/api-gateway-count-per-method)
- [Percentile latency with CloudWatch Logs Insights](https://cloudconsole.dev/logs-insights/percentile-latency)
- [aws cloudwatch put-metric-alarm](https://cloudconsole.dev/cli/cloudwatch-put-metric-alarm)
- [CloudWatch alarm: Lambda Duration (p90)](https://cloudconsole.dev/alarms/lambda-duration)
- [CloudWatch alarm for API Gateway 4xx (HTTP API)](https://cloudconsole.dev/alarms/api-gateway-4xx)

---

Source: https://cloudconsole.dev/alarms/api-gateway-latency-per-method

CloudConsole is an independent iPhone and Android app for Amazon Web Services by Cloudconcur Ltd. It is not affiliated with Amazon Web Services.
