Portal Home > Knowledgebase > Articles Database > Private network IPs keep changing


Private network IPs keep changing




Posted by whdev, 05-30-2012, 02:25 AM
Hi, We host our servers on AWS EC2. When we shutdown an instance, and then starts it later on, the private IP will change. So now we have this server connects to my other servers over the private network on EC 2 (10.X.X.X). We are connecting to different servers on different private network ips and different port as well. When we stop some of those servers and start them later on, the private IP changes, so I keep have to change my application config. I'm not sure what we can do. For example, can we use HAPROXY to map some internal IPs like 127.0.0.2 to 10.0.0.1. Our application will always point to 127.0.0.2, and if the private IP changes, we can just modify HAPROXY. Any ideas?

Posted by VectorVPS, 05-30-2012, 03:26 AM
You can check the new private IP by using an instance metadata URL. Write a script that, upon reboot, will add an entry to the hosts file that maps the new IP to a unique hostname. Then, change the application config to use this unique hostname. Last edited by VectorVPS; 05-30-2012 at 03:29 AM.

Posted by VectorVPS, 05-30-2012, 03:32 AM
Or of course you could use an elastic IP.

Posted by whdev, 05-31-2012, 03:26 AM
Too bad there's no elsatic private IP

Posted by VectorVPS, 05-31-2012, 04:44 AM
When an EC2 instance queries the external DNS name of an Elastic IP, the EC2 DNS server returns the internal IP address of the instance to which the Elastic IP address is currently assigned. http://alestic.com/2009/06/ec2-elastic-ip-internal http://shlomoswidler.com/2010/06/tra...matically.html



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
3dgwebhosting Alert (Views: 697)

Language: