All Amazon EC2 instances are
assigned two IP addresses at launch: a private IP address (RFC 1918) and a
public IP address that are directly mapped to each other through network address
translation (NAT). Private IP addresses are only reachable from within the
Amazon EC2 network. Public addresses are reachable from the Internet.

This is nice as it allows you to use the external DNS name
within amazon and get the internal address, this should speed up transfers
between your instances and save money as data transfer within amazon is free.

Reboot

What happens to the IP addresses after a server reboot.

Reboot your ec2 instance

>sudo
reboot now

Log back in and check the Internal and external IP addresses

>GET
http://169.254.169.254/latest/meta-data/local-ipv4; echo

>GET
http://169.254.169.254/latest/meta-data/public-ipv4/; echo

I get

Local IP : 10.195.207.86

Public IP : 184.73.114.208

For good measure I rebooted a dozen times and always got the
same local IP and public IP address.
(this is a reboot from the command line not an aws reboot of the
machine)

AWS console Reboot, Start/Stop

So what happens when you reboot from the aws console?

Log into the console select the ec2 instance and click on
Instance Actionsà
Reboot

You may need to click refresh in the upper right hand corner
to update the console.

The local IP has remained the same but the public IP has
changed to the EIP address.

Using dig with an EIP attached has the expected results.

>dig
ec2-50-19-82-64.compute-1.amazonaws.com +short

Within the AWS zone

10.212.105.230

Outside the AWS zone

50.19.82.64

Route 53 also has the same expected results. I updated the A record to 50.19.82.64 and the
CNAME to ec2-50-19-82-64.compute-1.amazonaws.com and got the same results I did
before, EIP does not effect it in any
special way.

How do you deal with servers talking to each other within an AWS zone?

I think the answer to this is using the VPC features, which
I will write about in another paper. But if you do not plan on using them here
are a few ways I think you could deal with it.

Do it all by hand, you could update all your route53 records
using CNAME and update all your /etc/hosts files by hand.

You could script it to auto update all these things. One example I found is here http://crishantha.com/wp/?p=416
[5]. This helps a lot but it’s still a
bit of a convoluted solution. But it may
be just what you are looking for.

I think the thing that makes this hard is that you need to
plan for your servers to go down. They
will go down, and should the need to be stopped/started or replaces with a new
instance you will get new internal IP addresses (even if you are using Elastic
IPs). So if you plan for that pain
point if you plan on handling your servers this way.