YJK

独立世界

Independent World
twitter
telegram

Mastodon uses Cloudflare R2 object storage.

Reminder to everyone to carefully consider when choosing an object storage service provider, and not to relax requirements for resource security and reliability just for the sake of pursuing free services.

In order to pursue free services, my Mastodon instance has been using Scaleway S3 as a static resource repository. However, I previously encountered a serious availability issue that resulted in the inability to access the uploaded images. In order to prevent a similar situation from happening again, I had to migrate the resources from Scaleway S3 to Cloudflare R2 overnight.

R2 has relatively low prices and no fixed monthly fees:

ServiceFree QuotaCost
Storage10 GB/month$0.015/GB
Class A Operations: Change Status1 million/month$4.50/million operations
Class B Operations: Read Existing Status10 million/month$0.36/million operations

There is a small caveat when configuring Mastodon with Cloudflare R2 - permissions must be set in order to successfully upload. This needs to be set in the .env.production file:

S3_PERMISSION=private

The complete configuration is as follows:

S3_ENABLED=true
S3_PROTOCOL=https
S3_REGION=auto
S3_ENDPOINT=https://[HIDDEN].r2.cloudflarestorage.com
S3_HOSTNAME=pub-[HIDDEN].r2.dev
S3_BUCKET=[HIDDEN]
S3_PERMISSION=private
AWS_ACCESS_KEY_ID=[HIDDEN]
AWS_SECRET_ACCESS_KEY=[HIDDEN]
S3_ALIAS_HOST=s3assets.mastodon.instance
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.