How to manually migrate all files from S3 back to EC2 Server?

After restoring my site in a new server all the images are broken. The images are broken even after rebake. Is it possible to migrate manually? if so, How can I manually migrate all files from S3 to local storage?

2 Likes

Do the images on the new site point to the S3 bucket? If so, they should work.

Maybe have a look at Migrating uploads from s3 to local, though I think there should be a #howto.

2 Likes

Hi, thanks for responding.

I followed the same steps mentioned by you earlier, but nothing happened. I ended up having a site with broken images. see my previous topic,

Only some files are migrated back from s3, not all.

root@ubuntu-blr-app:/var/www/discourse# rake uploads:migrate_from_s3
Migrating uploads from S3 to local storage for 'default'...
..Done!

So, I was thinking of manually migrating all the files and I don’t know if it’s possible…?

2 Likes

s3

I have the above three folders in my s3 bucket. I don’t know the location in my server where I have to copy each of the above folders from S3. After copying will a rake posts:rebake would do the final job??

2 Likes

Guys, Any thoughts on this issue??

1 Like

Finally, I think I find a solution to my problem. I think I have solved 95% of the problem. I am not sure if its the best way to do it.

./launcher enter app
sudo apt install awscli
aws configure

Configured aws with my S3 ID and password. then

cd public/uploads/default/
aws s3 sync s3://mybucketname/

This command downloaded all the three directories with all the files from S3. Since I can’t find the folder named inventory anywhere in my previous server, I deleted it (Not sure about deleting this folder). Then

rake posts:rebake
exit
./launcer rebuild app

Bam, everything started working again as normal. But I find image links in one of the post is broken, but if edited I can view the image in the editor. I download the same image and tried to upload it again, but still the broken image. Not sure if its a separate problem or it’s related to the current problem.

5 Likes