Backup discourse from the command line

I have a scenario where I want to migrate the Discourse installation to a whole new server.
My plan was:

  1. create a new blank Discourse installation
  2. backup the old Discourse, scp the backup to the new server and restore
  3. Copy over all the S3 (images, etc.) to the new S3 on a different account

The restore process goes well until it starts looking for S3 and then fail for no access. I think it is trying to access the same S3 bucket name on the old Discourse, but that one doesn’t exist on the new one and I can’t create it.

Is there a recommended solution?

I thought I could try to change the S3 bucket name on the old Discourse (before performing backup) and then when I restore, it would expect to have the new S3 bucket. But I’m afraid of what will happen to the old Discourse if I just switch it to a non-exisiting bucket.