Amazon EC2 How to – Part 3: Elastic IP

by Alexander Weiß

If you followed my Amazon EC2 How to posts, you should have shell access to your instance. For the connection to your instance you should use the public DNS name. In this part of the Amazon EC2 How to series you’ll learn to assign a public IP address to your instance.

If you want to run some public webservices on your instance you usually want to make this service available under a URL which is easily remembered. The default public DNS name of your instance doesn’t meet this criterion. So what you usually do is to register a domain and connect the domain to the webservice. However, most domain hoster need an IP address for that purpose. The private IP address that comes with your instance is of no use here. So you have to assign somehow a public IP address to your instance.

Elastic IP

In the Amazon EC2 world public IP addresses are called Elastic IP. An Elastic IP is more than just a public IP address. The Elastic IP is associated with your Amazon Web Service account and not a single instance. If you assign the Elastic IP to an instance, the instance becomes accessible under the IP address. But if you terminate this instance the Elastic IP address remains under you authority. You can easily assign it to another instance and this instance will almost immediately be available under the IP address. There is no need for a technician to change anything and you and your customer don’t have to wait until the DNS has replicated. Assigning and detaching an Elastic IP can also been done programmatically.

This sounds very comfortable and it really is. The best is: using an Elastic IP can be free. You only have to pay for the Elastic IP if it is not assigned to an instance.

Create an Elastic IP

To create an Elastic IP you just have to open the Amazon Management Console for EC2. On the left side under “Network & Security” you’ll find the option Elastic IPs. If you click on it the following console will display:

Amazon EC2 How to Elastic Ip pool

Amazon EC2 How to: Elastic Ip pool

To create a public IP click on “Allocate New Address”. In the following dialogue don’t change the default value “EC2” and click on “Yes, Allocate”. In the table below a new Elastic IP will appear. To connect it to an instance select it and choose “Associate Address”. In the pop up window you’ll have to choose the instance from a drop down. A few seconds after you clicked “Yes, Associate” your instance will be available under the Elastic IP.

You can disassociate the address by clicking the button. Now the Elastic IP is in your pool and it is costing you money, because it isn’t assigned to a running instance. If you want to get rid of the Elastic IP you have to click the “Release Address” button.

I’ll end my Amazon EC2 How to series now, because all the basics are covered. I’ll come back later to the Amazon EC2 How to series with more advanced topics. But first, I’ll explain the different cloud types like IaaS, SaaS, etc.

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)