-1

Lets say I have a CentOS server running on AWS. When I deployed it, I got a public IP t which I can connect to from my other systems, and a Private IP on that server that shows up if I do ifconfig, which is not accessible by systems outside that VPC.

So if I add another network interface, will that create another Public IP for that instance or there can only be 1 Public IP per instance?

If so, how do we get to decide on what interface we want to route the traffic via? Does AWS take away this capability from the users? (I tried understanding Elastic IP's but having a hard time, if the answer lies in there I will try to read more)

Tk_93
  • 13
  • 6

2 Answers2

1

Here is the documentation you need to read. You can attach more than one Elastic Network Interface to an EC2 instance. Each ENI can have a public IP address. That public IP address can optionally be an Elastic IP address.

Regarding how you decide what interface to route traffic to, that's entirely up to you. You would generally point specific DNS records to specific public IP addresses.

Mark B
  • 183,023
  • 24
  • 297
  • 295
  • Damn! Answer does lie in Elastic IP's. Since while deploying as a user, I had no control over what Private IP was given to my instance or my public IP, how do I decide what should be my Elastic IP that I can attach to these instances? In a traditional HA env, we would group eth x and eth y of 2 instances and generate a virtual IP that is in the same class and subnet right? So in this case, how do we go about doing that? – Tk_93 Oct 25 '17 at 19:16
  • You don't get to pick your Elastic IPs. You get one randomly assigned when you request one. And I'm not sure what you mean by "group ethx and ethy of 2 intsances". You can't point an elastic IP directly to more than one ENI at a time. You might want to look into the Network Load Balancer if you need a single IP that points to multiple instances. – Mark B Oct 25 '17 at 19:21
0

AWS EC2 instances have the concept of "Elastic Network Interfaces" (ENI).

Instances can have multiple ENIs and each ENI can have multiple IP-addresses. How many are allowed depends on the EC2 instance type and is documented in the documentation: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html

The decision how to route is up you, as you can decide which IP receives traffic (by pointing traffic to this IP) and if that IP is even allowed to receive certain traffic (via EC2 security groups and Network ACLs).

Same for outgoing traffic using the routing table on the instance itself and utilizing NAT instances.

Dunedan
  • 7,848
  • 6
  • 42
  • 52
  • Since while deploying as a user, I had no control over what Private IP was given to my instance or my public IP, how do I decide what should be my Elastic IP that I can attach to these instances? In a traditional HA env, we would group eth x and eth y of 2 instances and generate a virtual IP that is in the same class and subnet right? So in this case, how do we go about doing that? – Tk_93 Oct 25 '17 at 19:21