Setting up a static IP with AWS EC2 Elastic IP

Elastic IP's are a service available through AWS EC2 and supporting EC2 instances.

When a EC2 instance is first spun-up it is allocated a private IP within a virtual LAN. It is also allocated a public IP which is mapped to that private IP.

When an EC2 instance is stopped (or terminated) those IP addresses and mappings will no longer be associated with an instance. If a stopped instance is restarted it will likely receive new addresses.

"An Elastic IP address is a static IPv4 address designed for dynamic cloud computing. An Elastic IP address is associated with your AWS account."


That is its a static virtual IP that can be mapped to serivces in a number of different ways.

Lets say we need to setup a static IP, for a mail server ... a common enough integration requirement.

Create the static vip:

  • Fire up your AWS console;
  • Select Services > EC2 > elastic IPs;
  • Allocate a new address.
  • Voila! you have a new public IP of your very own.
Figure 1: Elastic IP Description


Associate this new public IP with a private IP or instance:

  • Select the Elastic IP
  • Actions > Associate address

You will probably want to associate it with an instance rather than private IP,  that way as you stop or start your server it will remain associated with that server instance. Note the warning. This means that its public IP will now be associated with the Elastic IP until you release it again. You will need to change the addresses you use to cvonnect to the host.

With the public IP allocated you can set up forward and reverse DNS entries for the IP.

So if you are using Route 53

  • Select Services > Route 53 > Hosted zones
  • Select the zone (Domain Name) within which you want to make the new FQDN
  • Create Record Set
  • Create a new A record
Figure 2: create a new A record


Ok so if we do an nslookup we get what we are looking for, but ...

Figure 3: Undesirable Reverese Lookup

The reverse lookup is less than desirable. To setup the reverse entry you will need to:

  • Create the reverse zone as described here...
  • Services > Route 53 > Hosted Zones
  • Create Hosted Zone
    • Domain name: 198.228.13.in-addr.arpa
  • Create a PTR record
    • 33 PTR mail.ensite.me
  • Contact AWS and have them complete setup of the reverse entry by submitting this form here...

Once this request has been fulfilled you are done.

Paramter: Values
FQDN mail.my-host.net
Reverse 33.198.228.13.in-addr.arpa
IP 33.198.228.13


You will again need to change the address you use to connect to the mail host. You should be able to connect using mail.my-host.net.