Connecting CBCloudDrive to Cloudflare R2
Requirements: CBFSCloud
This article explains how to configure CBCloudDrive to connect to Cloudflare R2. For a general overview of how the component works, see Getting Started with the CBCloudDrive Component.
Getting Started
First go ahead and set the ConnectionType property to ctS3 and set CacheDirectory to a valid, writable local directory path. After that, you can build a connection string using the below parameters.
Connection Parameters
| Parameter | Description |
|---|---|
| RemoteRoot | The path to use as the root of the mounted drive. The first path segment must be the bucket name (e.g., /my-bucket). |
| Provider | Must be set to CLOUDFLARER2. |
| AccountId | Your Cloudflare account ID. Found in the Cloudflare dashboard under R2 Object Storage. |
| AccessKey | The R2 API token access key ID. |
| SecretKey | The R2 API token secret key. |
Authentication
Cloudflare R2 uses API tokens for authentication. Generate a token from the Cloudflare dashboard under R2 Object Storage > Manage API tokens, then set AccessKey and SecretKey to the token's access key ID and secret key respectively.
drive.ConnectionType = CBCloudDriveConnectionTypes.ctS3;
drive.ConnectionString = "RemoteRoot=/my-bucket;Provider=CLOUDFLARER2;AccountId=MY-ACCOUNT-ID;"
+ "AccessKey=MYACCESSKEY;SecretKey=MYSECRETKEY;";
We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@callback.com.