Second PUBLIC IPv4 Address Associated in one Instance

0

Hi Guys, I'm new in AWS.

I have an AWS EC2 Instance with one elastic IP address allocated. It is possible to allocate a second PUBLIC elastic IP address to this same instance?

I need to create a route from all outside connections. Simple example:

Connections to IP A port 22 will be redirected to my instance on port 2222 Connections to IP B port 22 will be redirected to my instance on port 4444

What is the best way to do this?

Thanks in advance, Rafael Grether

질문됨 5달 전159회 조회
2개 답변
1
수락된 답변

Hello.

It is possible to attach multiple Elastic IP addresses to an EC2 instance.
The number of ENIs that can be set varies depending on the instance type, so please check the document below.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#AvailableIpPerENI

You will need to follow the steps in the document below to add the secondary private IP and then add the corresponding Elastic IP address.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/MultipleIP.html#working-with-multiple-ipv4

I think it depends on the reason why you want to change the port number, but I thought that if SSH connections were controlled by security groups, there would be no need to change it.

profile picture
전문가
답변함 5달 전
profile pictureAWS
전문가
검토됨 5달 전
  • Thanks for your reply.

    I read that I cannot associate two elastic IP to an instance:

    "If you associate an Elastic IP address with an instance that already has an Elastic IP address associated, the previously associated Elastic IP address will be disassociated, but the address will still be allocated to your account".

    But I understand that I need to associate a new elastic IP to a Network Interface, not an Instance.

    In this case I need to create a new network interface (eni) and new private IP? And how can I associate the new eni to my instance too?

    In my particular case I don't need to change the SSH port number. It was just an example to illustrate my needs in simple way.

    I'm building two IRC Servers in the same host that listening in default 6697 port and other in 7697 port. But for external, I need booth listening in 6697 default port. So, one IRC server accessible by one public IPv4 address, and other IRC Server by second public IPv4 address.

    But in my unix host, if I can filter the origin (first or second interface), I can redirect the port <second IP>:6697 to HOST:7697.

    Thanks in advance Rafael Grether

0

You can allocate a 2nd IP to an EC2 instance by allocating a 2nd elastic IP, however both ports 2222 and 4444 will be available on BOTH IP addresses.

I dont believe there is any way around this.

profile picture
전문가
답변함 5달 전

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

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

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

관련 콘텐츠