Overview

  • DDoS protection, intergration with Shield, AWS Web application Firewall.

Origins

  • S3 bucket
    • For distributing files and caching them at the edge
    • Enhanced security with CloudFront Origin Access Identity (OAI)
    • CloudFront can be used as an ingress (to upload files to S3)
  • Custom Origin (HTTP)
    • App load balacner
    • EC2 instances
    • S3 website
    • Any HTTP backend you want

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

  • Security Group should allow all Publlic IP of Edge locations

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

Origin Access Identity

  • Origin S3 only allows CloudFront to access content

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

 

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

  • Signed URL vs Signed Cookie

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

Only root user can create key-pair for cloudFront signed URL

 

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

Multiple Origin is used to defined different cache behaviors.

Redirect to different origin based on router

 

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

  • Origin groups for failover
  • S3 can have Replication CRR for high availability

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

From Client side, need to defined what fields in the request should be encryption.

Then on the edge location, will encrypt the field by using an Public key

On the web server will use the private key to decrypt it.

 

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

 

 

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

 

 

 

AWS Global Accelerator

Problems and Goals

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

 

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

 

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

  • Client goes to nearest edge location
  • Form edge location goes to server through private AWS network

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

  • Health check for DR
  • No cache
  • DDoS protection with AWS Shield

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

  • Global accelerator: no cache, good for regional failover.

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

 


 

 

Caching

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

  • Cache can based on many things, for example, headers, cookies, query string params.
  • We want to maximize the cache hit to minimzie the origin request

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

  • There are many things in Headers, if we based on all the props in headers, then all the requests will be forwarded to Origin
  • So we can use Whitelist to select some important header we want to consider to cache the request/response

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

  • All the static content can be cached for maximizing cache hits, for static requests, can talk to S3 for exp.
  • Dynamic content, we use Whitelist to cache the request

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

  1. Api gateway edge + cache on api gateway
  2. CloudFront edge + ( api gateways regional + cache): you can control over distribution 
  3. (CloudFront edge + cache ) + (Api gateway + cache): you can disable api gateway cache, just rely on cache on CloudFront.

 

Lambda@Edge

  • You have deployed a CDN using CloudFront
  • What if you want to run a global AWS Lambda alongside?
  • Or how to implement request filtering before reaching your application

 

  • For this, you can use Lambda@Edge: deploy Lambda function alongside your CloudFront CDN
    • Build more responsive applications
    • You don't manage servers, Lambda is deployed globally
    • Customize the CDN content
    • Pay only for what you use

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

  • Lambda@Edge does NOT have any cache
  • It only to change requests/response
  • Lambda@Edge is able to normalize query params to improve cache ratio

 

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

  • Use for Auth at CloudFront, before reaching our server

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

 

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

  • There are two SSL Certs to manage
  • Not forward header CloudFron Origin === ALB Hostname

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

  • Self loop

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

  • Forward header
  • CloudFront Origin === ALB Hostname

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

  • Only 1 SSL, you need to forward the header

[SAA + SAP] 14. CloudFront & AWS Global Accelerator

  • ALB has to be public, otherwise, cloudFront cannot talk to it
  • CloudFront should be public always

相关文章:

  • 2021-11-26
  • 2021-07-26
  • 2021-06-22
  • 2022-02-09
  • 2021-08-29
  • 2021-08-15
  • 2021-05-17
  • 2022-03-10
猜你喜欢
  • 2021-10-17
  • 2021-09-22
  • 2021-10-29
  • 2021-11-15
  • 2022-03-01
  • 2021-11-04
  • 2022-12-23
相关资源
相似解决方案