How to Use Cloudflare R2 for Customer Support

A practical guide to using Cloudflare R2 for customer support: workflow, tips, and when to use something else.

ServerSpotter Team··6 min read

Why Use Cloudflare R2 for Customer Support?

Your customer support team drowns in attachments, chat logs, and escalation files. Screenshots, diagnostic reports, and video recordings pile up fast, and traditional storage solutions hit you with egress fees every time agents need to access files or share them with customers.

Cloudflare R2 solves the egress problem that kills most object storage budgets. When your support team pulls up a customer's uploaded diagnostic file or shares a screen recording with engineering, you pay zero for that data transfer. At $0.015/GB/month for storage with no egress fees, R2 becomes particularly attractive for support workflows where files get accessed frequently but unpredictably.

R2's S3 compatibility means your existing support tools likely work without modification. Whether you're using Zendesk, Intercom, or a custom ticketing system, chances are it already speaks S3. Plus, integration with Cloudflare Workers lets you build custom processing workflows—automatically resize support screenshots, generate thumbnails for video files, or sanitize uploaded documents.

Getting Started with Cloudflare R2

You'll need a Cloudflare account with R2 enabled. R2 isn't available on the free plan—you need at least the Workers Paid plan ($5/month) to access R2 storage.

First, enable R2 in your Cloudflare dashboard under the "R2 Object Storage" section. You'll see your current usage limits: 10GB storage and 1 million Class A operations (writes) per month included with the Workers Paid plan. Beyond that, you pay $0.015/GB for storage and $4.50 per million Class A operations.

Create your first bucket through the dashboard or using Wrangler CLI:

```bash npm install -g wrangler wrangler login wrangler r2 bucket create support-attachments ```

For production support workflows, create separate buckets for different data types:

  • `support-tickets-prod` for ticket attachments
  • `support-media-prod` for screenshots and videos
  • `support-exports-prod` for data exports and reports
  • `support-archive-prod` for old tickets and compliance data

Step-by-Step Setup

Configure S3-Compatible Access

Generate R2 API tokens in the Cloudflare dashboard under "R2 Object Storage" → "Manage R2 API Tokens." Create a token with read/write permissions for your support buckets.

You'll get an endpoint URL like `https://abc123def456.r2.cloudflarestorage.com` along with your access key ID and secret access key.

Integrate with Your Support Platform

Most support platforms support S3 storage. Here's how to configure popular options:

Zendesk: In Admin Center, go to Apps and integrations → Integrations → S3 Integration. Use your R2 credentials with the S3-compatible endpoint.

Custom Applications: Use any S3 SDK. Here's a Python example with boto3:

```python import boto3

r2 = boto3.client( 's3', endpoint_url='https://abc123def456.r2.cloudflarestorage.com', aws_access_key_id='your-access-key-id', aws_secret_access_key='your-secret-access-key', region_name='auto' )

Upload support attachment

r2.upload_file( 'customer-diagnostic.log', 'support-attachments', 'tickets/12345/diagnostic.log' ) ```

Set Up Automated Processing with Workers

Create a Worker to process uploads automatically. This example resizes images and generates thumbnails:

```javascript export default { async fetch(request, env) { const url = new URL(request.url); if (request.method === 'PUT' && url.pathname.includes('/screenshots/')) { // Get the uploaded image const object = await env.SUPPORT_BUCKET.get(url.pathname.slice(1)); if (object && object.headers.get('content-type')?.startsWith('image/')) { // Process image (resize, create thumbnail) const processed = await processImage(await object.arrayBuffer()); // Store thumbnail const thumbnailKey = url.pathname.replace('/screenshots/', '/thumbnails/'); await env.SUPPORT_BUCKET.put(thumbnailKey, processed.thumbnail); } } return new Response('OK'); } } ```

Configure CORS for Web Uploads

If customers upload files directly from your support portal, configure CORS on your bucket:

```javascript // Using Wrangler or the API const corsPolicy = { "corsRules": [{ "allowedOrigins": ["https://support.yourcompany.com"], "allowedMethods": ["GET", "PUT", "POST"], "allowedHeaders": ["*"], "maxAgeSeconds": 3600 }] }; ```

Set Up Lifecycle Rules

Implement automatic cleanup to control costs:

```bash

Archive old attachments after 2 years

wrangler r2 bucket lifecycle put support-attachments \ --rules '[{ "id": "archive-old-tickets", "status": "Enabled", "transitions": [{ "days": 730, "storageClass": "GLACIER" }] }]' ```

Tips and Best Practices

Organize Your File Structure

Use a consistent hierarchy that matches your support workflow:

``` support-attachments/ ├── tickets/ │ ├── 2024/01/12345/ │ │ ├── attachment-001.pdf │ │ └── screenshot-002.png ├── chat-logs/ │ ├── 2024/01/15/ ├── escalations/ │ ├── engineering/ │ └── management/ ```

This structure makes it easy to find files, set up automated cleanup, and manage access permissions.

Implement Presigned URLs for Secure Sharing

Don't expose your R2 credentials to frontend applications. Generate presigned URLs for temporary access:

```python

Generate presigned URL valid for 1 hour

presigned_url = r2.generate_presigned_url( 'get_object', Params={'Bucket': 'support-attachments', 'Key': 'tickets/12345/diagnostic.log'}, ExpiresIn=3600 ) ```

Monitor Usage and Set Alerts

Track your R2 usage in the Cloudflare dashboard. Set up alerts when storage exceeds certain thresholds. Remember that while egress is free, you still pay for storage and write operations.

Use R2's Global Network

Unlike traditional cloud storage, R2 automatically replicates your data across Cloudflare's network. Your support team in New York and engineering team in Singapore both get fast access to the same files without manual replication setup.

Backup Strategy

While R2 provides durability, implement a backup strategy for critical support data:

```bash

Regular backup to another provider

aws s3 sync s3://your-r2-bucket s3://backup-bucket --profile backup-profile ```

When Cloudflare R2 Isn't the Right Fit

R2 works great for most support use cases, but consider alternatives when:

You need advanced search capabilities: R2 is object storage, not a database. If you need to search file contents or metadata extensively, consider storing files in R2 but metadata in a proper database.

You're heavily integrated with another cloud: If your entire stack runs on AWS and you use services like Lambda, RDS, and Elasticsearch, S3 might make more integration sense despite the egress costs.

You need specific compliance features: R2 doesn't yet support all compliance certifications that some enterprises require. Check current compliance status against your requirements.

Very small file sizes dominate: With minimum billing of 128KB per object, R2 isn't cost-effective for thousands of tiny files. Consider bundling small files or using a different storage approach.

You need immediate consistency: R2 provides eventual consistency, which might not work for real-time support workflows that require immediate file availability across all regions.

Conclusion

Cloudflare R2 transforms support storage economics by eliminating egress fees that typically inflate costs when agents frequently access customer files. The S3 compatibility means easy integration with existing support tools, while Cloudflare Workers enable powerful automation workflows.

Start with a simple setup storing ticket attachments and screenshots. As you see the cost savings from zero egress fees, expand to more sophisticated use cases like automated file processing and global content distribution for your support team.

The key advantage isn't just the cost savings—it's the predictability. You can build support workflows that access files freely without worrying about surprise bandwidth bills.

Compare Cloudflare R2 with alternatives on ServerSpotter.

Tools mentioned in this article

Cloudflare R2 logo

Cloudflare R2

Zero egress S3 storage on Cloudflare's network

CDN ProvidersFree tier
5.0 (203)
300 locations99.9% SLA
View Tool →

Share this article

Stay in the loop

Get weekly updates on the best new AI tools, deals, and comparisons.

No spam. Unsubscribe anytime.