Enable Requester Pays on an S3 bucket
📑 On this page
Part 63 of AWS from Zero. This lesson keeps the scope to one S3 behavior you can verify from the terminal.
What we are learning
Requester Pays shifts supported request and data-transfer charges from the bucket owner to an authenticated requester who acknowledges the charge.
Before you run it
aws sts get-caller-identity
REGION="ap-south-1"
BUCKET="replace-with-your-private-demo-bucket"Use a private general purpose bucket that you own. Replace every placeholder before running a write or delete command.
Cost note: This setting changes who is billed for supported requests and transfer. Announce it to consumers before enabling it.
The command
aws s3api put-bucket-request-payment \
--bucket "$BUCKET" \
--request-payment-configuration Payer=RequesterA successful configuration command may return no output. Treat inspection as a separate required step.
Inspect the result
aws s3api get-bucket-request-payment \
--bucket "$BUCKET" \
--query Payer \
--output textRead the returned fields rather than assuming the write succeeded exactly as intended.
One tiny variation
aws s3api list-objects-v2 \
--bucket "$BUCKET" \
--request-payer requesterSupported data requests need the requester acknowledgement when Requester Pays is enabled.
Common mistake
Requester Pays does not make a bucket public and does not transfer every possible bucket cost. Use it only for a deliberate data-sharing model.
Cleanup
aws s3api put-bucket-request-payment \
--bucket "$BUCKET" \
--request-payment-configuration Payer=BucketOwnerReturn the demo bucket to normal owner-paid behavior.
Next, we will learn Call a Requester Pays S3 bucket.