Change hostname for AWS ec2 instance
Asked Answered
G

2

5

I have an AWS EC2 instance with domain like http://ec2-some-ip-addres.compute-1.amazonaws.com/

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

I have tried editing /etc/hosts file with

ip-address hostname alias

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

Gamut answered 8/10, 2015 at 22:19 Comment(5)
Please rephrase what are you actually trying to achieve (the way you explained it makes little sense). Do you want the website that is running on your AWS instance to be reachable using www.example.com?Furl
@dusan.bajic, Yes, am trying to map my public IP or public DNS to a custom domain like something.my which is not a registered domain. I want to use something.my as an alias to public IP or public DNSGamut
you need to create a CNAME from your domain to the ec2 one. you don't actually rename the ec instanceMeador
I see. I believe Superuser may be the better place for that question.Furl
What do you mean by "something.my which is not a registered domain" ? if the domain is not registered, how can you use it?Abdul
S
7

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 example.com
  • Create a subdomain (eg server1.example.com
  • Create an A record in the DNS system to point to the Elastic IP address

You can then access your instance via server1.example.com.

See also: Routing Queries to an Amazon EC2 Instance

Straub answered 9/10, 2015 at 20:50 Comment(1)
Ok, That is what I did at the end.Gamut
P
2

You can't change it as it depends upon ec2 servers Private and Public IP. Although you can change the public and private IP.

Phthisic answered 4/9, 2019 at 14:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.