301 Redirect Subdomain Forwarding On AWS Route 53


UPDATED: fixed missing/broken gist link with the code snippet.

Recently I decided to ditch registrar DNS Managers like GoDaddy’s in favor of Amazon’s Route53. I really like their console and the DNS is snappy and responsive, not to mention the handy features when creating and pointing to Load Balancers for your TLD. However, one draw back of Route 53 is the lack of subdomain forwarding. Below is a quick solution.

All you will need is an Amazon S3 bucket, the static website end-point, and a Route 53 CNAME.

1.) Create an S3 Bucket: Name the bucket ie: subdomaintoForward.mydomain.com. It has to be the exact subdomain you wish to forward otherwise Route 53 won’t resolve. Choose the region and create!


2.) Enable S3 Website Hosting: Open your new bucket and click the “Properties” tab. Open up “Static Website Hosting” than select “Enable website hosting” and make the “Index document” simply index.html. After that, click “Edit Redirection Rules” to open up a text box.


Paste in the XML below:

This breaks down a regular URL that you want it to forward too. In this example, I want subdomaintoForward.mydomain.com to 301 redirect to http://domaintoforwardto.com/anything/after/thedomain/index5.html – compare this URL to the XML above, you should be able to figure out the syntax.

Click Save!

3.) Create A CNAME in Route 53: Make note of the “Static Website Hosting” End-point, copy that, then open up Amazon Route 53. Select your Hosted Zone and click “Go to Record Sets”. Click “Create Record Set” and configure your Record. In this example, domaintoForward is the subdomain, use CNAEM, and paste in the Static Web Hosting End-point into Value. Create the record.


Published by


Born and raised in the Pacific Northwest, there are only a few things to do during the rainy season: code, sleep, shred.

5 thoughts on “301 Redirect Subdomain Forwarding On AWS Route 53”

Leave a Reply

Your email address will not be published. Required fields are marked *