How to move a Lightsail S3 bucket to an official AWS S3 bucket as well as CloudFront CDN?

AI-generated summary

quangmai911 is seeking advice on migrating from AWS Lightsail S3 buckets to official AWS S3 buckets with CloudFront CDN, after resolving initial S3 policy issues. They’ve successfully configured a new S3 bucket but haven’t yet switched the CDN, and want to know the smoothest way to migrate uploads and rebake posts without data loss. pfaffman suggests enabling include_s3_uploads_in_backups, setting the site to read-only, backing up, restoring to the new setup, and switching DNS — keeping the old system temporarily for safety. They note that multi-bucket setups complicate migration. Mr.X_Mr.X asks quangmai911 to share the S3 policy solution since the referenced @RedBear posts are deleted. The discussion centers on safe, structured migration from Lightsail to AWS S3 with CDN continuity.

Hello all,
I need some help or idea to achieve this.

Continuing the discussion from Setting up file and image uploads to S3:

Long story short:

  • Initially, I tried to setup my AWS S3 bucket for upload and backup then I got the issue with bucket policy ACLs did not allow to upload my files to S3 bucket.
  • Temporary solution, I setup 2 AWS Lightsail buckets one for upload and one for backup. These two buckets work perfectly with the Cloudfront CDN setup. All working well however I still want to get the main stream done correctly!
  • Final solution, with the post from @RedBear, I finally manage to get the AWS S3 bucket running with the proper S3 Policy set up. Note: I haven’t switched the old Cloudfront to the new Cloudfront CDN yet.

My question before I attempt to do the rake tasks:

rake uploads:migrate_to_s3
rake posts:rebake
  • What is the best and smooth solution to achieve the migration from old S3 bucket with old CloudfrontCDN to the new S3 bucket with the new CloudFront CDN?

Note: At the moment my new S3 uploads bucket is empty.

Thanks so much.
Quang

There is Moving from one S3 bucket to another, which is not very easy.

I think what I would do, if everything is still on the lightsail buckets as you say, is to

  • turn on the hidden SiteSetting.include_s3_uploads_in_backups=true on the site with old buckets
  • set read only
  • make a backup
  • restore that backup to the newly configured system
  • switch DNS to new system

I would keep the old system in place for a bit until you’re sure everything is straight on the new one.

If you have things in multiple buckets on a single instance things get much more complicated. I’ve got a couple of sites that way that I’ve been trying off-and-on to get straight for longer that I care to admit publicly.

Can you post the solution? The @RedBear posts are deleted.