Skip to content

Should i front ALB with cloudfront if i don't need caching & there is no static data?

0

Should i front ALB with cloudfront if i don't need caching & there is no static data?

Note: I can't use VPCOrigin since it does not work for Websockets.

ALB provides aws shield and can attach WAF. If i am always gonna serve dynamic data without caching, is there any other merit in fronting my ALB with cloudfront?

1 Answer
1

Yes, there are several benefits to fronting your ALB with CloudFront even if you don't need caching for static content:

  1. Security improvements:
  • CloudFront acts as the first point of contact for incoming requests and has access to the original client IP addresses, making WAF more effective when deployed at the CloudFront level
  • You can restrict ALB access to only CloudFront IP addresses using security groups with managed prefix lists
  • You can add custom headers from CloudFront to ALB to ensure traffic only comes through your CloudFront distribution
  1. Performance benefits:
  • Lower latency between users and your application by leveraging AWS's global edge network
  • Persistent connections to your application - CloudFront maintains connections to your ALB, reducing the need to establish new TCP/TLS connections
  • Ability to serve content over modern protocols like HTTP/3 or TLS1.3, even if your application doesn't support them
  1. Cost efficiency:
  • Potential cost reduction with CloudFront's Always Free tier (1TB of data per month)
  • Lower data transfer costs compared to regional resources like ALBs
  • Reduced ALB capacity requirements due to fewer new and active connections
  1. Additional capabilities:
  • Response header manipulation (like removing "Server: awselb/2.0" headers)
  • CloudFront Functions for request/response manipulation at the edge
  • Better protection against DDoS attacks with integrated AWS Shield and WAF at the edge

AWS has recently announced a new one-click integration that makes it easier to attach a CloudFront distribution directly from the ALB console, simplifying the setup process.

For dynamic content, you can use CloudFront with a "CachingDisabled" cache policy to ensure requests always go to your origin while still benefiting from the other advantages.
Sources
WAF on ALB or CloudFront ? | AWS re:Post
How to use AWS WAF to prevent "awselb/2.0" server information exposure in HTTP response header? | AWS re:Post
AWS Application Load Balancer announces CloudFront integration with built-in WAF - AWS
Building resilient and secure game backends with Amazon CloudFront | AWS for Games Blog
AWS Proxy Architecture with Global Accelerator, ALB, WAF, etc. | AWS re:Post

answered a year ago

EXPERT

reviewed a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.