Is it possible to use IPv4 prefixes (subnets) as "public IPs" in the network interface of an AWS EC2 instance?

0

I transferred a /24 subnet (256 IPs) to AWS via BYOIP and I would like to assign some of these IPs to EC2 instances.

I know it is possible to assign a small subset directly to the instance's network interface as Elastic IPs, but I'm looking for a way to assign a larger quantity at once, for example a /28 (16 IPs) or more.

What I want to achieve in the end is to have an EC2 instance with as many public IPv4 as possible.

Is it possible to use IPv4 prefix delegation (as in the link below) as "public IPs" for outbound traffic?

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-prefix-eni.html

If not, is there any other way to achieve this?

Rafael
已提問 2 個月前檢視次數 239 次
2 個答案
2
  1. Allocate Elastic IP address using your BYOIP Pool
  2. Create a new Elastic network interface
  3. Associate the newly allocated elastic IP with this Network interface
  4. Attach the Network interface to an EC2 instance

You can create and configure network interfaces and attach them to instances in the same Availability Zone The number of Network Interfaces you can attach to an EC2 instance depends on the instance type. Here you can find a table https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#AvailableIpPerENI

profile picture
專家
已回答 2 個月前
profile picture
專家
Artem
已審閱 1 個月前
0

You cant assign public IP/Elastic IP directly to EC2.

For your use case, what you would need to do is as follows.

Simply delegate your desired Private range for example 172.20.30.0/28 to an EC2 first, as per the link you shared.

After that create 1-to-1 mapping of your BYOIP to each IP in 172.20.30.0/28 range. This step will be done in associate Step of Elastic IP where you can select private IP. You will have to do it for each ip individually. With that your EC2 will be able to use BYOIP Pool.

已回答 2 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南