preloader
blog-post

How To Connect Google Domain to Route 53

Table of Contents

In this article we will see the steps to connect your custom google domain with AWS Route 53. This article was written using google domain as an example but the approach is the same for connecting any other domain registrar like GoDaddy, Namecheap etc with AWS Route 53.

Step 1: Create a Hosted Zone in AWS Route 53

  • Login into your AWS Management Console and head towards Route 53
  • In Route 53 –> Click Hosted zones – > Click Create Hosted Zone
  • Fill in Domain Name and select Type as Public Hosted Zone and click create

Step 2: Update Google Domain

  • Log into your Google Domains account and click on My domains
  • Click on DNS
  • In Name servers, Select Use custom name servers
  • Copy and paste all four Name Server (NS) from the Route 53 Record Sets panel and click save
  • You should get a confirmation message like Changes to example.com saved. They'll take effect within the next 48 hours.

Step 3: Connect the domain with the content

So for now lets assume, I do not have a web page to which my domain should forward requests. I am going to forward all my request to google.com

  • Create a s3 bucket with the name as your domain name, say example.com

  • Go to Permissions and turn off Block all public access

  • Click on Bucket Policy and set read only access

      {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Sid": "PublicReadGetObject",
                "Effect": "Allow",
                "Principal": "*",
                "Action": "s3:GetObject",
                "Resource": "arn:aws:s3:::example.com/*"
            }
        ]
    }
    
  • Go to S3 bucket properties and enable Static website hosting, Here we will select redirect requests and type www.google.com in target bucket or domain

  • Copy the endpoint from static web hosting and use it to create a new CloudFront distribution. Remember here “Origin Domain Name” should the endpoint from static web hosting of s3 and not the s3 bucket itself

  • After you have the CloudFront distribution, Copy the Domain Name from CloudFront distribution

  • Go to Route 53 –> Click Hosted zones –> Click the Hosted zone which we created in step 1

    • Add a record set for the naked domain name say example.com

      Name example.com
      Type A
      Alias Yes
      Alias Target Domain Name from CloudFront distribution
    • Add a record set for the www domain name say example.com

      Name www.example.com
      Type A
      Alias Yes
      Alias Target Domain Name from CloudFront distribution

DNS changes will take anywhere between couple of hours to 24 hours, After that if you try to access your domain you will be redirected to google.com.

Use dig command to verify dig example.com +nostats +nocomments +nocmd

Share this blog:
Comments

Related Articles