Why can't I create an Alias Resource Record Set for an EC2 instance [closed]

Solution 1:

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 restarted 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 quite fast (within a few seconds) and your instance is reachable again for all users.

Hope this helps!

Solution 2:

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.