[英]AWS EC2 private instance in public subnet - Cannot run apt-get update or ping google
I have a private EC2 instance in a public subnet.我在公共子网中有一个私有 EC2 实例。 I am not able to run apt-get update or ping google or do anything internet facing.
我无法运行 apt-get update 或 ping google 或做任何面向互联网的事情。
I see that the security group for this instance has outbound rules set to "all traffic" to 0.0.0.0/0.我看到此实例的安全组将出站规则设置为“所有流量”到 0.0.0.0/0。 Also, the route table has an entry for 0.0.0.0/0 to IGW.
此外,路由表有一个 0.0.0.0/0 到 IGW 的条目。 So, looks like it should work.
所以,看起来它应该工作。
Not sure what I am missing here.不知道我在这里缺少什么。
No public IP address
没有公共 IP 地址
Without a public IP, an instance in a public subnet, can't connect to the internet.如果没有公共 IP,公共子网中的实例将无法连接到 Internet。 Public IP is required to communicate with services outside of a VPC.
需要公共 IP 才能与 VPC 外部的服务进行通信。
If you don't want to add public IP to your instance, you have to place it in a private subnet , and correctly setup NAT gateway in a public subnet and route tables to it.如果您不想将公有 IP 添加到您的实例,则必须将其放置在私有子网中,并在公有子网中正确设置NAT 网关并将路由表发送到它。 This way your instance will connect to the internet through NAT.
这样,您的实例将通过 NAT 连接到 Internet。 NAT will be your proxy which will have public IP.
NAT 将是您的代理,它将具有公共 IP。 But your instance will not need to have it.
但是您的实例不需要它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.