我在私有(private)子网实例上托管了一个 Web 应用程序,因为该应用程序适用于不同地理位置的组织内部用户。此应用程序需要 AWS CloudFront 支持才能更有效地交付静态内容。问题是 - 我需要面向 Internet 的负载均衡器(具有公共(public)子网中的实例)作为 CloudFront 分配的来源。
我不希望面向 Internet 的 ELB 以及在公共(public)子网中生成的实例。
我可以通过什么方式利用 AWS CloudFront 连接到内部 ELB?
最佳答案
I need internet facing load balancer (with instances in public subnets) as the origin for a CloudFront distribution.
这部分是不正确的。
云端 要求源服务器可以访问 Internet,因此该部分是正确的。
但是面向 Internet 的负载均衡器 不 要求平衡器后面的实例位于公共(public)子网上或拥有自己的公共(public) IP 地址。
它们不仅不是必需的,而且对于面向 Internet 的 ELB Classic 或 ALB,最佳实践实际上是两者都没有。
Issue I want to create a public internet-facing load balancer and attach backend Amazon EC2 instances that are not publicly reachable; for example, instances that are in a private subnet. How can I do this?
Short Description You must create public subnets in the same Availability Zones as the private subnets that are used by your private instances. Then associate these public subnets to the internet-facing load balancer.
https://aws.amazon.com/premiumsupport/knowledge-center/public-load-balancer-private-ec2/
这适用于经典均衡器和应用程序均衡器,但不适用于网络负载均衡器;但是,在 CloudFront 之后并不真正需要 NLB,因为 ALB 具有 100% 的兼容性,与 CloudFront 可以做的重叠。
在与实例不同的子网上使用平衡器不会影响性能。
CloudFront 仅适用于可通过 Internet 访问的资源。它不支持与 VPC 的私有(private)连接(包括不在您的 VPC 中运行的 Lambda@Edge 函数)。
关于amazon-web-services - 用于内部弹性负载均衡器来源的 AWS Cloudfront,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55195852/