Upload links broken after S3 bucket change

I recently migrated my AWS organization from one region to another. That forced me to also move my S3 buckets with new names. I updated the settings in my site and did a rebake; however, it seems that when I change the s3 region option from the default (US East) to (US West), all the uploads are still referencing us-east-1.

I know the uploads are making it into the new bucket, as when I manually change any of the previews on the admin page from us-east-1 to us-west-2, the images are properly loading.

<div class="uploaded-image-preview input-xxlarge" style="background-image: url(//my-new-bucket.s3.dualstack.us-east-1.amazonaws.com/original/1X/8e7492615a827a7e5dc550f8bfdc4854bc8b064d.png)">


<div class="uploaded-image-preview input-xxlarge" style="background-image: url(//my-new-bucket.s3.dualstack.us-west-2.amazonaws.com/original/1X/8e7492615a827a7e5dc550f8bfdc4854bc8b064d.png)">

As far as I can tell, it does not seem to be using my vanity s3 cdn url as configured even after issuing these rebake commands:

cd /var/discourse
./launcher enter app
rake posts:rebake

Lastly, when I reviewed the error log, there’s still some reference to my old bucket:

Could not find file in the store located at url: //my-old-bucket.s3.amazonaws.com/original/1X/ea17a258eff7a95045bda914c10bac5a2de02c62.png

Any help would be greatly appreciate! I’m currently running v2.2.0 +4.

A rebake is not enough, you’ll have to do a remap to change all the existing URLs.

discourse remap //my-new-bucket.s3.dualstack.us-east-1.amazonaws.com //my-new-bucket.s3.dualstack.us-west-2.amazonaws.com

To be clear, which bucket in that code snippet is the new bucket, and which is the old? As you’ve labelled them both the new bucket.

I used OP’s strings (note the us-east-1 in the 1st and us-west-2 in the 2nd).

The remap command replaces the 1st argument by the 2nd :wink:


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