URL Redirections in AWS

Every once in a while we get a request to create a new URL and redirect the old URLs to point to the new ones. Ah!!! I get the frustration, but, once you get your hand’s dirty, you won’t be able to stop your excitement. Let’s get the ball rolling.

If you have dealt with WebServers, you must already know that we use redirect rules in the configuration file to serve this purpose. But in AWS, there are a couple of steps for you to do to accomplish this.

Note – I would strongly recommend automating (IAC Model) for this process. Believe me, you want this 😉

Use case – Let’s redirect website1.com to website2.com

Here we go, with the steps of redirection

  1. Create an S3 bucket and enable static website hosting pointing to DNS website2.com
  2. Create a CloudFront distribution
    1. Whose ‘Origin Domain Name’ points to the static website URL from the previous step. (ex – <example>.s3-website.ca-central-1.amazonaws.com)
    2. Alternate Domain Names must be website1.com
    3. Add the related SSL cert
  3. Now create a route53 alias record for website1.com that points to the CloudFront distribution from the previous step

ALL DONE!!

Automate this and make your life simpler ☺️

Published by Ritesh Kumar Reddy

I(Ritesh) work as a Sr. Cloud Engineer for a living. Learning new technologies has always been my hobby. Why not share it? Here is the brainchild – blogging to share the knowledge. This blog is for those who wish to start or already into the Cloud field. Each article briefly talks about a tool/technology that is used in the Cloud model. Once you read the article, I hope, you get a kick start regarding the specific tool/technology.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: