How to connect EC2 instance with GoDaddy Domain
In this tutorial, you'll learn about how to connect applications hosted on AWS EC2 with the Godaddy domain using the Route53 service.
Before starting this tutorial make sure your application should be accessible from public IP or public DNS which is available in EC2.
Also read,
So let's get started...
How to connect EC2 instance with GoDaddy Domain
As public IP or Public DNS provided by ec2 will keep changing while you always start/stop or restart the instance, and we need to provide this IP address for connecting domain but if IP address changes then it will stop working.
So, to overcome this problem AWS provided an Elastic IP solution that provides static IP which won't change during server restart.
Create Elastic IP in AWS:
Go to your EC2 section and select your running instance
From the left side, menu select Elastic IPs under Network & Security menu
Then click on the 'Allocate Elastic IP address' address button
Click on Allocate button
Now you have allocated IP address, now you need to connect this created elastic IP with your EC2 instance, so select elastic IP and from the Actions menu choose Associate Elastic IP Adress,
Then select your running EC2 instance from the list and your instance will be associated with your elastic IP.
Now go back to the EC2 instance list and select your running instance now you will be able to see your "Elastic IP addresses" in the details section.
also, Public IPv4 and Public DNS also will be changed, so now if you restart your instance your IP will not be changed.
You can check with this IP as everything in the browser works properly by typing this IP in the URL.
Connect Domain using Route53:
Go to the services section and select Route53:
Click on 'Create Hosted Zone'
Now add your domain name and select Public Hosted Zone, then click on Create hosted Zone.
After creating the hosted zone, it will generate some records as below:
Now Click on Create Record Set and add record as below:
use your domain name and Elastic IP in relative columns and then It will create record A.
Now add another record, as below:
Select NS type record from records list and copy all values, as we need this to create a nameserver in Godaddy.
Connect with Godaddy:
Create a GoDaddy account if you don't have one or log in if you already have and from the dashboard select the MyProducts option, then click on the DNS button:
Now choose 'I'll use my own nameservers' and add your nameserver which you copied from AWS and paste it one by one per line and save it.
When making the entry, you are not needed to provide the final dot of each Nameserver record.
Awesome!!! That's All, Your EC2 container or the service offered by the IP should soon be available using the domain you entered.