我的问题是 this 的扩展版本.
在我的情况下,安全组必须限制对负载均衡器 1 的访问。它必须有一些列入白名单的 IP。那么,我可以在此处放置哪些 IP 以允许从 Auto Scaling Group 2 私有(private)实例访问负载均衡器 1?
我尝试将 NAT 网关的弹性 IP 作为白名单 IP 并且它可以工作。我想了解为什么绝对有必要将此 IP 放入安全组中才能从 的私有(private)子网实例访问面向 Internet 的 ALB。同一个 VPC .
最佳答案
I have tried putting the Elastic IP of NAT Gateway as a whitelisted IP and it works. I want to understand why it is absolutely necessary to put this IP in Security Group to access the internet-facing ALB from the private subnet instance of the same VPC.
因为私有(private)子网中的实例会查找公共(public)负载均衡器的 DNS,将其解析为其公共(public) Internet IP,然后尝试连接到通过 NAT 网关路由的该 IP。
据我所知,没有办法让公共(public)弹性负载均衡器也可以解析为 VPC 内的私有(private) IP。因此,您必须通过 NAT 网关才能从您的私有(private) IP 内部访问公共(public)负载均衡器。
另一种设置是创建第三个负载均衡器,即私有(private)的,它也指向 Auto-Scale Group #1 中的实例,并让您的私有(private)子网实例与该负载均衡器通信。
如果您使用第三种负载均衡器方法,您将创建一个新的目标组,将该组分配给您现有的自动扩展组,并将新的负载均衡器指向新的目标组。关键是一个目标组只能被一个Application Load Balancer使用,但是实例可以属于多个目标组,而弹性伸缩组可以有多个目标组。
关于amazon-web-services - AWS : Security Group to allow access internet-facing Load balancer to be accessed from private instances,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42206565/