How to Monitor CloudFront Edge Locations and Request Metrics

Monitor CloudFront with CloudWatch metrics in us-east-1, cache hit rate and origin latency, standard logs and real-time logs per edge location.

Aug 11, 2025 - 10:30
Nov 15, 2026 - 00:44
 0  46
TOPICDevOps BasicsPractical guide
How to Monitor CloudFront Edge Locations and Request Metrics

You monitor Amazon CloudFront through three data sources: CloudWatch metrics for the distribution (requests, bytes, error rates, and optional cache hit rate and origin latency), access logs that record each request with the edge location that served it, and real-time logs streamed to Kinesis Data Streams within seconds. Metrics tell you that something changed. Logs tell you where, for whom and why.

This guide walks through each source, the alarms worth creating, and how to trace a problem down to a single edge location. Every metric name and limit below was checked against the CloudFront Developer Guide in November 2026. If you are new to the service, start with what Amazon CloudFront is and how it delivers content, then come back here.

Key takeaways

  • CloudFront publishes six default metrics at no extra cost: Requests, BytesDownloaded, BytesUploaded, 4xxErrorRate, 5xxErrorRate and TotalErrorRate.
  • Additional metrics (cache hit rate, origin latency and error rates for 401, 403, 404, 502, 503 and 504) cost extra and must be turned on per distribution.
  • All CloudFront metrics live in the AWS/CloudFront namespace in US East (N. Virginia), us-east-1, with the dimension Region=Global.
  • CloudWatch metrics are aggregated across the whole distribution. To see behaviour per edge location you need logs, which carry the x-edge-location field.
  • Standard logs arrive in batches; real-time logs arrive within seconds and support a sampling rate from 1 to 100 percent.
  • AWS says both log types are best effort, so use them to understand traffic, not as an exact billing record.

What "monitoring edge locations" really means

CloudFront serves content from a worldwide network of edge locations. A common misunderstanding is that you can open a dashboard and pick a single location, say Mumbai, and see its request count. You cannot do that with CloudWatch metrics. The documentation states that the Region dimension for every CloudFront metric is always Global, because CloudFront is a global service. The numbers you see are totals for the distribution.

Per-location visibility comes from logs. Each log record includes the edge location that served the request, written as a three-letter code plus a number (for example DFW3). AWS notes that the three letters usually match the IATA code of a nearby airport, and that these abbreviations may change. So the practical approach has two layers. CloudWatch metrics act as your smoke alarm for the whole distribution. Logs let you break the traffic down by edge location, country, status code and cache result once the alarm goes off.

The default CloudFront metrics

Every distribution sends these metrics to CloudWatch automatically. In the CloudFront console they appear on the Monitoring page at 1-minute granularity, and you can download them as CSV files.

Metric nameWhat it measuresStatisticUnit
RequestsTotal viewer requests, all methods, HTTP and HTTPSSumNone
BytesDownloadedBytes downloaded by viewers for GET and HEADSumNone
BytesUploadedBytes uploaded by viewers with OPTIONS, POST and PUTSumNone
4xxErrorRatePercent of requests answered with a 4xx codeAveragePercent
5xxErrorRatePercent of requests answered with a 5xx codeAveragePercent
TotalErrorRatePercent of requests answered with 4xx or 5xxAveragePercent

Pay attention to the statistic column. AWS says only one statistic, Average or Sum, applies to each metric. If you build an alarm on Requests with the Average statistic, the graph will look odd and the alarm will not mean what you think. Use Sum for counts and Average for rates.

The error-rate metrics are percentages of all viewer requests. That makes them useful for alarms because they do not swing with traffic volume the way a raw error count does. A 5xxErrorRate that climbs from near zero to a few percent is worth a page. A rise in 4xxErrorRate is often less urgent, since it can come from bots probing paths that do not exist, but a sudden jump after a deployment usually means broken links or a permissions change on the origin.

Additional metrics: cache hit rate and origin latency

The default set says nothing about how well your cache works. For that you turn on additional metrics, which AWS charges for. The documentation describes the cost as a fixed monthly rate per metric from CloudWatch, for up to 8 metrics per distribution, and it does not change with request volume. Retrieving the metrics through the CloudWatch API adds normal API charges. Check the CloudWatch pricing page for the current per-metric rate before you turn them on everywhere.

The additional metrics are:

  • CacheHitRate: the percentage of cacheable requests served from the CloudFront cache. POST and PUT requests and errors are not counted as cacheable.
  • OriginLatency: time in milliseconds from when CloudFront receives a request to when it starts sending a response, for requests that went to the origin. AWS also calls this first byte latency. Its statistic is Percentile, so you query it with the ExtendedStatistics parameter (for example p90), not Statistics.
  • 401ErrorRate, 403ErrorRate, 404ErrorRate, 502ErrorRate, 503ErrorRate and 504ErrorRate.

The per-code error rates save a lot of guessing. A spike in 403 on an S3-backed distribution often points to a bucket policy or origin access control problem. A spike in 502 or 504 points at the origin or the network path to it. A spike in 404 usually means content was moved or deleted. You can turn the additional metrics on in the console under Manage additional metrics, with CloudFormation, or with the CLI:

aws cloudfront create-monitoring-subscription \
  --distribution-id EDFDVBD6EXAMPLE \
  --monitoring-subscription RealtimeMetricsSubscriptionConfig={RealtimeMetricsSubscriptionStatus=Enabled}

# check whether they are on
aws cloudfront get-monitoring-subscription --distribution-id EDFDVBD6EXAMPLE

In CloudFormation the resource is AWS::CloudFront::MonitoringSubscription with RealtimeMetricsSubscriptionStatus: Enabled. Keeping it in your template means new distributions get the same visibility as old ones, which is easy to forget when people create distributions by hand.

Why us-east-1 matters

CloudFront metrics are published in US East (N. Virginia) only. This trips up a lot of teams in India whose workloads run in Mumbai (ap-south-1). They open CloudWatch in their usual Region, search for CloudFront, find nothing, and assume metrics are missing. Switch the console Region to us-east-1, or pass --region us-east-1 on CLI calls. The same rule applies to alarms: a CloudWatch alarm on a CloudFront metric must be created in us-east-1. Many teams keep a small "global services" alarm stack in us-east-1 for this reason.

Here is a simple alarm on the 5xx error rate:

aws cloudwatch put-metric-alarm \
  --region us-east-1 \
  --alarm-name cf-prod-5xx-rate \
  --namespace AWS/CloudFront \
  --metric-name 5xxErrorRate \
  --dimensions Name=DistributionId,Value=EDFDVBD6EXAMPLE Name=Region,Value=Global \
  --statistic Average \
  --period 300 \
  --evaluation-periods 2 \
  --threshold 2 \
  --comparison-operator GreaterThanThreshold \
  --treat-missing-data notBreaching \
  --alarm-actions arn:aws:sns:us-east-1:111122223333:ops-alerts

The threshold of 2 percent and the two five-minute periods are starting points, not AWS recommendations. Look at a few weeks of your own history and pick a level that would have caught real incidents without paging on noise. Note that both dimensions, DistributionId and Region=Global, must be present or the alarm will watch a metric with no data. For more on alarm types and how to wire them to automation, see automating cloud alerts with Amazon CloudWatch.

Alarms worth creating for most distributions

A short, well-tuned set beats a long list nobody trusts. For a typical production distribution, these cover the common failure modes:

  1. 5xx error rate above a threshold. This is the closest thing to "users are seeing errors" that CloudFront gives you directly.
  2. Origin latency (p90) above a threshold. Slow origins hurt every cache miss. If this rises while the request count is steady, the origin is struggling.
  3. Cache hit rate below a floor. A sudden drop often follows a change to the cache policy, such as adding a header or query string to the cache key, and it sends far more traffic to the origin.
  4. Requests far above normal. Base the threshold on your own traffic history for each hour of the day, since a single fixed number will either miss real surges at night or fire every afternoon. A surge can be a launch, a viral link, or unwanted automated traffic.
  5. 403 error rate. Useful after any change to bucket policies, origin access control, signed URLs or geographic restrictions.

If you run CloudFront Functions, add an alarm on FunctionComputeUtilization. AWS recommends reviewing a function that runs at 80 percent or more of its allowed time, and it publishes FunctionThrottles, FunctionExecutionErrors and FunctionValidationErrors too. Lambda@Edge functions publish metrics as well, which you view in us-east-1 under the group AWS/CloudFront/<distribution-ID>, and their logs land in CloudWatch Logs in the Regions where the function is invoked, with a default log group named /aws/lambda/us-east-1.<FunctionName>.

Standard access logs: the per-request record

Access logs, which AWS also calls standard logs, contain a line for every request CloudFront receives: time, edge location, client IP, status, bytes, time taken, cache result and more. CloudFront now offers two versions. Standard logging (legacy) writes only to an S3 bucket. Standard logging (v2) supports additional destinations, which the documentation lists alongside the legacy option, and you can configure either or both on a distribution.

Logs are delivered periodically, not instantly, and AWS is explicit that delivery is best effort. A record can arrive long after the request, and in rare cases not at all. So do not reconcile log line counts against your bill. Use logs to answer questions like these:

  • Which edge locations served the most errors in the last hour?
  • Which paths produce the most cache misses?
  • Which countries or user agents are behind a traffic spike?
  • Which query strings are actually in use, before you decide what goes into the cache key?

Once logs are in S3, Amazon Athena is the usual way to query them with SQL. A query grouping by edge location and status code turns "the 5xx rate went up" into "the 5xx rate went up for requests served from two locations, all for one path", which is something you can act on. If you send logs to CloudWatch Logs instead, Logs Insights gives you the same kind of breakdown; our guide on CloudWatch Logs Insights for application performance covers the query syntax.

Real-time logs: seconds, not minutes

When you need to react within a minute, standard logs are too slow. Real-time logs are delivered within seconds to an Amazon Kinesis Data Streams stream that you choose. From there you can write your own consumer, or use Amazon Data Firehose to push the records into S3, Amazon Redshift, Amazon OpenSearch Service or a third-party log tool.

You control three things in a real-time log configuration:

  • Sampling rate: a whole number from 1 to 100, the percentage of viewer requests that produce a log record. Sampling keeps cost down on busy distributions while still giving you a representative picture.
  • Fields: you pick only the fields you need. Records always arrive with fields in a fixed documented order, so if you add a field later, the position of existing fields can shift. Build your consumer to cope with that.
  • Cache behaviours: you attach the configuration to specific path patterns, so you can stream logs only for your API path and skip static assets.

Fields that matter most for edge monitoring include x-edge-location, sc-status, time-to-first-byte, x-edge-result-type (Hit, RefreshHit, Miss, Error and others), x-edge-detailed-result-type (which separates errors such as OriginConnectError and OriginDnsError), c-country, and origin-fbl for first-byte latency to the origin.

Real-time logs carry their own CloudFront charge on top of Kinesis Data Streams costs. AWS suggests estimating shard count from your requests per second and record size; a single record is typically around 500 bytes, and around 1 KB with all fields. If Kinesis throttles the writes, add shards. Each shard supports up to 1,000 records per second and 1 MB per second of writes. The default account quota is 150 real-time log configurations.

A troubleshooting workflow that uses all three sources

Here is how the pieces fit when something goes wrong.

  1. The alarm fires. Say 5xxErrorRate crossed your threshold for two periods.
  2. Check the per-code metrics. If additional metrics are on, see whether the errors are 502, 503 or 504. Mostly 504 suggests the origin is timing out. Mostly 502 suggests the connection to the origin failed, for example a TLS or DNS problem.
  3. Check origin latency. If p90 OriginLatency rose at the same time, the origin is slow. Look at the origin's own metrics: the load balancer, the instances or containers, the database.
  4. Break it down in logs. Query real-time or standard logs for 5xx responses grouped by x-edge-location, path and x-edge-detailed-result-type. If the errors cluster in a few locations, the issue may be regional network trouble. If they spread across all locations but share one path, the issue is in your application.
  5. Confirm the fix with the same metric. Watch the error rate fall back before you close the incident.

Two other signals help. The x-amz-cf-id response header holds the request ID that also appears in logs as x-edge-request-id. When a user reports an error, ask for that header value and you can find the exact log line.

CloudFront console reports

Besides metrics and logs, the CloudFront console has built-in reports for usage, popular objects, top referrers, viewers and cache statistics. These suit weekly reviews more than incident response. The cache statistics report, for instance, helps you spot paths with poor hit rates over a longer window, which feeds back into cache policy decisions. Changing what goes into the cache key and how long objects live is covered in our guide to CloudFront cache invalidation and versioned file names.

Dashboards that people actually read

From the CloudFront Monitoring page you can choose Add to dashboard to send the graphs to a CloudWatch dashboard in us-east-1. A useful production dashboard puts four graphs side by side: requests, total and 5xx error rates, cache hit rate, and p90 origin latency. Add the origin's own health graphs below them, such as load balancer 5xx counts or target response time, so the person on call can see both sides of the edge in one place. Our article on custom CloudWatch dashboards walks through the setup.

If your team already runs Prometheus and Grafana for the application, decide early where edge graphs will live so the on-call engineer is not switching between tools. The trade-offs between the two monitoring stacks are discussed in CloudWatch versus Prometheus.

Common mistakes

  • Looking in the wrong Region. Metrics and alarms for CloudFront live in us-east-1.
  • Using the wrong statistic. Sum for counts, Average for rates, Percentile for origin latency.
  • Treating logs as complete. Both log types are best effort. Use them for patterns, not accounting.
  • Turning on full real-time logging for every path. Start with a low sampling rate on the paths that matter, then raise it if you need more detail.
  • Alarming on raw error counts. Error counts grow with traffic. Error rates do not, which makes them better alarm signals.
  • Skipping cache hit rate. Without it, a cache policy change that quietly doubles origin load can go unnoticed until the origin falls over.

Where to practise this

Monitoring CloudFront well is mostly about knowing which signal answers which question, and that comes from practice on a real distribution: break the origin on purpose, watch the alarms, then trace the errors in the logs. The AWS Solutions Architect Associate training covers CloudFront, CloudWatch and logging in hands-on labs, taught in our Kharadi, Pune classroom and live online for learners in other cities. For a wider view of observability tools, see the observability tools guide and our Prometheus and Grafana course.

Frequently asked questions

Can I see CloudFront metrics for a single edge location in CloudWatch?

No. CloudFront metrics in CloudWatch use the dimension Region=Global and are totals for the distribution. To analyse traffic per edge location, use standard or real-time logs, which include the x-edge-location field for each request.

Why can't I find CloudFront metrics in CloudWatch?

CloudFront publishes its metrics in US East (N. Virginia), us-east-1. Switch the CloudWatch console to that Region, or add --region us-east-1 to CLI calls. Alarms on CloudFront metrics must also be created there.

Are CloudFront metrics free?

The six default metrics (Requests, BytesDownloaded, BytesUploaded, 4xxErrorRate, 5xxErrorRate and TotalErrorRate) have no additional cost. Additional metrics such as CacheHitRate and OriginLatency are charged at a fixed CloudWatch rate per metric per month, up to 8 per distribution.

What is the difference between standard logs and real-time logs?

Standard logs record every request and are delivered periodically to S3 or, with v2, to other supported destinations. Real-time logs arrive within seconds in Kinesis Data Streams, support a 1 to 100 percent sampling rate, and let you choose fields and cache behaviours. Both are best effort.

Which CloudFront alarm should I create first?

Start with an alarm on 5xxErrorRate using the Average statistic, because it reflects errors that users actually see. Then add p90 OriginLatency and CacheHitRate once additional metrics are turned on.

How do I find the log entry for an error a user reported?

Ask for the x-amz-cf-id response header value from the failed request. The same value appears as x-edge-request-id in CloudFront logs, so you can search for that exact request.

References

Interested in learning more?Get a callback from our training advisors.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0
Mridul I am a passionate technology enthusiast with a strong focus on DevOps, Cloud Computing, and Cybersecurity. Through my blogs at DevOps Training Institute, I aim to simplify complex concepts and share practical insights for learners and professionals. My goal is to empower readers with knowledge, hands-on tips, and industry best practices to stay ahead in the ever-evolving world of DevOps.