Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Object Storage
  • Terraform reference
    • Authentication with the API
      • How to use the API
      • Signing requests
        • All services and methods
          • All methods
          • upload
          • get
          • delete
          • Static website response codes
        • Common request headers
        • Common response headers
        • Responses
  • Monitoring metrics
  • Audit Trails events
  • Bucket logs
  • Release notes
  • FAQ

In this article:

  • Request
  • Path parameters
  • Request parameters
  • Headers
  • Data schema
  • Response
  • Headers
  • Response codes
  1. API reference
  2. REST (Amazon S3-compatible)
  3. REST
  4. Static Website Hosting
  5. upload

upload method

Written by
Yandex Cloud
Updated at March 19, 2025
  • Request
    • Path parameters
    • Request parameters
    • Headers
    • Data schema
  • Response
    • Headers
    • Response codes

Uploads a static website hosting configuration for a bucket.

For more information on getting started with the API and the general request format, see How to use the S3 API.

RequestRequest

PUT /{bucket}?website HTTP/2

Path parametersPath parameters

Parameter Description
bucket Bucket name.

Request parametersRequest parameters

Parameter Description
website Required parameter that indicates the type of operation.

HeadersHeaders

Use the appropriate common headers in your request.

Data schemaData schema

You can configure a bucket:

As a website
To redirect all requests
For conditional redirects

Configuration example:

<!--Website configuration-->
<WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <IndexDocument>
        <Suffix>index.html</Suffix>
    </IndexDocument>
    <ErrorDocument>
        <Key>Error.html</Key>
    </ErrorDocument>
</WebsiteConfiguration>

Possible elements:

Element Description
WebsiteConfiguration Top-level header of the website description.
IndexDocument/Suffix Website home page.

Path: /WebsiteConfiguration/IndexDocument/Suffix.
ErrorDocument/Key Document the user sees in case of 4xx errors.

Path: /WebsiteConfiguration/ErrorDocument/Key.

Configuration example:

<!--Configuration for redirecting all requests-->
<WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <RedirectAllRequestsTo>
        <HostName>example.com</HostName>
        <Protocol>http</Protocol>
    </RedirectAllRequestsTo>
</WebsiteConfiguration>

Possible elements:

Element Description
WebsiteConfiguration Top-level header of the website description.
RedirectAllRequestsTo Contains the configuration for redirecting all requests.

Path: /WebsiteConfiguration/RedirectAllRequestsTo.
HostName Host to which all requests to the bucket are redirected.

Path: /WebsiteConfiguration/RedirectAllRequestsTo/HostName.
Protocol Protocol used for redirects: http or https. This is an optional parameter.

Path: /WebsiteConfiguration/RedirectAllRequestsTo/Protocol.

Configuration example:

<!--Configuration for conditional redirects-->
<WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <IndexDocument>
        <Suffix>index.html</Suffix>
    </IndexDocument>
    <ErrorDocument>
        <Key>Error.html</Key>
    </ErrorDocument>
    <RoutingRules>
        <RoutingRule>
            <Condition>
                <KeyPrefixEquals>k8s/</KeyPrefixEquals>
            </Condition>
            <Redirect>
                <ReplaceKeyPrefixWith>kubernetes/</ReplaceKeyPrefixWith>
            </Redirect>
        </RoutingRule>
    </RoutingRules>
</WebsiteConfiguration>

Possible elements:

Element Description
WebsiteConfiguration Top-level header of the website description.
IndexDocument/Suffix Website home page.
ErrorDocument/Key Document the user sees in case of 4xx errors.
RoutingRules RoutingRule container.
It must include at least one rule.
RoutingRule Routing rule.
It defines the conditions and conditional redirects.
Condition Container of conditions to trigger the redirect.
If a routing rule does not contain any conditions, all requests are redirected.
The container must include at least one rule.
KeyPrefixEquals This condition sets the name prefix for the object the requests are redirected from.
KeyPrefixEquals is required if HttpErrorCodeReturnedEquals is not set. If KeyPrefixEquals and HttpErrorCodeReturnedEquals are set, the condition is met when both the parameters are true.
HttpErrorCodeReturnedEquals This condition specifies the error code that triggers a redirect.
HttpErrorCodeReturnedEquals is required if KeyPrefixEquals is not set. If KeyPrefixEquals and HttpErrorCodeReturnedEquals are set, the condition is met when both the parameters are true.
Redirect Redirect container.
You can redirect a request to a different page, different host, or change the protocol.
RoutingRule must contain at least one Redirect element.
A redirect must contain at least one of the following elements: Protocol, HostName, ReplaceKeyPrefixWith, ReplaceKeyWith, or HttpRedirectCode.
Protocol In the Location header of the response, a redirect indicates which protocol, http or https, should be used.
This parameter is optional if other redirects apply.
HostName In the Location response header, the redirect indicates the host name to use.
This parameter is optional if other redirects apply.
ReplaceKeyPrefixWith The redirect specifies the object key name prefix to replace the KeyPrefixEquals value in the redirect request.
It is incompatible with ReplaceKeyWith.
This parameter is optional if other redirects apply.
ReplaceKeyWith The redirect specifies the object key to use in the Location header.
It is incompatible with ReplaceKeyPrefixWith.
This parameter is optional if other redirects apply.
HttpRedirectCode In the Location response header, the redirect specifies the HTTP redirect code.
The possible value is any 3xx code.
This parameter is optional if other redirects apply.

ResponseResponse

HeadersHeaders

Responses can only contain common headers.

Response codesResponse codes

For a list of possible responses, see Responses.

See alsoSee also

  • Debugging requests using the AWS CLI
  • Example of sending a signed request using curl
  • Code example for generating a signature

Was the article helpful?

Previous
All methods
Next
get
© 2025 Direct Cursus Technology L.L.C.