When pay-by-requester is enabled for a bucket, requesters pay the request and traffic fees that are incurred when the requesters access objects in the bucket. The bucket owner must still pay the storage fees of the objects in the bucket. If you want to share your data without having to pay for additional fees, you can use the request-payment command to enable pay-by-requester for your bucket.
For more information about pay-by-requester, see Pay-by-requester.
Enable pay-by-requester
- Command syntax
./ossutil64 request-payment --method put oss://bucketname payment
The following table describes the parameters that you can configure when you run this command.
Parameter Description bucketname The name of the bucket for which you want to enable pay-by-requester. payment The payment method for the fees that are incurred when third-party users access data in the bucket. Valid values:
- Requester: Requesters are charged for the fee to access objects in the bucket.
Anonymous users cannot access a bucket that has pay-by-requester enabled. Requesters must provide authentication information so that OSS can identify and charge requesters for request and traffic fees. If a requester assumes a RAM role of an Alibaba Cloud account to request data, OSS charges the Alibaba Cloud account for the requests sent by the requester and the generated traffic.
- BucketOwner: The bucket owner is charged for the fees when requesters access objects in the bucket.
- Requester: Requesters are charged for the fee to access objects in the bucket.
- ExamplesYou can run the following command to enable pay-by-requester for a bucket named examplebucket:
./ossutil64 request-payment --method put oss://examplebucket Requester
You can run the following command to disable pay-by-requester for a bucket named examplebucket:./ossutil64 request-payment --method put oss://examplebucket BucketOwner
If a similar output is displayed, pay-by-requester is enabled or disabled for the bucket.
0.106852(s) elapsed
Query the pay-by-requester status of a bucket
- Command syntax
./ossutil64 request-payment --method get oss://bucketname
bucketname indicates the bucket for which you want to query the pay-by-requester status.
- Examples
You can run the following command to query the pay-by-requester status of a bucket named examplebucket:
./ossutil64 request-payment --method get oss://examplebucket
The following result shows that pay-by-requester is enabled for examplebucket:
Requester 0.072024(s) elapsed
Common options
If you use ossutil to switch to a bucket that is located in another region, add the -e option to the command to specify the endpoint of the region in which the specified bucket is located. If you use ossutil to switch to a bucket that belongs to another Alibaba Cloud account, you can add the -i option to the command to specify the AccessKey ID of the specified account, and add the -k option to the command to specify the AccessKey secret of the specified account.
For example, you can run the following command to enable pay-by-requester for a bucket named testbucket that is located in the China (Shanghai) region and owned by another Alibaba Cloud account.
./ossutil64 request-payment --method put oss://testbucket -e oss-cn-shanghai.aliyuncs.com -i LTAI4Fw2NbDUCV8zYUzA**** -k 67DLVBkH7EamOjy2W5RVAHUY9H****
For more information the mb command, see Common options.