How to route a subdomain to an Amazon EC2 instance IP

Go to AWS console dashboard.

Search for Route 53 in the search box.

Go to Hosted zones and click the zone you want to add the route.

Click Create record button to add a record.

On the create record form add the following details:

  • Record name: <yourdomain>
  • Record type: A- Routes traffic to an IPV4 address and some AWS resources
  • Value: <IP of your EC2 instance>
  • TTL: 300
  • Routing policy: Simple routing

Click Create records button.

Next page will show a sucess message like this:

Record for <yourdomain> was successfully created.
Route 53 propagates your changes to all of the Route 53 authoritative DNS servers within 60 seconds. Use "View status" button to check propagation status.

You can verify by ping command to see the domain has been set correctly:

ping <yourdomain>

Output:

PING <yourdomain> (<yourip>): 56 data bytes