Redirecting Static Website Traffic to Another Amazon S3 Bucket

Lab Steps

lock
Logging in to the Amazon Web Services Console
lock
Redirecting Static Website Traffic to Another Amazon S3 Bucket
lock
Handling Error Routing with Conditional Redirects
Need help? Contact our support team

Here you can find the instructions for this specific Lab Step.

If you are ready for a real environment experience please start the Lab. Keep in mind that you'll need to start from the first step.

Introduction

In this lab step, you will configure a URL redirect in Amazon S3 to forward website requests from one bucket to another.

 

Instructions

1. In the AWS Management Console, in the search bar at the top, enter S3, and under Services, click the S3 result:

alt

The Amazon S3 console will load and you will notice two buckets:

alt

 

2. Click the bucket name .

You will notice this bucket only contains a single HTML file.

 

3. Click the Properties tab:

alt

 

4. Scroll down to the bottom of the properties page until you reach the Static website hosting section:

alt

This S3 bucket has been configured with static website hosting enabled and will serve the contents of the single HTML file that resides in this S3 bucket.

 

5. Click the URL link under Bucket website endpoint to open the static website in a new browser tab.

alt

As expected, this URL displays the contents of a simple HTML file. Without a redirection, when you navigate to the  URL, you will land on this page.  

Now you will add a URL redirect to forward any requests to this URL to another S3 bucket.

 

6. Click back to the browser tab with the Amazon S3 console and click Buckets on the left-hand navigation pane:

alt

 

7. Click the bucket name .

There are quite a few more objects in this S3 bucket. This bucket contains an updated version of your static website, which you want your users to begin receiving.

 

8. Click the Properties tab and scroll down to the bottom of the page to the Static website hosting section.

 

9. Copy the URL under Bucket website endpoint:

alt

 

10. Click Buckets on the left-hand navigation pane:

alt

 

11. Click , then the Properties tab, and scroll down to the Static website hosting section once again.

 

12. Click Edit:

alt

 

13. Configure the following on the edit page:

  • Hosting type: Select Redirect requests for an object
  • Host name: Paste in the  URL you copied earlier.

In case you missed it, here it is again: http://.s3-website-us-west-2.amazonaws.com

  • Protocol: Select http

 

14. Before you save your changes, remove the http:// protocol prefix from the URL you provided for Host name.

The protocol will be automatically added during the redirection. Only the domain is required when configuring this property.

 

15. Click Save changes:

alt

 

16. On the Properties page, scroll down to the Static website hosting section once more and click the Bucket website endpoint URL for :

alt

A new browser tab will open and display the updated version of your static website:

alt

Note: If you do not see the updated content, as shown above, double-check the static website hosting configurations and clear your browser cache (for the past 1 hour):

With that, you have successfully configured your static website to redirect users to a completely separate Amazon S3 bucket! 

 

Summary

In this lab step, you configured a URL redirect in Amazon S3 to forward requests from one bucket to another.

Validation checks
1Checks
Created S3 Website Redirect

Check if website redirect was created and associate with another S3 bucket.

Amazon Simple Storage Service (S3)