Cloudfront

AWS content delivery network (CDN)

Edge Locations

Over 100 AWS data centers geographically distributed across the globe, with the following services offered and synced through ALL OF THEM: Route53, Cloudfront, WAF, Shield and Lambda@Edge

Cloudfront Origins

  • Source of content (static and dynamic)

  • Can be an:

    • S3 bucket

    • ELB

    • Any public HTTP endpoint (web distribution)

  • Live Video Streaming and VOD

  • RTMP Distribution (Flash Media Files)

Essentials

  • Global CDN which delivers content to users from the nearest edge location.

  • Retrieves content from origins

  • Distributions (web or RTMP)

    • Define origins for content (static and dynamic)

    • Integrate with Route53 for alternate CNAMEs

      • Allows you to create a URL like cdn.nicacton.com that works with a distribution

    • Cache behaviors

      • PATH pattern (images*.jpg)

      • Min, Max, Default TTL

      • Query String forwarding and caching

      • HTTP Methods (GET, POST, PUT, HEAD, etc...)

Updating Cached Files

  • Caching is done based off the cache key.

  • In order to serve a new version of an object, either create a new object with a new name or create an "invalidation" on the Cloudfront distribution based off the object name.

  • "Invalidations" can be costly

  • Set TTL=0

Security

  • SSL Certificates can be used

  • End-to-end HTTPs

  • AWS WAF Integration

  • Distribute Private Content

    • S3

      • Limit access to Origin Access Identity (OAI)

        • Modified in Bucket policy

    • Signed URL or Signed Cookie

      • Expiration

      • Restrict by IP

      • Trusted Signers (Cloudfront Key Pairs)

  • Geo Restriction

Performance

  • Regional Caches

    • Save content ejected from cache close to Edge location

  • Point entire domain to Cloudfront to speed up dynamic content

    • Content optimizations

    • Dynamic objects are still cached

  • CloudFront performance can be affected by:

    • File size and type of file

    • Having to remake the request from the Edge location to the origin.

      • Downloading the object from origin takes time.

      • As well writing it to cache and responding to the end user request.

      • The more requests that have to go to the origin, the higher the load is on your source. Which can also cause latency and load performance issues.

    • Query strings (request to the origin to serve a specific object) reduce cache "hits":

      • cdn.nicacton.com/?querythis=querythat

      • Reduces performance because query strings are often unique so it reduces the cache hits and require "work" to forward to the origin location.

  • Cloudfront Performance increased by:

    • Longer cache periods increase performance (less frequent request to the source).

Last updated

Was this helpful?