在打印窗口把「目标」选为「另存为 PDF」即可保存,页面已带 awsgood.com 版权水印。 返回原文

www.awsgood.com

AWS Local Zones vs Edge Locations: The Difference That Bills You

2026-11-13 AWS Comparison 约 8 分钟

TL;DR

One is a cache, the other is a data center you forgot you own

People mix these up because AWS sells both as "close to users." The mechanics are unrelated.

An edge location is a CloudFront point of presence. It terminates TLS, serves cached objects, runs a CloudFront Function for 1ms or less, and forwards cache misses to your origin in us-east-1. It holds no durable state you manage, appears in no VPC, and has no IAM role you can attach. There are hundreds of them and you influence which one serves a user only indirectly, through cache behavior and origin shielding.

A Local Zone is a stretch of a parent region — us-west-2-lax-1a sits in Los Angeles and belongs to us-west-2. You opt in, carve a subnet out of your existing VPC CIDR, and launch m5.xlarge instances there. Those instances have EBS volumes that stay in the zone, security groups from your VPC, and a route table that sends everything else back to the parent region over the AWS backbone.

Edge location Local Zone
What you get Cache, TLS termination, WAF, Lambda@Edge Subnets, EC2, EBS, your own AMIs
Who patches the OS Nobody — no OS You, same as any region
State you own None Instances, volumes, snapshots
Count 400+ globally ~30 zones, mostly US metros
Opt-in required No Yes, per zone group
Latency to users 1–20ms for cached assets Single-digit ms RTT for compute
Billing shape Per request + per GB out Instance hours + EBS + cross-zone GB
Failure domain added Zero One per zone

That last row is the whole decision. A CloudFront POP failing means a cache miss and a slightly slower request. A Local Zone failing means instances, volumes and a health check alarm at an hour you don't want.

Who's holding the pager? Pick by team shape

The right choice is almost never a latency question. It's a "who debugs this at 2am" question.

Solo dev or two-person team. Take edge locations and stop. CloudFront in front of an ALB or S3 bucket gets you 80% of the perceived speedup for static and cacheable content, with zero operational surface. You'll never write a runbook for a POP. If your dynamic API still feels slow, move the origin region closer before you consider a Local Zone — a us-west-2 origin serving California users is already single-digit to low-double-digit milliseconds of network, and most "slow API" complaints trace back to a missing database index, not geography.

Small team with one ops generalist. Edge locations by default. Local Zones become reasonable for exactly one workload: something interactive and latency-sensitive that can't be cached — a WebSocket session store, a game server, a point-of-sale API where every 100ms shows up in the checkout funnel. One zone, one ASG, one alarm set. More than that and your generalist is now maintaining a second region-shaped thing with none of the tooling.

Platform team with IaC and on-call rotation. Local Zones are worth the cost. You already have Terraform modules, golden AMIs, and a paging setup, so adding a zone is a variable change plus a subnet. This is the profile where the latency win is real and the operational overhead is marginal.

Profile Recommendation Why
Solo dev Edge only (CloudFront + Route 53) No OS to patch, no failover drill
2–5 person team Edge first; one Local Zone only if API p95 > 150ms on cached-busting traffic Single zone is survivable, multi-zone isn't
Platform team Local Zones where the metro matters; edge everywhere else Tooling already amortizes the second failure domain
Regulated / data-residency Local Zone if the requirement is in-country compute Edge can't hold your data — it's a cache

Checking what your users actually hit, in five minutes

Before you spend a cent, measure. Two commands tell you whether your problem is cacheable front-end latency or uncached compute latency.

First, find out what Local Zones exist near your users and whether you've opted in:

aws ec2 describe-availability-zones 
  --region us-west-2 
  --all-availability-zones 
  --query "AvailabilityZones[?ZoneType=='local-zone'].[ZoneName,OptInStatus,GroupName]" 
  --output table


`OptInStatus` reads `not-opted-in` until you run:

```bash
aws ec2 modify-availability-zone-group 
  --region us-west-2 
  --group-name us-west-2-lax-1 
  --opt-in-status opted-in


Then check which instance types the zone will actually sell you — this list is much shorter than the parent region's:

```bash
aws ec2 describe-instance-type-offerings 
  --region us-west-2 
  --location-type availability-zone 
  --filters Name=location,Values=us-west-2-lax-1a 
  --query "InstanceTypeOfferings[].InstanceType" --output text | tr 't' 'n' | sort | head -20


Second, confirm what CloudFront is already doing. Run this from a machine in the metro you care about:

```bash
curl -sI https://www.example.com/assets/app.js | grep -i -E 'x-cache|x-amz-cf-pop'
# x-cache: Hit from cloudfront
# x-amz-cf-pop: LAX50-C1

for i in 1 2 3; do
  curl -s -o /dev/null -w 'dns=%{time_namelookup} connect=%{time_connect} ttfb=%{time_starttransfer}n' 
    https://api.example.com/health
done


If `x-cache` says `Hit` and TTFB is under 20ms, you already have your answer: the edge solved it, and a Local Zone would be paying for compute you don't need. If `x-cache` says `Miss` on every request because the response is per-user JSON, geography is genuinely your problem.

## The 2:14am page: an unsupported instance type and a 380MB bootstrap

We hit this in November 2026 on a client's checkout API: p95 `TargetResponseTime` at 210ms for LA traffic against a `us-west-2` ALB, and the front end was already fully cached. So we opted into `us-west-2-lax-1`, created `10.40.128.0/20`, and pointed the launch template at the zone.

The first ASG launch failed instantly with this, straight out of the API:


An error occurred (ValidationError) when calling the RunInstances operation:
Your requested instance type (t3.medium) is not supported in your requested
Availability Zone (us-west-2-lax-1a). Please retry your request by not
specifying an instance type or choosing the instance type supported in your
requested Availability Zone.


The launch template had a `t3.medium` in it because that's what the parent region used. Local Zone instance catalogs are a subset, and burstable families are often thin. The `describe-instance-type-offerings` call above would have told me in ten seconds. We moved to `m5.large` and instances came up.

Then the second problem: bootstrap took 3 minutes 40 seconds, versus 40 seconds in the parent region. User data was pulling ~380MB of Python wheels from PyPI, and with no NAT Gateway available in the zone, that egress hairpinned back through the NAT in `us-west-2a` — every byte billed as cross-zone data processing and every byte making a round trip. Instances passed health checks late, the ASG cycled them aggressively, and we ate a page per deploy. The fix was boring: baked a golden AMI with EC2 Image Builder, dropped user data to a config-file pull. Bootstrap fell to about 35 seconds.

We verified it two ways — the `curl` timing loop from a test box in LA showed TTFB going from 190ms to 22ms, and CloudWatch `TargetResponseTime` p95 settled at 24ms over the following week. The lesson wasn't about latency at all. It was that a Local Zone behaves like a small region with a small catalog, not like a magic latency dial.

And the profile mismatch is the part that should worry you. This client had no platform engineer. We ran it, and it was fine — but if they'd done it themselves, they'd have owned two subnets, a second AMI pipeline, and a failover plan for a zone that only exists because one metro's checkout was 200ms slow.

## When NOT to use this

**Don't use a Local Zone when:** your traffic is cacheable (fix it with CloudFront behaviors and `Cache-Control` first); your team has no on-call rotation; your workload needs services that aren't in-zone — RDS, ElastiCache, most managed data services simply aren't there, and your app will be making cross-zone hops to the parent region for every query, which erases the win and adds the bill; or you're one deploy away from a single-AZ outage because you only opted into one zone.

**Don't use an edge location when:** you need to hold state, run a long-lived process, or accept a TCP connection you'll keep for longer than a request. Lambda@Edge has a 30-second viewer timeout and 5-minute origin timeout, no VPC access in the legacy runtime, and a deployment that takes minutes to propagate. If your design needs a shell and a writable disk, you want a Local Zone or just a closer region.

The cost comparison people never run: a Local Zone means paying instance hours, EBS GB-months, and cross-zone transfer in *both* directions, on top of what the parent region already costs. For a small fleet that's usually less than a mid-tier SaaS subscription. For a badly designed one with a chatty database, it can multiply.

## Sources

- [What is an AWS Local Zone](https://docs.aws.amazon.com/local-zones/latest/ug/what-is-aws-local-zones.html)
- [Available Local Zones and their parent regions](https://docs.aws.amazon.com/local-zones/latest/ug/available-local-zones.html)
- [CloudFront edge locations and points of presence](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/locations-of-edge-locations.html)
- [How CloudFront delivers content](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/HowCloudFrontWorks.html)

Start with `describe-availability-zones` and one `curl` loop from the metro you're arguing about. The numbers decide the architecture faster than any design doc. We run this comparison for clients as part of awsgood.com's managed services before anyone opts into a zone.

常见问题

What is the main difference between AWS Local Zones and edge locations?
Edge locations are AWS-managed cache and TLS-termination points for CloudFront, Route 53 and Global Accelerator — you have no VPC, no OS and no persistent storage there. Local Zones are extensions of a parent region where your own subnets, EC2 instances and EBS volumes run. One is a cache you configure; the other is infrastructure you operate.
Do I need to opt in to use a Local Zone?
Yes. Local Zones are opt-in per zone group. You enable one with `aws ec2 modify-availability-zone-group --group-name us-west-2-lax-1 --opt-in-status opted-in`, then create a subnet in that zone inside your existing VPC. Until you opt in, the zone shows `OptInStatus: not-opted-in` and you cannot launch instances in it.
Can I run RDS or ElastiCache in an AWS Local Zone?
Generally no. Local Zones carry a subset of services — primarily EC2, EBS and select networking — and managed data services are usually unavailable in-zone. Applications in a Local Zone typically connect back to RDS or ElastiCache in the parent region, which adds cross-zone latency and data transfer charges to every query.
Which is cheaper, CloudFront edge locations or a Local Zone?
For most SMB workloads CloudFront is far cheaper, because you pay per request and per GB of egress rather than per instance hour plus EBS plus cross-zone transfer. A Local Zone adds instance hours, storage, and bidirectional cross-zone data charges on top of the parent region. Pricing varies by region and instance type, so model your actual traffic.
Is a Local Zone lower latency than CloudFront?
They solve different problems. CloudFront typically delivers cached assets in 1–20ms from a nearby POP. A Local Zone puts uncached compute within single-digit milliseconds of users in that metro, which matters for dynamic APIs, WebSockets and stateful sessions that cannot be cached. If your responses are cacheable, CloudFront usually wins on both latency and cost.
How many Local Zones should a small team run?
One, and only for the metro where latency is measurably hurting revenue. Each additional zone is another failure domain, another AMI pipeline, another alarm set and another route table. A team without a 24/7 rotation should treat two or more Local Zones as a staffing decision, not an architecture decision.