Previously, in our continuing discussion of Amazon Elastic Cloud Computing (EC2), I showed how to set up a simple EC2 virtual server, and how to host basic content (HTML pages) using Apache. This week, I’ll examine how to configure a domain name to point to your server. Fortunately, compared to everything we’ve done so far, this is a relatively simple task. I’ll finish with a quick discussion of Route 53, Amazon’s new domain name server.
When the EC2 service first premiered, each EC2 server was assigned a dynamic IP. If a server had to be restarted, it was given a new dynamic IP. Obviously, this makes mapping a domain name to a server problematic, as the DNS association between the domain name and the server IP would be invalidated with every server restart.
To overcome this problem while still retaining the reliability and scalability of cloud computing, Amazon introduced the notion of Elastic IPs. An Elastic IP is a static IP address that belongs to your Amazon EC2 account, as opposed to a specific 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.
Amazon doesn’t charge money for requesting Elastic IPs, but does charge a nominal fee for any unmapped Elastic IPs. To receive a new Elastic IP, simply go to Elastic IPs on the EC2 screen, and click Allocate New Address.
You can then select the newly assigned IP and click Associate to assign it to your EC2 instance. The Elastic IP should be mapped to your virtual server within minutes.
Mapping an Elastic IP to a Domain Name
Once you’ve allocated an Elastic IP to your EC2 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. If you have your domain registered with GoDaddy, for example, you can go to the GoDaddy DNS Manager, select Edit Zone for your domain, and put the Elastic IP in the box provided for the A record.
As with most DNS changes, you may need to wait up until 24 hours for old DNS records to expire before the domain name successfully maps to your EC2 server.
Using Route 53 for Dynamic DNS Configuration
As I was researching this article, Amazon announced its new Route 53 domain name service, which allows both configuration and lookup of DNS records using a REST-based API.
I was hoping at the time that Amazon announced it that there would be great UI support for Route 53. It should be possible, for example, to go to the EC2 Dashboard, map the domain to an Elastic IP address, and receive from Amazon a list of nameservers to provide to your domain registrat. Unfortunately, such Dashbaord support is currently lacking. Early adapters must use the REST API, which involves:
- Generate a CreateHostedZoneRequest XML file;
- Create an access key to validate your EC2 account with the API;
- Submit the DNS request to Route 53 using a Perl script (dnscurl.pl); and
- Configure your domain registrar to use the domain name servers returned by Route 53 in the previous step.
Hopefully, in the future, Amazon will provide excellent Dashboard support for Route 53. Until then, unless you need to develop a set of tools to manage a complex network of EC2 virtual servers, changing your registrar’s A record will likely be all you need.
Latest posts by Jay Andrew Allen (see all)
- Creating New Linux Users and Login Keys on Amazon EC2 - December 22, 2010
- Upload Files to Your Amazon EC2 Server using WinSCP - December 16, 2010
- How to Point a Domain to an Amazon EC2 Virtual Server - December 8, 2010