简体   繁体   English

公共子网中的 AWS EC2 私有实例 - 无法运行 apt-get update 或 ping google

[英]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.

相关问题 AWS - 无法 ping VPC 中私有子网上的 EC2 实例 - AWS - Cannot ping EC2 instance on private subnet in VPC 如何在 AWS EC2 实例上安装 apt-get? - How to install apt-get on AWS EC2 instance? AWS - 在同一个公共子网中连接一个带有私有 ip 的 ec2 实例和一个带有公共 ip 的 ec2 实例? - AWS - Connecting an ec2 instance with a private ip and an ec2 instance with a public ip in the same public subnet? 无法在私有子网中的ec2实例上运行ecs容器 - cannot run ecs container on ec2 instance in private subnet 无法使用公共 IP ping AWS EC2 实例 - Cannot ping AWS EC2 instance with public IP AWS:SSH 通过 NAT 网关从公共 su.net EC2 实例到私有 su.net EC2 实例没有发生 - AWS : SSH to private subnet EC2 instance from public subnet EC2 instance via NAT GATEWAY is not happening AWS VPC - 无法从私有子网中的堡垒主机通过 SSH 连接到不同子网中同一 VPC 中的 EC2 实例 - AWS VPC - Cannot SSH from Bastion Host in private subnet to EC2 instance in the same VPC in a different subnet 无法 ping 同一私有子网中的 ec2 实例 - Cannot ping ec2 instances in the same private subnet 无法 ping 通 AWS EC2 实例 - Cannot ping AWS EC2 instance 如何在私有子网中获取 EC2 实例私有 IP? - How to get EC2 instance private IP in a private subnet?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM