Search code examples
node.jsmongodbamazon-ec2mean-stackbitnami

Transfer/copy EC2 instance, on which Nodejs+MongoDB app through Bitnami is deployed, to another aws account


I previously deployed my Nodejs+MongoDB application on AWS EC2 instance, now I want to transfer it to another AWS account. I followed this video-

https://aws.amazon.com/premiumsupport/knowledge-center/account-transfer-ec2-instance/

I was able to run the new instance(after transfer) but apps folder is missing there which contains the nodejs app code.

Source EC2 instance folder structure: apps htdocs stack

Destination EC2 instance folder structure: bitnami_credentials htdocs stack

Note: While copying the instance, got the error that Bitnami version(used on source account) is not available now, so used a new version on destination AWS account.


Solution

  • Bitnami Engineer here. If you want to migrate the existing installation to a new instance or new account, you can simply spin up a new instance using the latest Bitnami MEAN stack in the new account and copy the whole installation directory from one instance to the other one.

    • You can create the backup by running these commands in the current instance
    cd
    sudo /opt/bitnami/ctlscript.sh stop
    sudo tar -pczvf mean-backup.tar.gz /opt/bitnami
    sudo /opt/bitnami/ctlscript.sh start
    
    • You will need to transfer that mean-backup.tar.gz file to the new instance
    • And recover the backup there
    sudo /opt/bitnami/ctlscript.sh stop
    sudo mv /opt/bitnami /tmp/bitnami-backup
    sudo tar -pxzvf mean-backup.tar.gz -C /
    sudo /opt/bitnami/ctlscript.sh start
    

    You can find more information about this in our documentation

    https://docs.bitnami.com/aws/infrastructure/mean/administration/backup-restore/