AWS Route 53 redirecting to an external https domain.

tldr: inside an s3 bucket with site hosting add a redirect.html file, a CloudFront distribution that loads the file and a route53 record set that adds an ‘Alias’ for the CloudFront distribution. Solution and code below.

My Journey to this solution

Recently I re-launched a new design of my personal site, this also involved moving the domain from to Having registered on AWS and on google domains.

Before the launch I had my redirecting to google domains via the ‘redirect’ domain control. Super simple

But when I had to do the forwarding in the other direction AWS was not as easy. There are a couple of recommended forwarding methods that AWS has noted down, however these didn’t work for my use case.

The first method that didn’t work for me was the s3 bucket redirecting. The first issue I had with this was: My s3 bucket wasn’t showing up in the ‘Alias Target’ list. This is because your bucket name has to be exactly the same as the name of the Record Set. i.e. my record set was, my bucket name needed to be

Setting an alias target for an existing s3 bucket

‘But what if that bucket name is already taken?’ you say. Well you’re outta luck on this method.

Eventually I got the alias set up for the root host, but what I was presented with was infinite loading of

After some digging I came to the conclusion that because my site is hosted on Github Pages and it’s enforcing HTTPS, which the s3 redirect doesn’t like so much. Another downfall of this method would have been the second bucket for and a second Route 53 record set.

The next step to this would be to setting up a CloudFront configuration that acts as the redirect for you. This however wasn’t ideal as AWS needed to have an ssl cert for and that was located on another service entirely.


My end solution was to add a redirect.html file within my old site hosting bucket with a small redirect page. Then I pointed the CloudFront distribution I already had to the new page instead of index (this was using the original SSL certificate I had for The final step was to have two aliases on my domain pointing to the CloudFront distribution.


<!DOCTYPE html>
<meta http-equiv="refresh" content="0; url=">

Bucket settings:

Using the bucket to host the single file

CloudFront distribution settings:

Note the SSL Certificate is for the original domain

Route 53 Record set:

There is also a record for

Honestly this was a lot more effort than it really should have been. It would be nice for some sort of redirect service to be available within AWS itself. I will probably at some point migrate my domain to Google domains, however I have email set up for this domain so there would be some downtime on my professional email which would be inconvenient at this time.

This is my solution and others may vary. Feel free to let me know if you have found another solution that works for you!



Holistic software engineer.

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