skillfed

cloudflare-r2

This skill covers provisioning and operating Cloudflare R2 buckets via Wrangler CLI, AWS CLI, and boto3, plus binding R2 to Workers for server-side access. Learn lifecycle configuration, presigned URL generation, public bucket serving, and CORS setup to eliminate egress costs for read-heavy workloads and media delivery.

Cloudflare R2 lets you manage S3-compatible object storage with zero egress fees on Cloudflare's global network.

AI-generated summary based on this skill's SKILL.md

44 4 MIT updated by BagelHole

Install

BagelHole/DevOps-Security-Agent-Skills/cloudflare-r2 · repository language: Shell

CLI (skillfed)coming soon
git clone https://github.com/BagelHole/DevOps-Security-Agent-Skills
cp -r DevOps-Security-Agent-Skills/infrastructure/cloudflare/cloudflare-r2 ~/.claude/skills/cloudflare-r2

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

What is cloudflare r2 object storage and how does it work?

Cloudflare R2 is an object storage service that eliminates egress fees, making it ideal for read-heavy workloads and media delivery. R2 provides S3-compatible APIs, so you can use existing tools like AWS CLI and boto3 without vendor lock-in. The skill covers provisioning buckets via Wrangler CLI, configuring access controls, and binding R2 to Cloudflare Workers for server-side operations.

How do I set up r2 bucket management with wrangler?

Cloudflare R2 bucket management with Wrangler CLI lets you create, list, and configure buckets from the command line. Wrangler provides straightforward commands for provisioning storage and managing bucket settings. The skill teaches you to use Wrangler for end-to-end bucket lifecycle management, from initial setup through configuration of lifecycle rules and access policies.

Can I use aws cli with cloudflare r2 and how?

Yes, Cloudflare R2 is S3-compatible, so you can use AWS CLI directly. The skill covers generating R2 API tokens, configuring AWS CLI credentials to point to R2 endpoints, and executing standard S3 commands like put-object and get-object. This approach works seamlessly for teams already familiar with AWS tooling.

How do I generate presigned URLs and configure public access?

Cloudflare R2 presigned URL generation allows temporary, authenticated access to private objects without exposing credentials. The skill teaches you to create presigned URLs programmatically and configure public bucket access for static asset hosting. You'll learn both approaches: restricting access via presigned URLs and opening buckets for direct serving.

What are r2 worker bindings and how do I use them?

Cloudflare R2 worker bindings let you access R2 buckets directly from Cloudflare Workers server-side code. The skill shows you how to bind R2 buckets in your wrangler.toml configuration and interact with objects via the Workers runtime. This enables server-side file operations, transformations, and conditional logic without exposing bucket credentials to clients.

How do I configure lifecycle rules and CORS for r2 buckets?

Cloudflare R2 lifecycle rules automate object expiration and archival, reducing storage costs over time. CORS policies control which origins can access your bucket from browsers. The skill covers setting expiration policies, configuring allowed methods and headers, and troubleshooting cross-origin requests for seamless integration with web applications.

SKILL.md

rendered from the published skill — quoted content, verbatim

Cloudflare R2

S3-compatible object storage with zero egress fees, built on Cloudflare's global network.

When to Use

  • Storing user uploads, media files, backups, or static assets.
  • Replacing AWS S3 to eliminate egress costs for read-heavy workloads.
  • Serving files at the edge via Workers or public bucket access.
  • Building multi-cloud storage that avoids vendor lock-in (S3 API compatible).
  • Storing ML model artifacts, training data, or inference results.

Prerequisites

  • Cloudflare account with R2 enabled (dashboard > R2 > subscribe).
  • Wrangler CLI v3+ installed: npm install -g wrangler.
  • Authenticated via wrangler login or CLOUDFLARE_API_TOKEN.
  • For S3 API access: R2 API token created under R2 > Manage R2 API Tokens.

Bucket Management with Wrangler

Create and List Buckets

```bash

Create a new bucket

npx wrangler r2 bucket create app-assets

Create a bucket in a specific region (hint for data locality)

npx wrangler r2 bucket

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 1 file
infrastructure/cloudflare/cloudflare-r2/SKILL.md

Related skills

Tags

object-storage edge-delivery cost-optimization s3-compatible serverless-storage api-tokens bucket-lifecycle presigned-urls cors-policies