Migrating Data from Amazon S3 to Cloudflare R2

July 26, 2023

cloudflarelogo

Today we will talk about simple solution for moving files from Amazon S3 Bucket to Clouflare R2 while highlighting the benefits of this.

Let's discuss first what is a Cloudflare and their R2 storage

In today's fast-paced digital landscape, businesses and developers seek scalable and reliable cloud storage solutions to handle their ever-growing volumes of data. Cloudflare, a renowned name in the web performance and security industry, has stepped into the cloud storage arena with its innovative Zero Egress Fee Object Storage platform known as R2.

As data storage requirements surge exponentially, companies are exploring cost-effective options that not only ensure data accessibility but also minimize expenses associated with data retrieval and transfer. This is where Cloudflare's R2 stands out from traditional cloud storage services like Amazon S3, providing a compelling alternative for organizations looking to optimize their data storage strategy.

You can visit their website in order to get more info regarding their products

Now let's check pricing for R2 Storage

R2 charges based on the total volume of data stored, along with two classes of operations on that data:

  • Class A operations which are more expensive and tend to mutate state.
  • Class B operations which tend to read existing state.
So what is Class A and Class B operations?
  • Class A Operations are:
ListBuckets, PutBucket, ListObjects, PutObject, CopyObject, CompleteMultipartUpload, CreateMultipartUpload, ListMultipartUploads, UploadPart, UploadPartCopy and PutBucketEncryption
  • Class B Operations are:
HeadBucket, HeadObject, GetObject, UsageSummary, GetBucketEncryption and GetBucketLocation
  • Also here is a free tier operations - DeleteObject, DeleteBucket and AbortMultipartUpload
Let's get closer to pricing itself
Name Free Tier Paid Rates
Storage 10 GB / month $0.015 / GB-month
Class A Operations 1 million requests / month $4.50 / million requests
Class B Operations 10 million requests / month $0.36 / million requests

As you can see here there is a free tier which means if your usage would be less than mentioned here it will be free. Pricing will apply when your usage goes over free tier.

Please find more info regarding pricing here Also, you can check R2 Cost Calculator for more detailed analysis on their page

Let's check R2 Super Slurper, tool that allows you to transfer objects less than 50GB fast, easily and for free:

Prerequisites:
  1. Amazon S3 Bucket with data we would need to trasnfer
  2. Cloudflare account with R2 Storage

I have a bucket created which has some photos in it, which i would like to transfer to Cloudflare R2 amazons3

Now let's move to our Cloudflare console. Here we would need to do following steps:
  1. First we would need to create R2 storage
  • Go to R2 section - Overview
  • Click on Create Bucket
  • Type your Bucket Name and you can choose location if needed.
  • Click Create Bucket

createbucket

  1. From the Cloudflare dashboard, expand R2 and select Data Migration.
  2. Select Migrate files.

migrate

  1. Enter your Amazon S3 bucket name, optional bucket prefix, and associated credentials and select Next.

You would need to use your Amazon Access key and a Secret key acordinly, as it says - you would need read only access. Then click Next

  • Please visit this page for info how to create Amazon Access Keys

amazoncreds

  1. Enter your R2 bucket name and click on Create Api Token
  • Make sure you gave it edit permitions

apitoken

  • Copy displayed keys to a safe place
  1. On the Destination R2 bucket page paste you key values and click Migrate

migr

  1. If you provided correct credentials you will see confirmation that they are valid. After you finish reviewing the details of your migration, select Migrate files.

finish

  1. That's it! Easy and fast, depending on the size you files will be transfered very fast

proccesing transfered