How do I move my s3 upload bucket from one provider to another?

I have setup my upload bucket originally on AWS, but I want to now use Linode. Setup went well and I can see that images are being uploaded to the Linode already.

However, when I look at the old posts, they are still pointing to AWS. How can I move those images to Linode so that I can remove the bucket on AWS?


First sync the buckets using a software that can do it (aws cli, s3cmd, etc) and then do a Replace a string in all posts


I’ve just run this

rake posts:remap["",""]

but it says 0 posts remapped

Even though I can see that that the URL is correct, e.g. by looking at the image URL here:

1 Like


rake posts:remap["//","//"]

Tried your suggestion. Also tried

rake posts:remap["",""]

Got the same result:


0 posts remapped!

Is there a different command to find all posts that don’t do any replacing to see if the command can actually find valid hits?

You want to inspect the Upload objects:

cd /var/discourse
./launcher enter app
rails c
Upload.order(Arel.sql('RANDOM()')).limit(10).pluck(:id, :url)
1 Like

Excellent question and advice. Should be a #howto ?


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.