Building my photo wall with Cloudflare R2

2025-05-14

Building my photo wall with Cloudflare R2

I finally built my photo wall page, and it turned out better than I expected.

There’s something satisfying about having your own space for memories. Not Instagram, not Google Photos - just a simple place where I can look back over the years.

Image of my photo wall page A snapshot of memories

Using R2 for image storage

I’m very caught off guard by how easy Cloudflare R2 was to setup compared to normally using AWS S3.

With S3, i’m used to this:

  • Configure IAM policies
  • Set up bucket permissions
  • Deal with CORS headers

There’s normally a good 20 mins trying to debug why I can’t access my own s3 bucket publicly.

With R2? I got it up and running in less than 5 mins.

R2 pricing

R2’s pricing is pretty wild compared to S3.

Here’s the breakdown:

  • 10GB free storage per month
  • No egress fees (this is huge)
  • $0.015 per GB after that

For comparison, S3 charges:

  • $0.023 per GB for storage
  • $0.09 per GB for data transfer (egress fees)

Quick note on egress fees: These are charges for data leaving their servers. So every time someone views your photos, you pay. With AWS, you literally pay to access your own data. R2 doesn’t charge for this at all.

Something that tripped me up

S3 automatically provides you with a public s3 url for your assets. Cloudflare you have to add your custom domain for it be public.

Possibly a skill issue here but I stupidly took my website’s main domain and made it r2 bucket domain which took my entire site down because it got rerouted for my r2 bucket.

The right way to do it is to create a subdomain on your domain and then use that for the r2 bucket. This will save you from having to buy a new custom domain.

So instead of:

mysite.com → R2 bucket (what I did 🤦)

Do this:

photos.mysite.com → R2 bucket
mysite.com → Your actual site

Now i’m waiting for site’s domain get back up for the main site. I can’t believe I took the site down over this 🙄

Overall very surprised by how easy it to setup with R2. If you’re paying egress fees on S3 for a personal project, definitely worth checking out.

Check out my photo wall 📸