How to point your Namecheap/GoDaddy Domain to an AWS Load Balancer
If you’ve ever build a web service on AWS before, you know that the out-the-box domain names are quite ugly and not human friendly.
Luckily, it’s really easy to set up your domain (www.example.com) or subdomain (api.example.com) to use instead of Amazon’s.
Register a Domain with a Domain Registrar
Firstly, register your domain through a domain registrar like GoDaddy or NameCheap or take one that you already own.
Once you have your domain, go to the advanced DNS tab or wherever you can configure custom A-Records/CNAMES/etc in your registrar’s website.
Add a new CNAME record for your domain.
- Under Type select “CNAME”. Under “Host” put whatever subdomain you want to have point to your Load Balancer. For example, if your domain is www.example.com, and you want your API to be behind api.example.com, put “api” in this field. Similarly, if you wanted www.example.com to point to your API, you would put “www” in this section. Some domain registrars require you to put the entire path in this field, so check their documentation.
- Under “Value”” put the DNS name of your load balancer. xxx-<aws-region>.elb.amazonaws.com.
- Save your new CNAME entry.
Viola! Your domain/subdomain should now be pointing to your AWS Load Balancer. If it doesn’t immediately work, you may need to wait up to several hours for the domain CNAME changes to reflect.
If you enjoyed this post, don’t forget to clap! You can follow me on Twitter at @Montana_Wong