Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Ok I have an instance (let's call it instance-1) with its public dns (let's call it ec2-A-B-C-D.compute-1.amazonaws.com) and another instance called instance-2 (public-dns : ec2-E-F-G-H)

I created an elastic ip (ip-50-X-Y-Z)

When I associate the elastic ip to the instance . The instance public dns changed to ec2-50-X-Y-Z which first of all I think it's weird.

Even weirder, If I deassociate instance-1 and associate instance-2 to my elastic-ip then :

instance-2 public dns changed to ec2-50-X-Y-Z) and instance-1 get a new public dns.

Since I am using usually using the public-dns to connect to my instance via ssh this is really messing up my ~/.ss/know_hosts file.

Is this the normal behavior of elastic ips or there is something messed up in my setup?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Yes. When you request an elastic IP address, that IP address is fixed and you retain use of this IP until you relinquish it. If you assign it to any given instance, then the instance loses the IP it had (dynamic) and it is replaced with the elastic (fixed) ip address.

The idea is that the elastic IP address remains the same, so if you have a production site (with an FQDN mapped to this elastic IP address), then whenever you assign it to your server, you don't need to worry about any DNS changes.

Typically, you will have a number of elastic IP addresses, that you assign to your production, staging, test instances as required.

share|improve this answer
    
Ok but since I can only assigned 1 elastic ip to a given instance. I cannot use it to switch instance for maintenance purpose. (Well I can but this will cause mayhem in my know_hosts) –  Julien Grenier May 18 '11 at 16:46
1  
I'm not 100% sure what you mean by mayhem - do you mean you no get prompted to add another host to the file. If this bothers you you could do something like: alias sshrelaxed="ssh -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no" . Then you can just run sshrelaxed user@server.address and the host will get added to /dev/null –  barryj May 18 '11 at 17:27
    
I need to connect to instances using their public-dns (or public ip). If I switch instance for the elastic ip. The previously attached instance gets a new public dns and the newly attached instance gets the same public dns as the just detached instance. Which means the signature for that public dns changed and ssh refused to connect. –  Julien Grenier May 18 '11 at 17:29
    
@barryj's comment will fix that. –  ceejayoz May 18 '11 at 17:35
    
Thank you for the ssh relaxed tip. I think I'm just disappointed because I thought public-dns were fixed and that I could swapped instance for a elastic ip without impacting the public ip of my instances. –  Julien Grenier May 18 '11 at 17:35

Your Answer

 
discard

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.