Create a Hosted Zone for our domain:-
- Open the Amazon Route 53 console at https://console.aws.amazon.com/route53/.
- Click Hosted Zones in the navigation pane.
- Click Create Hosted Zone.
- In Domain Name, enter a domain name.
Now, we can see new NS records from aws, and we want to copy it over to our current DNS provider’s records.
Set up a DNS provider — ns switch:-
If we registered a new domain name, we’re ready to set up Amazon Route 53 as our DNS provider.
However, in our case, we need to transfer existing DNS records from our current DNS provider to Amazon Route 53 in order to ensure the continued availability of the services hosted under the domain name.
To determine which DNS records we must replicate in Amazon Route 53, check the DNS record settings configured for the domain in our current DNS provider. Two records that we should not transfer to Amazon Route 53 are the Start of Authority (SOA) and Name Server (NS) records. These records were set by Amazon Route 53 when the name servers were allocated, and they should not be changed.
First, log into the domain name registrar that we used to register our domain name. Use the web interface provided by the registrar to set the name servers for our domain to the name server values displayed under Name Servers in the details for the hosted zone.
Wait between two to 48 hours for the Internet DNS resolver network to propagate name server changes. To see if the name server change has gone through, use a command-line utility such as dig or nslookup.
Set up a web server
We set up Apache webserver on our ec2 instance:
$ sudo apt-get update
$ sudo apt-get install apache2
Now we want to set up a record inside of our Route53 to point our server. We’re going to create a new recordset.
Create Record Sets
Let’s configure the alias resource record set for our www subdomain.
- On the Hosted Zones page, select the hosted zone that we created for our domain.
- Click Go to Record Sets.
- Click Create Record Set.
- Under Create Record Set, do the following:
- In Name, type www. The root domain is already specified for us, and the connecting period (.) appears when we start typing.
- From Type, select A — IPv4 address.
- In Alias, select No.
- Put ip address as a value.
- From Routing Policy, select Simple.
- Leave Evaluate Target Health set to No.
- Click Create.
Now we want to set an alias (epicmath.com) for www.epicmath.com:
To see if the name server change has gone through, we use a command-line utility such as dig or nslookup:
$ dig epicmath.com
;; ANSWER SECTION:
epicmath.com. 300 IN A 220.127.116.11$ nslookup www.epicmath.com
HOW TO ADD SSL CERTIFICATE:-
Using 2 methods
- Static page on Elastic Beanstalk
- Static page on Amazon S3
1. Elastic Beanstalk
a) Get SSL certificate
To get your SSL certificate, simply go to the AWS Certificate Manager (ACM), which issues them for free.
On the first step, you enter the domain name(s) you want to register. Subsequently, on the second step, it will ask you to validate that you are actually the owner of the domain. The 2 options are (1) DNS and (2) Email, just follow the instructions, and soon you’ll have your certificate (it may take up to 60 minutes). If your domain is already on an AWS Hosted Zone, I recommend the DNS route.
2. Amazon S3
a) Get SSL Certificate
Again, it’s best to use the free SSL certificates issued by AWS Certificate Manager. See section 1 for instructions.
b) Link to your S3 page
To use your SSL certificate can get your S3 page onto HTTPS, we have to use a service called CloudFront. You can find your AWS console. Click ‘Create Distribution’, and go through the fields — you can leave most of them as they are.
The important fields are Origin Settings, through which you link to your already existent S3 page. Additionally, lower down, you can select the respective SSL Certificate.
Once the distribution is created, you’ve basically got an outer layer wrapped around your page that can handle HTTPS.
How do you make your URL address actually point there? Go to the Route 53manager in your AWS console. Now click ‘Hosted Zones’, select your domain, and ‘Create Record Set’. The goal here is to create an alias that links your domain to the CloudFront distribution you just made.
Choose your CloudFront distribution from the dropdown for ‘Alias Target’, and create. The changes may take a bit to propagate, but you’re done!