AWS Redirect URL with Route 53 and S3
Published: 6th of May 2020
I previously hosted my domains with GoDaddy. In their service it was pretty trivial to redirect a URL from one domain to another. I own the domain bradleysearle.com and I redirect it to https://codingpackets.com/about. The process to do this is not as simple with AWS so in this post I will show you how to accomplish this using the Route 53 and S3 services.
Firstly you must create an S3 bucket. Browse to:
Enter the bucket name and set the bucket region and press create bucket.
To modify the bucket to act as a Static web hosting bucket browse to:
Select the option the Redirect requests, enter the URL in the Target bucket or domain field. Protocol, Then press save.
That's it for the S3 component. Now lets move onto the Route 53 component.
Your domain must be managed with AWS route 53. I will not cover the process of registering or transferring your domain in this post.
Create a hosted zone for your domain. Browse to:
Enter the Domain Name, keep the type as Public Hosted Zone the press Create.
Browse to the newly created Hosted Zone
Create an Alias record by pressing the Create Record Set button.
Select the Alias: Yes button and select the previously created S3 <bucket-name>. Then press Create.
That's it for the Route 53 component.
It may take 15mins or so for DNS to propogate.
curl CLI tool can be used to test the redirect is working.
curl -sD - -o /dev/null bradleysearle.com # output HTTP/1.1 301 Moved Permanently x-amz-id-2: bg3q2exWKIyi4+qzEH+30WwBlIrpxDoZD37k6Q7BMn3+qpBMTamUBYLCw++MY6eLzFEB5ju6cJM= x-amz-request-id: 5F858D21794D6A70 Date: Tue, 05 May 2020 21:25:00 GMT Location: https://codingpackets.com/about/ Content-Length: 0 Server: AmazonS3
In this post I showed you how to setup a URL redirect using the AWS Route 53 and S3 services. Its not as simple as some other service providers but at the same time there is not a lot to it.