How to connect a domain name to an EC2 instance

Launch an EC2 instance and set up the web server (In my case, I setup the Ubuntu12.04 instance and install the Apache web server on it):

At this point my website is up and running but with the long amazon url(i.e.

Each EC2 server is assigned a dynamic IP. If a server has to be restarted, it is given a new dynamic IP and we have to remember this new long string each time to access our web server.

To overcome this problem, we can create free domain with and map it with our web server. For this, allocate an Elastic IP and associate it with the instance.

Then right click on the Elastic IP and select the “Associate“, and choose the instance that we created above:

Now we have an elastic IP which is a number that looks like Copy this number because we will use it in next step:

Login to the site and navigate to this panel:

Add the elastic IP against the “A Record” entries:

Finally, we need to wait sometime (few minutes to an hour) for it all to propagate through.After that our domain should now start resolving to the web server we have on EC2:

Hope this will help you!