Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have been working with AWS for over a year, setting up EC2 instances, domains, ELBs, etc.

When I want to assign a subdomain to an EC2 instance, I have to create an elastic IP (that I pay for), then assign a CNAME record to that elastic IP.

When I want to assign a subdomain to an ELB (load balancer) instance, I just create an alias resource record set to the ELB.

I've read over the docs and don't understand why AWS doesn't support aliasing to instances. Am I missing a key concept here? Wouldn't it be simpler to just alias EC2 instances and skip the whole elastic IP bit?

EDIT: To put it simply - why are my EC2 instances not on this list: enter image description here

share|improve this question

closed as too broad by Basil, RolandoMySQLDBA, Tom O'Connor May 28 at 8:56

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

The short answer is: You can create an A or CNAME record to the external IP address or the DNS name of your instance, but you don't want to do this.

The long answer: You actually can create a CNAME (or even A) record without an Elastic IP. But every time your EC2 instance is rebooted and so moved to another host system the IP address (and your external hostname) of your instance will change. If you can live with this and accept the fact that during the TTL of your DNS record your instance is not reachable you can use the external IP and create an A record with your subdomain. But as DNS is not very fast in distributing changes (even with a low TTL you can't make sure every resolver handles the TTL correctly) you don't want to do such things most of the times. This is why AWS provides the Elastic IP - so your IP address which is in the DNS record never changes but the routing behind this IP address is changed by AWS if you reassign it to another instance (or you reboot your host). This routing change is only inside the AWS data centers and so it is quiet fast (within a few seconds) and your instance is reachable again for all users.

Hope this helps!

share|improve this answer

Elastic IP addresses are only paid for if they are unassigned (ie. unused). As long as your Elastic IP address is assigned to your instance, you do not pay for it.

IF AWS supported DNS aliases to the non-elastic IP addresses of instances, then whenever those public IP addresses changed, then the DNS would be out-of-date. Elastic IP addresses keep the IP address consistent.

However, I agree that I could see value in adding alias support for Elastic IP addresses though.

share|improve this answer
"whenever those public IP addresses changed, then the DNS would be out-of-date" - sure, but AWS could easily update their alias mapping to the new DNS correct? –  praterade May 28 at 13:04
Yes, but all the cached values from previous resolutions would be wrong until the TTL expired. –  Matt Houser May 28 at 23:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.