Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm maintaining a fairly high-profile site which is hosted on Amazon EC2, and the previous developer pointed the A record at the instance's "public IP" instead of using an "Elastic IP". As far as I can tell the "public IP" is not in any way permanent so if ever I need to stop the instance, it will get a new one. Also, if I assign an elastic IP it removes the public IP, so if I change it the site will be inaccessible until the A record change propagates.

Obviously this is not good.

Is there any way I can assign an Elastic (or otherwise permanent) IP address without the current "public IP" being removed? Or, is there any other solution I haven't thought of to get me out of this mess?

share|improve this question
up vote 5 down vote accepted

Yes there is! Embrace the power of DNS eventual consistency.

  1. Set up an ELB, point it at your instance.
  2. Update the A record for your public instance with a CNAME for the ELB.
  3. Wait a week.
  4. Associate an Elastic-IP with the instance.
  5. Update the CNAME record for your app with a new A record for the EIP.
  6. Wait a week.
  7. Turn off the ELB.

For the two weeks of waiting site will likely get hits on both the old and new IP addresses. You might not be able to tell, but as both are still reachable you can manage this change pretty quickly.

share|improve this answer
Thanks, sounds like an ELB will be helpful - only problem is it doesn't seem to be possible to associate an Elastic IP to an ELB. I guess I might be able to point a CNAME at the ELB? – Greg Mar 23 '15 at 23:46
ELB cannot have an elastic ip. So change your DNS to point as a CNAME to the ELB. Wait a week. The set an elastic IP on your instance and move the DNS to that. After a week you can then remove the ELB. – Matt Houser Mar 24 '15 at 1:31
So, I remove my A record, replacing it with a CNAME, then once I'm sure that's working, I can add the elastic IP? – Greg Mar 24 '15 at 18:28
@Greg Pretty much. 1) Rename to ELB (CNAME), 2) Wait. 3) Change public IP on target box to elastic-IP. 4) Rename to target-IP (A record). 5) Wait. 6) Decomission the ELB. – sysadmin1138 Mar 24 '15 at 19:23
Cool, if you edit your answer to reflect this I'll mark it accepted. Cheers – Greg Mar 24 '15 at 21:05

Another option is to create an ENI and attach an EIP to it. Then attach the ENI to your instance and change the DNS entry.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.