Setting up an Amazon AWS elastic IP

An Elastic IP is a static public IP address that belongs to your Amazon EC2 account, as opposed to a specific virtual server. You can associate an IP address to a virtual server; if you need to take that server down for any reason, you can associate the IP with one of your other virtual servers. By default an AWS account can have 5 elastic IPs allocated, however you can apply to have more than five.

Allocate an Elastic IP using the AWS console

To receive a new Elastic IP go to Elastic IPs on the EC2 screen on the Amazon AWS Console

Click Allocate New Address

You can then select the newly assigned IP and click Associate to assign it to a specified instance. The Elastic IP will then be mapped to your virtual server within a few minutes.

Mapping an Elastic IP to a Domain Name

Once you’ve allocated an Elastic IP to your Amazon Elastic Compute Cloud server, mapping it to a domain is simple: just modify your domain’s A record with your domain name registrar to point to the Elastic IP.

Allocating an Elastic IP Address using the AWS API

Allocate a new elastic IP address:

$ ec2-allocate-address

View the elastic IP assigned to your account:

$ ec2-describe-addresses

View your instances:

$ ec2-describe-instances
INSTANCE         i-f724f069 ...

Now that we know the assigned elastic IP address and the ID of the instance we can set up the association.
In this example we will associate the IP address with instance i-f724f069

$ ec2-associate-address -i i-f724f069

After a couple of minutes you can verify the association:

$ ec2-describe-addresses
  ADDRESS   i-f724f069

How to disassociate an elastic IP from an instance:

$ ec2-disassociate-address

Use it or bin it

If you are not going to associate a reserved IP with an instance Amazon will charge you! They do this to avoid customers reserving addresses for no reason and then not using it. If you will not be using an elastic IP it might be a good idea to remove it from your account to avoid extra charges.

How to remove and elastic IP from your account:

$ ec2-release-address

Be Sociable, Share!

No related posts.