Setting the requestPayment Bucket Configuration
The bucket owner and only the bucket owner can set the
RequestPaymentConfiguration.payer configuration value of a bucket
BucketOwner, the default, or
Requester. Setting the
requestPayment resource is optional. If you don't, the
bucket, by default, is a non-Requester Pays bucket.
You use the value,
BucketOwner, to revert Requester Pays buckets to
regular buckets. Typically, you would use
BucketOwner when uploading
data to the Amazon S3 bucket, then set the value to
publishing the objects in the bucket.
To set requestPayment
PUTrequest to set the
Requesteron a specified bucket.
PUT ?requestPayment HTTP/1.1 Host:
[BucketName].s3.amazonaws.com Content-Length: 173 Date: Wed, 01 Mar 2009 12:00:00 GMT Authorization: AWS
[Signature]<RequestPaymentConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Payer>Requester</Payer> </RequestPaymentConfiguration>
If the request succeeds, Amazon S3 returns a response similar to the following.
HTTP/1.1 200 OK x-amz-id-2: [id] x-amz-request-id: [request_id] Date: Wed, 01 Mar 2009 12:00:00 GMT Content-Length: 0 Connection: close Server: AmazonS3 x-amz-request-charged:requester
Notice that you can only set Requester Pays at the bucket level; you cannot set Requester Pays for specific objects within the bucket.
You can freely configure a bucket to be
Requester at any time. Realize, however, that there might be a
small delay, on the order of minutes, for the configuration value to take
Bucket owners who give out pre-signed URLs should think twice before configuring a bucket to be Requester Pays, especially if the URL has a very long expiry. The bucket owner is charged each time the requester uses pre-signed URLs that use the bucket owner's credentials.