aws' scalable, fast, and flexible cdn



basic cloudfront deployments

common issues and tasks

non-streaming distributions

Deployment styles

edge cache vs. linking assets only

edge cache = very efficient, and will hold the site in cache even if the backend is down

assets only = easier to setup and use, possibly better for dynamic use

CloudFront Summary

origin pull CDN

priority traffic to aws resources

'free' storage

granular behaviors

lower bandwidth costs than ec2

Things to know for SEtup

origin (s3, ec2)

hostnames (if any)

logging bucket

price class (endpoints)


spits out in apache style logs, gzipped

drops into s3 bucket with optional prefix (folder)

eventual consistency

tons and tons of files - often 1 per client request set

recommend s3 lifecycles to prevent overgrowth


multiple origins are allowed per distribution

each origin must have a unique name, and just allows for organizing of behaviors


custom ports for each

custom hostnames

up to 10 (more possible if requested)

can't be the same as the origin hostname (well, it can, but that's kind of stupid)

requires Route 53 to use, specifically an ALIAS record

use when you want to front your site rather than just use the CDN for static assets


allows different paths to cache things different ways

very basic path patterns are allowed, with a single '*' match permitted

can force HTTP/HTTPs, object TTL, cookie, and query string options for a given path

Advanced behavior options

GET vs. other verbs (GET=faster)

query string caching (none=faster)

cookie forwarding (none=faster)

signed URLs for secure content (requires backend work to create the query string, and works by IP)


allows for whitelisting and blacklisting based on GeoIP

no additional charge, but likely additional management overhead


used to clear part, or all, of the cache



costs $ to perform

better to just have shorter cache TTLs, depending on the content


allows for custom response pages to be used for most 400 and 500 error codes

vs s3

costs less as there is no storage fee, and the bandwidth is cheaper

pulled vs. managed storage = less freedom, but less management needed

cloudfront is faster

ask me stuff and i'll make up answers

go ahead

special guest star : a quick tour of a distribution

AWS Cloudfront

By steve bradford