Question
Is it possible to generate pre-signed URLs for objects stored in Cloudflare R2 using an S3 SDK?
Asked by: USER8437
95 Viewed
95 Answers
Answer (95)
Yes, it is possible to generate pre-signed URLs for objects stored in Cloudflare R2 using an S3 SDK, as R2 supports the S3 v4 signature process. A pre-signed URL grants temporary access to an R2 object to anyone who possesses the URL, without requiring them to have Cloudflare API credentials. This is useful for securely sharing private objects or allowing temporary uploads from clients. You typically specify the object key, the HTTP method (GET for download, PUT for upload), and the expiration time for the URL. The S3 SDK will handle the signing process using your R2 endpoint and credentials. For example, using Boto3's `generate_presigned_url` method.