DEV Community

Mark Orina for AWS Community Builders

Posted on

6 2

How to redirect traffic from a domain to sub subdomain using AWS S3 and Route 53.

Scenario :

You want to redirect traffic from your main domain to a subdomain.
From the AWS documentation, its:
Apex domain (example.com) to subdomain (www.anydomain.com), including www.example.com.

In my case I want to redirect traffic from getkinetic.co to subdomain schools.getkinetic.co.

schools.getkinetic.co points to a landing page with HTTPS protocol.

Prerequisites :
Your Domain Name Service is Route 53 with a hosted zone
You already have an SSL certificate from ACM or any other certificate authority

Steps :

1.Create an s3 bucket with a globally unique name.Once created go to properties as shown:
Scenario :
Image description
Note that the region is North Virginia
2.Scroll to the bottom where it is written static web hosting as shown :
Image description
3.Click edit and you will see Static website hosting disabled by default. Click enable.
4.You will now see a new section: Hosting type with two options: 1.Host a static website
2.Redirect requests for an object.

5.Choose the redirect requests for an object. This is because we are not hosting a new website but redirecting traffic to another domain.
6.Once you have chosen the redirect requests for an object, enter in the host name the target domain as shown :
Image description

7.For protocol choose HTTPS.
8.Click save changes.
9.Next got to your hosted zone on Route 53 and click a create record

  1. To configure the record : Record name - leave the text box empty as we want to
    redirect to the apex domain.
    Record type is Type A : Route traffic to: enable alias and choose Alias to S3 website endpoint, choose the region where your s3
    bucket is situated
    , mine was in US East (N. Virginia) us-east-1, on the next drop-down you will find the bucket you created. See screen shot below: Image description 11.Click save and you are all set!

Top comments (0)

Best Practices for Running  Container WordPress on AWS (ECS, EFS, RDS, ELB) using CDK cover image

Best Practices for Running Container WordPress on AWS (ECS, EFS, RDS, ELB) using CDK

This post discusses the process of migrating a growing WordPress eShop business to AWS using AWS CDK for an easily scalable, high availability architecture. The detailed structure encompasses several pillars: Compute, Storage, Database, Cache, CDN, DNS, Security, and Backup.

Read full post

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay