After the pay-by-requester mode is enabled for a bucket in Alibaba Cloud OSS, the requester instead of the bucket owner pays the cost of the request and traffic. The bucket owner always pays the cost of storing data. You can enable this feature to share data without the need to pay for all requests and traffic by yourself.

Note The pay-by-requester mode is currently available only in China (Shenzhen).

Examples

  • Share large datasets, such as ZIP code directories, reference data, geospatial information, or web crawling data. For example, a research institute provides a public dataset to share data with its customers and expects the customers to pay for requests and traffic. The configuration procedure is as follows:
    1. Enable the pay-by-requester mode for the bucket. For more information about the procedure, see Enable the pay-by-requester mode for a bucket.
    2. Set a bucket policy to authorize the RAM users of your customers' Alibaba Cloud accounts to access your bucket. For more information about the configuration, see Use bucket policies to authorize other users to access OSS resources.
  • Deliver data to your customers or partners. For example, a company needs to deliver production data to its partners and expects the partners to pay for requests and traffic generated by data downloads.
    The configuration procedure is as follows:
    1. Enable the pay-by-requester mode for the bucket.
    2. Set the bucket ACL to private.
    3. Set a bucket policy to authorize the RAM users of your partners' Alibaba Cloud accounts to access your bucket. For more information about the configuration, see Tutorial:Authorize a RAM user under another Alibaba Cloud account by adding a bucket policy.
    Notice You must authorize the RAM users of your customers' or partners' Alibaba Cloud accounts to access your bucket, but not provide them with the AccessKey pair of your RAM user. If your customers or partners use your RAM user to access your bucket, you must pay for requests and traffic because the requester is still you.

Request methods

  • Anonymous access is not allowed.

    If you enable the pay-by-requester mode for a bucket, anonymous users are not allowed to access the bucket. Requesters must provide authentication information so that OSS can identify them and charge them, but not the bucket owner, for requests and traffic.

    If requesters use the RAM role of an Alibaba Cloud account to request data, OSS charges this Alibaba Cloud account for such requests and traffic.

  • Requesters must include the x-oss-request-payer field in the request header.

    If you enable the pay-by-requester mode for a bucket, requesters must include the x-oss-request-payer:requester field in the request header for a POST, GET, or HEAD request. This field indicates that requesters understand that their requests and data downloads incur fees. Otherwise, requests cannot pass authentication.

    The bucket owner does not need to include the x-oss-request-payer field in the request header when accessing their own bucket. In this case, the bucket owner is the requester who pays for such requests and traffic.

Fee analysis

In pay-by-requester mode, requesters pay for requests and traffic, and the bucket owner pays for data storage. However, in the following cases, requests fail (where HTTP status code 403 is returned), and OSS charges the bucket owner for such requests.

  • The requester does not include the x-oss-request-payer field in the request header for a POST, GET, or HEAD request, or does not use this field as a parameter for a request through a RESTful API.
  • The requester fails authentication.
  • The requester is anonymous.

Reference