How to add custom domain in aws ec2 instance

 

Point Domain to AWS EC2 Instance

Today we will learn how to point domain to Amazon EC2 instance. We have two way to do that we will learn both of them. So let’s see how to point domain to EC2 instance

Get Elastic IP and Assign it to Amazon instance

The first thing you need to do is get an Elastic IP, the instance IP can change during reboot etc but elastic IP are static IP’s so you should make sure you create one of them and assign it your running instance.

Step 1 – Open the AWS Management Console, click the EC2 link, and display the page associated with your region.

Step 2 – Click the Elastic IPs link in the EC2 Dashboard.

Click Allocate New Address and choose Amazon’s pool of IPv4 Addresses from the list. Click Yes, Allocate to confirm your choice.

Select the newly created Elastic IP and choose Associate Elastic IP Address.

Choose your desired EC2 instance from the drop-down list of running instances and click Associate.

Method 1:

Step 1: Go to the EC2 instance and copy the IP address

Step 2: Goto Your Domain Provider

Next, Go to your domain provider and choose the domain you want to point. Now open DNS. Now add A record. Like below

Next, Click on Save button.

You can expect a propagation time up to 24 hours. This is because it takes time for the DNS to take effect across the internet. The actual time of propagation may vary in some locations based on your network setup.

Congrats! You have successfully point your domain.

Method 2

Create Hosted Zone and Record Sets

Now, Open the Route 53 console at https://console.aws.amazon.com/route53/.

Next, Select DNS management

After clicking on the DNS Management you will see a new screen where you will find another option called Create Hosted Zone click on Create Hosted Zone button

Next, Enter Domain name and hit Create button

You should see something like below on your screen, Name Space servers, usually there are 4 different entries.Make note of these as you need them in the last step.

Now Create a recordset and add values as shown in image below

  • Keep name field empty
  • Select Type A
  • Select Alias No
  • Value – This should be your elastic IP
  • Routeing Policy: Simple

Next, We need to bring subdomain too, so www.yourdomain.com should also work

  • In name field type www.
  • Select Type A
  • Select Alias No
  • Alias Target from dropdown select your site name
  • Routeing Policy: Simple

Add the Amazon NameServers in Control panel of Domain Provider

Now go to your domain provider and select the domain from list you want to point. In my case i am using GoDaddy

Click on the DNS will redirect you on DNS Management page here go to the Nameservers sections and click on Change button

Next, Copy your DNS from aws panel and put here

  • Choose I’will use my own nameservers
  • Enter all the 4 namespace servers you got from AWS
  • Click on Save button

You can expect a propagation time up to 24 hours. This is because it takes time for the DNS to take effect across the internet. The actual time of propagation may vary in some locations based on your network setup.

Congrats! You have successfully point your domain.

Comments

Popular posts from this blog

Git commands

How to Debug Android TV App using IP