The answer is to use Elastic IP Address, If your instance(the one you want to point your naked domain like example.com to) is already assigned an Elastic IP address, just update your domains A record to point it to this IP address. If you don’t have an elastic IP address mapped to your instance, then you can follow the AWS documentation on how to assign an Elastic IP address to your instance.
What is Naked domain ?
Naked domain is the domain name with out the www sub domain, that is example.com instead of http://www.example.com, this is usually helpful when a website administrator wants, to give the users flexibility to visit their website without typing the www.
There are many websites that does this, and it can be achieved in AWS, either by pointing the A record directly to the IP address, where the website is hosted, or using a placeholder IP and redirecting all the web request to the www url.
Drawbacks of pointing naked domains to a web application
- Pointing your domain name to a web application is known to cause issues with SMTP servers and may impact mail delivery for that domain name.
- Hard coding an IP address to your website address also might not be scalable.