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 个月前238 查看次数
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 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则