# CloudWatch alarm: Amazon S3 4xxErrors

CloudWatch alarms · Updated 16 November 2026

**Short answer:** Alarm on AWS/S3 4xxErrors for the BucketName and FilterId of a request metrics configuration, using the Average over 60 seconds, firing when it is above 0.05 for 15 of 15 minutes. Each request counts as 1 if it returned a 4xx and 0 if not, so an Average of 0.05 means more than 5% of requests to the bucket are failing with client errors.

## What the metric measures

`4xxErrors` is one of S3's request metrics. For every request in the filter's scope, S3 records 1 if the response was a 4xx status and 0 otherwise. Sum gives you a count; Average gives you an error rate, which is what this alarm uses so the threshold works at any traffic level.

Which 4xx codes typically dominate:

| Status | Common real-world cause |
|---|---|
| 403 AccessDenied | IAM or bucket policy change, missing KMS permission, expired presigned URLs, Block Public Access |
| 404 NoSuchKey | Clients requesting objects that do not exist, often existence checks or a broken key prefix after a deploy |
| 400 | Malformed requests, wrong region signing, bad headers |
| 412 / 416 | Conditional request preconditions not met, invalid byte ranges |

## Recommended alarm settings

| Setting | Recommended value |
|---|---|
| Namespace | `AWS/S3` |
| Metric | `4xxErrors` |
| Dimensions | BucketName, FilterId |
| Statistic | Average |
| Threshold | 0.05 |
| Period | 60 seconds |
| Datapoints to alarm | 15 |
| Evaluation periods | 15 |
| Comparison operator | `GreaterThanThreshold` |

Request metrics are not on by default. They are billed as custom CloudWatch metrics and need a metrics configuration on the bucket; the configuration's ID becomes the `FilterId` dimension:

```
aws s3api put-bucket-metrics-configuration \
  --bucket my-bucket \
  --id EntireBucket \
  --metrics-configuration Id=EntireBucket
```

## Tuning the threshold

Some applications have a high normal 404 rate by design: a cache layer that checks S3 before generating content, or clients probing for optional files. Chart the Average over two weeks; if normal is 8%, a 5% threshold will never be quiet. Set it above the normal rate, or narrow the metrics configuration with a prefix filter to the paths where 4xx really means something is broken.

Low-traffic buckets are the opposite problem: two failed requests out of ten is 20%. The 15-of-15 window helps, but you may prefer a Sum-based alarm for them.

## Create the alarm

```
aws cloudwatch put-metric-alarm \
  --alarm-name s3-my-bucket-4xx-rate \
  --alarm-description "More than 5% of requests to my-bucket returning 4xx for 15 minutes" \
  --namespace AWS/S3 \
  --metric-name 4xxErrors \
  --dimensions Name=BucketName,Value=my-bucket Name=FilterId,Value=EntireBucket \
  --statistic Average \
  --period 60 \
  --evaluation-periods 15 \
  --datapoints-to-alarm 15 \
  --threshold 0.05 \
  --comparison-operator GreaterThanThreshold \
  --treat-missing-data notBreaching \
  --alarm-actions arn:aws:sns:eu-west-2:123456789012:oncall-alerts
```

## When it fires

1. **Split by code:** S3 server access logs (enable temporarily if not on) record HTTP status and error code per request; CloudTrail data events give the caller identity for 403s.
2. **403 spike:** check recent bucket policy, IAM and KMS key policy changes; see [S3 AccessDenied](https://cloudconsole.dev/errors/s3-access-denied) and [KMS AccessDenied](https://cloudconsole.dev/errors/kms-access-denied).
3. **404 spike:** look at which keys are requested; a deploy that changed a key prefix, or a cleanup job that deleted objects still referenced, are common. See [NoSuchKey](https://cloudconsole.dev/errors/s3-nosuchkey).
4. **Presigned URL failures:** expiry or clock skew, see [Request has expired](https://cloudconsole.dev/errors/s3-request-has-expired).

## Questions

### How do I create a CloudWatch alarm for an S3 bucket?

Enable request metrics on the bucket with a metrics configuration (a filter), then alarm on metrics such as 4xxErrors or 5xxErrors using the BucketName and FilterId dimensions. Daily storage metrics like BucketSizeBytes need no setup but are only updated once a day.

### How do I see why S3 requests return 403?

Server access logs show the error code for each request, and CloudTrail data events show who made it. Compare the caller's permissions with the bucket policy, IAM policy and any KMS key policy.

## When this happens away from your desk

A sudden wave of S3 access errors often follows a policy change, so the time the alarm started is the most useful clue. CloudConsole, a phone app for AWS, is built to show alarm history on your phone so you can match it to recent changes.

[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 (Amazon CloudWatch User Guide)](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Best_Practice_Recommended_Alarms_AWS_Services.html)
- [Amazon S3 CloudWatch metrics and dimensions](https://docs.aws.amazon.com/AmazonS3/latest/userguide/metrics-dimensions.html)
- [Enabling Amazon S3 server access logging](https://docs.aws.amazon.com/AmazonS3/latest/userguide/enable-server-access-logging.html)

## Related

- [S3 AccessDenied: Access Denied when calling an S3 operation](https://cloudconsole.dev/errors/s3-access-denied)
- [NoSuchKey: The specified key does not exist](https://cloudconsole.dev/errors/s3-nosuchkey)
- [CloudWatch alarm: Amazon S3 5xxErrors](https://cloudconsole.dev/alarms/s3-5xxerrors)
- [An error occurred (403) when calling the HeadObject operation: Forbidden](https://cloudconsole.dev/errors/s3-403-forbidden-headobject)
- [KMS AccessDeniedException when reading an encrypted S3 object or secret](https://cloudconsole.dev/errors/kms-access-denied)
- [CloudWatch alarm: Amazon S3 OperationsFailedReplication](https://cloudconsole.dev/alarms/s3-operationsfailedreplication)

---

Source: https://cloudconsole.dev/alarms/s3-4xxerrors

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