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개 답변
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
검토됨 한 달 전
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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠