Serve Tiles with CloudFront
TL;DR
Add CloudFront in front of your S3 bucket to cache tiles and reduce latency and cost at scale. Good for public tiles with moderate to high traffic.
Description
User requests a tile → CloudFront checks its edge cache → if not found, it fetches from S3 → response is cached at the edge for future use.
This pattern extends Public Tiles with S3 by placing a CloudFront distribution in front of the S3 bucket. CloudFront caches tile requests at edge locations, reducing latency and minimizing S3 request charges. This setup is especially useful for production deployments of public tile sets.
When to Use
- Serving public tile sets at scale
- Reducing S3 request and data transfer costs
- Lowering latency for end users globally
- Light or moderate access control needs (e.g. cookie-based auth)
Trade-offs
- Signed requests are secure but too slow for tile serving
- Cookie-based auth is possible but awkward to configure
- Cache invalidation can be tricky for frequently updated tiles
- Excellent performance for read-heavy, public datasets
Alternatives
- Serve Tiles with S3 – simpler but less performant
- Secure Tiles with API Gateway – when authentication is a priority