DEV Community

Cover image for AWS Custom Domain Redirect with S3 and Route 53
Andrew Alba
Andrew Alba

Posted on

AWS Custom Domain Redirect with S3 and Route 53

Working with a client who has been using Zoom video conferencing frequently, I suggested a pretty URL to help clients access the Zoom meetings.

I decided that I wanted to create a URL that was something like https://zoom.custom-domain.com/ that would redirect to Zoom meeting link such as https://us02web.zoom.us/j/94220614975?pwd=et9bd32Av2JC2yCtQifmA8ZoRpfxB6Nr. In the past, I would construct the redirect using .htaccess or through the domain name registrar console.

The client had a static site using a custom domain that was hosted on AWS using S3, CloudFront, and Route 53. I initially thought I could do this with the hosted zone for the client's domain name. I soon learned AWS has a different process for this type of redirect. Log into your AWS console and follow along.

S3 Bucket Redirect

To create the redirect, we need to start by creating an S3 Bucket. It didn't make much sense to me at first, but we will connect the dots later.

  1. Navigate to the S3 service in your console.
  2. We used the domain URL to name our bucket zoom.custom-domain.com. Be sure to uncheck the Block all public access under Block Public Access settings for this bucket section. You will need to check the box that appears to acknowledge this change.
  3. Click the Create bucket button. Create S3 Bucket
  4. Click the bucket name in the list of buckets to open the bucket.
  5. Select the Properties tab.
  6. Scroll to the bottom of the page and click the Edit button within the Static website hosting section.
  7. Select the Enable radio button under Static website hosting.
  8. Select the Redirect requests for an object radio button under Hosting type.
  9. Enter the redirect URL within the Host name field.
  10. Select your Protocol.
  11. Click the Save changes button to complete. Edit Static Hosting

Our redirect is now in place and you can test by scrolling back down to the Static website hosting section and using the redirect link.

Verify Redirection Link

Add Redirect to Route 53

  1. Navigate your browser to Route 53 service and click on the Hosted zones link to list the hosted zones.
  2. Select/click the hosted zone we would like to add a record too.
  3. Under the Records section click the Create record button.
  4. Toggle the Alias on.
  5. Enter your subdomain value in the record name field. In our example it is zoom.
  6. Under the Route traffic to option, select Alias to S3 website endpoint. Select your region and then select the S3 bucket redirect created above.
  7. Click the Create records button. Create Hosting Record

Once the host record propagates, the URL should redirect. Test it out in your browser.

Conclusion

This wasn't the solution I expected when I started on this path, but the implementation is simple. Hopefully, you found these instructions useful. If you have any comments, feel free to share them.

Best of luck and cheers!

Top comments (0)