Configure an Amazon S3 Bucket as a Website
, you can also specify "Routing Rules" to redirect requests to one Object to another Object for various reasons. For example, if you want to
Delete an S3 Object (File)
Amazon S3 Bucket
, which is configured from a website, you can define a Routing Rule to redirect the requests to that Object to another Object.
You can define Routing Rules by sending an HTTP PUT Request to Amazon S3 Server. To authenticate the request, you need to be the Bucket owner to be able to configure the website attached to a Bucket and you need to have
permission. As Bucket owners, you may also
rite a Bucket Policy
that grants S3:PutBucketWebsite permission to other users and allows them to set website configuration.
You can send HTTP PUT Request to Amazon Server to specify Routing Rules in two ways:
1) Use Amazon S3 APIs in your application code-
If you are a programmer and want to write code, you can use Amazon S3 REST (described below) or SOAP API. Please read AWS documentation to get details on the SOAP API.
2) Use Bucket Explorer's User Interface for point and click-
If you do not want to write a program, you can use Bucket Explorer to specify Routing Rules using the user interface.
1. Add Routing Rule using Amazon REST API
You can request
PUT Bucket Website
to set the s3 bucket as s3 website and also you can mention redirect rule (optional) with the configuration. It is the additional tag similar to IndexDocument and ErrorDocument, which could be passed with PUT Bucket Website request. You can mention your rule under the RoutingRules Tag. You can also mention number of rules.
PUT /?website HTTP/1.1
2. Add Routing Rule to S3 Website configuration using Bucket Explorer
You can use Bucket Explorer to set and configure (including routing rule) S3 Bucket as S3 Website by pointing and clicking and Bucket Explorer Interface.
Steps to redirect s3 website document on Amazon S3 using Bucket Explorer:
First step is to sign up on Amazon S3.
Download the latest version of Bucket Explorer and install it. Login to S3 using Bucket Explorer (Amazon S3 Tool).
. Enter the name of the Bucket same as your website and select the region where you want to create Bucket.
Select the newly created Bucket and
all web pages, images, CSS, and other static files from your desktop to your Amazon S3 Bucket.
on all objects of the Bucket as
Now set S3 Bucket as S3 Website for more details see the doc -
Set S3 Bucket as S3 Website – PUT Bucket Website
Now Select the S3 doc fo the bucket you want to redirect.
Right click and choose
Website Redirect Location
menu and set the new location in Redirect page section. Here you can mention internal as well as external url.
Now when you browse the older doc by S3 website url then it will show you new doc instead of old doc.