Change hostname for AWS ec2 instance


I have an AWS EC2 instance with domain like

Now I want to change this url (add a custom domain which is not registered) to some small alias like etc. Can we do that?

I have tried editing /etc/hosts file with

But not working. What is the best way to change the url without making a DNS entry on no-ip or some other services?


To access an Amazon EC2 instance with your own domain name, use a DNS server (eg Amazon Route 53) to point your domain name to the IP address of the EC2 instance.

The steps are:

  • Create an Elastic IP address in the EC2 management console. This is a static IP address that you can then control.
  • Assign the Elastic IP address to your EC2 instance
  • Choose a DNS provider (either your own, or Amazon Route 53)
  • Purchase your domain name (in case you don’t already own it), eg
  • Create a subdomain (eg
  • Create an A record in the DNS system to point to the Elastic IP address

You can then access your instance via

See also: Routing Queries to an Amazon EC2 Instance

Leave a Reply