简体   繁体   中英

Associating Public IP with EC2 instance with multiple network interfaces

I am using Amazon EC2 for my business scenario.

In my scenario I have 3 network interfaces for each EC2 instance (for different purposes): 1 for public access and 2 others for communication inside between instances (This is my solution architecture).

So basically I need one "public IP" for every EC2 instance.

However when creating EC2 instance with multiple network interfaces AWS does not associate public IP address with any one of network interfaces. The only way I found to do so is to create elastic IP and associate this IP with "access" interface of running instance.

When creating an EC2 instance with single network interface this network interface receives public ip address.

The issue is that there is a hard limit of 5 Elastic IPs for VPC, and I'm planning to have totally around 50 instances running simultaneously. Is there any other way to get around this issue, aside from requesting limit increase from AWS?

No, there is no way you can work around.

You can submit an request to AWS Support. They will increase allowed number of EIPs per account upto certain number right away (I couldn't recollect what this number is).

If it crosses certain number, your AWS contact need to involve to get more EIPs.

However when creating EC2 instance with multiple network interfaces AWS does not associate public IP address with any one of network interfaces. The only way I found to do so is to create elastic IP and associate this IP with "access" interface of running instance.

This approach is exactly what AWS suggests

⚠️ Important
When you add a second network interface, the system can no longer auto-assign a public IPv4 address. You will not be able to connect to the instance over IPv4 unless you assign an Elastic IP address to the primary network interface (eth0). You can assign the Elastic IP address after you complete the Launch wizard. For more information, see Work with Elastic IP addresses .

As stated in the previous answer of @Invoke Cloud , you may need to request for more Elastic IP.

Or, since you can attach the network interface directly when the instance is running, there's might be a possibility to write a AWS Lambda Function to assign the other network interface to the instance after it has started with one network interface and was assigned a public IP.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM