Amazon Simple Storage Service
API Reference (API Version 2006-03-01)

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

GetBucketWebsite

Returns the website configuration for a bucket. To host website on Amazon S3, you can configure a bucket as website by adding a website configuration. For more information about hosting websites, see Hosting Websites on Amazon S3.

This GET operation requires the S3:GetBucketWebsite permission. By default, only the bucket owner can read the bucket website configuration. However, bucket owners can allow other users to read the website configuration by writing a bucket policy granting them the S3:GetBucketWebsite permission.

The following operations are related to DeleteBucketWebsite

Request Syntax

GET /?website HTTP/1.1 Host: Bucket.s3.amazonaws.com

URI Request Parameters

The request requires the following URI parameters.

Bucket

The bucket name for which to get the website configuration.

Request Body

The request does not have a request body.

Response Syntax

HTTP/1.1 200 <?xml version="1.0" encoding="UTF-8"?> <GetBucketWebsiteOutput> <RedirectAllRequestsTo> <HostName>string</HostName> <Protocol>string</Protocol> </RedirectAllRequestsTo> <IndexDocument> <Suffix>string</Suffix> </IndexDocument> <ErrorDocument> <Key>string</Key> </ErrorDocument> <RoutingRules> <RoutingRule> <Condition> <HttpErrorCodeReturnedEquals>string</HttpErrorCodeReturnedEquals> <KeyPrefixEquals>string</KeyPrefixEquals> </Condition> <Redirect> <HostName>string</HostName> <HttpRedirectCode>string</HttpRedirectCode> <Protocol>string</Protocol> <ReplaceKeyPrefixWith>string</ReplaceKeyPrefixWith> <ReplaceKeyWith>string</ReplaceKeyWith> </Redirect> </RoutingRule> </RoutingRules> </GetBucketWebsiteOutput>

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in XML format by the service.

GetBucketWebsiteOutput

Root level tag for the GetBucketWebsiteOutput parameters.

Required: Yes

ErrorDocument

The name of the error document for the website.

Type: ErrorDocument data type

IndexDocument

The name of the index document for the website.

Type: IndexDocument data type

RedirectAllRequestsTo

Specifies the redirect behavior of all requests to a website endpoint of an Amazon S3 bucket.

Type: RedirectAllRequestsTo data type

RoutingRules

Rules that define when a redirect is applied and the redirect behavior.

Type: Array of RoutingRule data types

Examples

Sample Request

This request retrieves website configuration on the specified bucket.

GET ?website HTTP/1.1 Host: example-bucket.s3.amazonaws.com Date: Thu, 27 Jan 2011 00:49:20 GMT Authorization: AWS AKIAIOSFODNN7EXAMPLE:n0Nhek72Ufg/u7Sm5C1dqRLs8XX=

Sample Response

HTTP/1.1 200 OK x-amz-id-2: YgIPIfBiKa2bj0KMgUAdQkf3ShJTOOpXUueF6QKo x-amz-request-id: 3848CD259D811111 Date: Thu, 27 Jan 2011 00:49:26 GMT Content-Length: 240 Content-Type: application/xml Transfer-Encoding: chunked Server: AmazonS3 <?xml version="1.0" encoding="UTF-8"?> <WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <IndexDocument> <Suffix>index.html</Suffix> </IndexDocument> <ErrorDocument> <Key>404.html</Key> </ErrorDocument> </WebsiteConfiguration>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: