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?

2 Respostas
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
ESPECIALISTA
respondido há 2 meses
profile picture
ESPECIALISTA
Artem
avaliado há um mês
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.

respondido há 2 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas