8

I want to build a web/application server in AWS and I want to use CloudFront to deliver content with low latency and Application Load Balancer (ALB) to balance traffic between servers. If there are some contents needed to be cached, using CloudFront in front of ALB should benefit, however if not is it still recommended to use CloudFront in front of ALB in view of performance and cost? For example, which one of the following two alternatives is recommended?

  1. User always accesses ALB through CloudFront regardless of what content the user accesses.

  2. User accesses CloudFront or ALB directly depending on the content the user accesses.

Which one is the better pattern?

4

1 回答 1

13

这两个选项都没有错,但在 ALB 前面使用 CloudFront 确实提供了一些优势,即使对于不可缓存的动态内容也是如此- 包括为远离 ALB 的查看者提供更快的 TLS 协商,以及在 AWS 边缘全局优化请求路由网络,从靠近查看器的边缘位置到 ALB 所在的区域。

根据 ALB 的位置和查看器的位置,与 ALB/EC2 定价相比,输出到 Internet 的 CloudFront 带宽最多可以便宜 0.005 美元/GB,或者可能更多……但是从 ALB 到 CloudFront 的带宽是免费的,因此您无需支付两种费用。

于 2019-05-01T19:39:07.677 回答