简体   繁体   English

公共子网中的 NAT 网关和 EC2 实例能否共享同一个 AWS ElasticIP?

[英]Can a the same AWS ElasticIP be shared by a NAT gateway and an EC2 instance in a public subnet?

As described in the aws VPC scenario 2 page I have a VPC with 2 subnets defined - one private and one public.aws VPC 场景 2 页面中所述,我有一个定义了 2 个子网的 VPC - 一个私有子网和一个公有子网。 The private subnet uses a NAT gateway for the outbound traffic (the NAT gateway lives in the public subnet).私有子网对出站流量使用 NAT 网关(NAT 网关位于公共子网中)。 The public subnet uses an internet gateway for inbound and outbound.公共子网使用 Internet 网关进行入站和出站。

The usage of the NAT gateway requires an ElasticIP to be registered and associated with that NAT.使用 NAT 网关需要注册 ElasticIP 并与该 NAT 关联。 Now, I need a public IP for the EC2 instance I have in the public subnet, that remains static even after restarting the instance, where outside traffic can come into.现在,我需要一个公共 IP 用于我在公共子网中的 EC2 实例,即使在重新启动实例后仍然是 static,外部流量可以进入。 Do I need to register another ElasticIP for that purpose, or can I reuse the same ElasticIP that I already created for the NAT Gateway?我是否需要为此目的注册另一个 ElasticIP,还是可以重复使用我已经为 NAT 网关创建的同一个 ElasticIP?

An Elastic IP address can only be registered to one ENI at a single time. Elastic IP地址一次只能注册到一个网卡。 When you create it a mapping is formed to resolve the elastic IP address to a single private address on an ENI (be that a NAT Gateway or an EC2 host).当您创建它时,将形成一个映射以将弹性 IP 地址解析为 ENI 上的单个私有地址(即 NAT 网关或 EC2 主机)。

When you associate an Elastic IP address with an instance, it is also associated with the instance's primary network interface.当您将弹性 IP 地址与实例关联时,它也与实例的主网络接口关联。 When you associate an Elastic IP address with a network interface that is attached to an instance, it is also associated with the instance.当您将弹性 IP 地址与附加到实例的网络接口相关联时,它也与实例相关联。

You will need to create a new one for your EC2 host, by default you can use 5 elastic IP addresses in a region, if you need more than this you would need to contact Amazon to increase your accounts quota.您需要为您的 EC2 主机创建一个新主机,默认情况下,您可以在一个区域中使用 5 个弹性 IP 地址,如果您需要更多地址,则需要联系 Amazon 以增加您的账户配额。

For more information take a look at the Elastic IP addresses page.有关更多信息,请查看Elastic IP 地址页面。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 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 - 在同一个公共子网中连接一个带有私有 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? Private su.net 中的 EC2 Instance 是否需要此架构上的 Nat Gateway? - Does EC2 Instance in Private subnet need Nat Gateway on this architecture? 私有子网中的 AWS EC2 实例无法通过 NAT 网关连接到互联网 - AWS EC2 instance in private subnet unable to connect to internet via NAT gateway 如何在私有子网中托管的 EC2 上使用 aws-cw-agent(没有 NAT 网关) - How can I use aws-cw-agent on an EC2 hosted in private subnet ( without NAT gateway) AWS - 使用 NAT 网关(由 Lambda 访问)的私有子网中的 EC2 代理到无服务器 Aurora 的 Internet 访问 - AWS - Internet Access for an EC2 Proxy to Serverless Aurora in a Private Subnet with NAT Gateway (Accessed by Lambda) 为什么 AWS NAT 网关需要 ElasticIP? - Why does a AWS NAT Gateway require an ElasticIP? AWS ECS - 无法从同一子网上的 ECS 容器实例连接到 RabbitMQ EC2 实例 - AWS ECS - Can't connect to RabbitMQ EC2 instance from ECS container instance on the same subnet 在公共子网中启动AWS EC2实例 - Launching AWS EC2 instances in public subnet AWS NAT 网关公共 IP 地址,用于将公共子网列入白名单 - AWS NAT Gateway Public IP Address for Whitelisting with Public Subnet
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM