How To: Connecting Google Domains to Amazon S3

Just recently I was asked to help a friend create a static landing page. While I’ve built Rails apps (deployed on Heroku) and hobby landing pages, this was my first time taking a site from A to Z, from writing the files to hosting to connecting the domain. I was given the domain via Google Domains and opted to host the site on Amazon S3 because it seemed like a good set up to get familiar with.

Step 1: Purchase your Domain Name

I’ve used GoDaddy primarily in the past for my domain name needs, but since Google rolled out its own domain site, it was a no-brainer to make the switch. The site is user-friendly with tons of tutorials and an extensive FAQ resources section. My friend purchased his domain for $12 a year.

Step 2: Create an AWS account for access to S3

Amazon’s Simple Storage Service (S3) is overall a fantastic resource to consider when hosting your web applications. It offers tiered pricing related to usage and storage, so you only pay for what you use. I won’t go into much detail on the benefits of S3 since it’s covered well on their site, but will mention that S3 is also great for hosting static sites that don’t require a database.

Step 3: Upload your website files to S3

Assuming you’ve written all your HTML, CSS, and JS files, you will now need to upload those files to a S3 bucket, the new home for all your website files. Since this site only had a handful of files, I chose to upload using the AWS console.

  1. Enable Static Website hosting: navigate to your newly created bucket and click on the “Properties” tab under the breadcrumbs. Click on the box “Static website hosting” and select “Use this bucket to host a website”. Set your index document (generally index.html).
  2. Upload all of your website files to the bucket. The console has an easy drag and drop function. Don’t drag the directory that contains all of your website files; instead, navigate into that directory and select all of the files within it.
  3. Set the Bucket policy: inside the bucket, find “Permissions” tab (next to “Properties”) and click on “Bucket Policy”. Copy and paste the following code into the editor, replacing “example.com” with your domain name.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::example.com/*"
}
]
}
Use this Bucket for Website Hosting
  • I had to upload several HTML files multiple times after making some changes locally. Not an issue for small sites, but it can get quite tedious for large applications.

Step 4: Head over to Route 53

Inside the AWS console, navigate to Route 53. From the Dashboard, click on the “Services” button in the upper left hand corner and select Route 53 from the dropdown box on the left hand side.

Enter in your domain name (without www) and leave Type as Public Hosted Zone
Click on “Create Record Set” to create Alias-type records

Step 5: Tell Google Domain where to send all requests to your website

This is where all the magic happens!

  1. Copy and paste each Name Server (NS) from the Route 53-Record Sets panel. Google Domains will strip the ending period that is included in the Route 53 record.
With the NS from Route 53

wife. product manager. traveler. DIY-er at @imperfect.thread

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store