Traffic from AWS IP addresses is hitting my server

If your logs are full of addresses that resolve to amazonaws.com, you are in good company. A large share of the internet's servers, crawlers, scanners and SaaS platforms run on AWS. An AWS source address tells you the traffic comes from something hosted there. It doesn't tell you who, and it doesn't make the traffic good or bad.

What an AWS source address usually means

Look the address up and note the service code. It narrows things down:

The lookup saysWhat is connecting to you
EC2 address spaceSomething an AWS customer runs: a server, a container, a Lambda function, or a company's NAT gateway. This is the usual answer for crawlers, API clients, webhooks, monitors and scanners, and for attackers.
CLOUDFRONT_ORIGIN_FACINGCloudFront fetching content from an origin. If you use CloudFront, that's your CDN. If you don't, someone may have set up a distribution with your site as its origin.
ROUTE53_HEALTHCHECKSRoute 53 health checkers probing an endpoint, usually because someone configured a health check against your address.
API_GATEWAYAPI Gateway making an outbound call, for example an integration that forwards requests to your endpoint.
Service not disclosedAWS uses the range but doesn't say for what. It can be AWS's own systems.

A reverse DNS name such as ec2-54-…compute-1.amazonaws.com is AWS's generic name for EC2 address space. It doesn't mean an EC2 instance specifically, and it never names the customer.

Benign sources and how to verify them

The rule for every case: verify the source address against a list the sender publishes. User agents and reverse DNS names are easy to fake.

Block, rate-limit or ignore?

SituationSensible response
Password guessing or exploit attempts from a handful of addressesBlock those addresses for a limited time (fail2ban and similar tools do this automatically). Report to AWS if it continues.
A crawler or scraper using too much capacityrobots.txt for well-behaved bots; a per-address rate limit that returns 429 for the rest
Occasional vulnerability scansKeep software patched; a web application firewall's managed rules; otherwise ignore
A sustained attackBlock, and report it to AWS with log lines and timestamps

A per-address rate limit in nginx:

# in the http {} block
limit_req_zone $binary_remote_addr zone=perip:10m rate=10r/s;

# in a server {} or location {} block
limit_req zone=perip burst=20 nodelay;
limit_req_status 429;

Give blocks an expiry. An EC2 instance gets a new public address from a shared pool each time it starts, so an abuser can move to a fresh address in minutes, while the address you blocked may later belong to a customer you want to hear from.

Why blocking all of AWS backfires

Blocking every AWS range looks like a quick fix. It causes more problems than it solves:

If you want to treat data-centre traffic differently, scope it: apply stricter rate limits or a challenge to sensitive endpoints such as login and sign-up, and explicitly allow the services you depend on.

Checklist

  1. Look up the address and note the service code, region and data date.
  2. Check whether it's yours: search your AWS accounts.
  3. Check whether it's an expected service from the list above, verifying by address.
  4. If it's harmful, block that address for a limited time or rate-limit it.
  5. If it's sustained, report it to AWS.

Sources