I purchased a domain through Amazon Route 53 and am hosting my Node.js/ExpressJS app on an Amazon Linux EC2 Instance server. I can get my site to run on my EC2 server by using the public IP:portNumber or by using the publicDNS:portNumber, but I am struggling to understand how to set up the record sets in the hosted zone section of the Route 53 console to have my website point to www.thedomainipurchased.com:portNumber. I also read somewhere that you can't add the port number onto the public ip like that, so I would like to know how to set up both records to do this. I'm new to DNS, which is why I've had such a hard time although I'm sure to some people this seems very simple so would really appreciate any feedback to be explained in as basic and simple of a way as possible. Record Set Picture here
1 Answer
DNS only provides a way to map names to the IP addresses of hosts. Except under very limited circumstances you can't include a port number. DNS simply isn't designed to do that.
Ports are determined by the protocol involved. If you use a web browser to connect via HTTP then it will default to using port 80. If you use a web browser to connect via HTTPS then it will default to using port 443. When you send e-mail the default port is 25. When you SSH into a server the default port is 22. And so on. Default ports are essentially part of the specification for the global internet.
-
1In Route53 I would simply set up a CNAME for
www.mydomain.com
that points to the DNS name of your EC2 instance. Or better yet I would obtain an Elastic IP to assign to the EC2 instance and just set up an A record that contains that IP. If your node.js app will receive a small amount of traffic then simply having it listen on port 80 should be enough. However if you anticipate a significant amount of traffic then common practice is to have a web server (apache, nginx, etc) listening on port 80 and proxying the requests to your app. Those web servers are better at handling lots of traffic.– Bruce PDec 16, 2015 at 17:46 -
1An Elastic IP is assigned to you for as long as you need it. If the instance it's assigned to is terminated then you still have the EIP available and can assign it to a new instance. If you don't use an EIP and your instance is restarted or terminated the you will end up with a new IP each time. DNS takes time to propagate changes, so if you end up with a new IP it can take a while before your users see that new IP. An EIP prevents that from happening since the same IP is always used.– Bruce PDec 16, 2015 at 18:07
-
1Do you mind posting the name of your domain so I can take a look at its DNS settings? Make sure it's using the name servers that Route53 specifies. It's also possible that you just need to wait for your DNS server to timeout its current cached value for your domain.– Bruce PDec 16, 2015 at 18:45
-
1How long ago did you register this domain? It's not showing up anywhere as a valid domain. It can take up to 72 hours for a new domain to propagate across the internet.– Bruce PDec 16, 2015 at 18:55
-
1I suggest you contact AWS support then. Since the domain isn't showing up as a valid internet domain it's not going to resolve for anybody. If you go to www.allwhois.org and enter a well known domain like google.com or amazon.com you'll see what the results look like. Your own domain should return similar information when you enter it there.– Bruce PDec 16, 2015 at 18:59