When I try and associate a second Elastic IP to a small EC2 instance, the currently assigned Elastic IP is disassociated.
Do I need to use a VPC?
Classic EC2 instances can only have a single Elastic IP address associated with them. To get multiple IP addresses, you must use VPC and setup multiple network interfaces on your instance.
To get 2 elastic ip's associated to one ec2 instance you need to provide a different route for the second ip. This involves to set a new ip rule which specifies what route should be used.
For example, there is an instance with two network interfaces (lets named
You need to specify for the ip of eth1(126.96.36.199) to take a different route:
Then, associate his default route to that rule:
And flush the cache:
You can dig for a "formal" explanation from this article