S3 API client region - any possible hints to improve performance?

The S3 API docs and example suggest setting the region to “auto” when creating the S3 client.

My use case is: I want to give limited access to my R2 bucket to an external application that’s not part of the Cloudflare ecosystem.

If I have my Workers and Bucket set up to take advantage of edge caching, is there a recommended way for me to tell the external application “use region X instead of auto” when establishing the connection to my Bucket for faster Objects access?

*Note: I’m new to Cloudflare, so I may have an incorrect understanding of how edge/caching works, and if what I’m asking is even possible.


There’s no caching on the S3 API. If you’re using a Worker with the Cache API, or an R2 Custom Domain, the cache will be in the Cloudflare location the user hits which is going to be close(ish) to them, doesn’t matter where the bucket is.

Once your bucket is created as well, the region never changes, and all your objects stay in that single region (besides what you cache of course). You can create a bucket with a specific location hint via the dashboard or via the LocationConstraint parameter of the S3 API: Data location · Cloudflare R2 docs. You can view your bucket’s current location under the bucket’s settings page in the dashboard.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.