Cloudflare Docs
R2
Edit this page on GitHub
Set theme to dark (⇧+D)

Get started

Cloudflare R2 Storage allows developers to store large amounts of unstructured data without the costly egress bandwidth fees associated with typical cloud storage services.

​​ Object storage

Object storage is an architecture for storing and managing data in an unstructured format, and examples of unstructured data include photos, audio files, videos, and data lakes to name a few.

Object storage allows you to assign unique identifiers to each file, or object, which you can use to locate and access each object.

Object storage is best for data that needs to be read many times, such as audio or video files on your personal website.

​​ 1. Install and authenticate Wrangler

  1. Install Wrangler within your project using npm and Node.js or Yarn.

              
$ npm install wrangler --save-dev

              
$ yarn add --dev wrangler
  1. Authenticate Wrangler to enable deployments to Cloudflare. When Wrangler automatically opens your browser to display Cloudflare’s consent screen, select Allow to send the API Token to Wrangler.

            
wrangler login

​​ 2. Create a bucket

To create a new R2 bucket from the Cloudflare dashboard:

  1. Log in to the Cloudflare dashboard and select R2.
  2. Select Create bucket.
  3. Enter a name for the bucket and select Create bucket.

​​ 3. Upload your first object

  1. From the R2 page in the dashboard, locate and select your bucket.
  2. Select Upload.
  3. Choose to either drag and drop your file into the upload area or select from computer.

You will receive a confirmation message after a successful upload.

​​ Bucket access options

Cloudflare provides multiple ways for developers to access their R2 buckets: