SFTP Gateway on AWS Migration Guide
Note: This page applies to SFTP Gateway version 2.x. Visit Here for documentation on version 3.x.
This is a guide for migrating from SFTP Gateway version
There is no in-place upgrade path between these two versions. This is because
uses a different operating system (Amazon Linux 2).
Instead, you will need to launch a new SFTP Gateway for AWS CloudFormation stack, and migrate your old users and settings over. This involves 3 main steps:
- Launch a new SFTP Gateway CloudFormation stack
- Run a backup script to generate an artifact
- Transfer this artifact to the new VM, and run a script to restore settings from the artifact
Launch a new SFTP Gateway CloudFormation stack
The first step is to spin up a new SFTP Gateway CloudFormation stack. Click here to visit the product page on the AWS Marketplace and follow the steps there to launch a new instance. Then follow the steps below to continue.
Run a backup script to generate an artifact (2.000.x)
SSH to the
2.000.04server as the
Download the backup script
cd /home/ec2-user/ wget http://www.sftpgateway.com/backup-and-recovery/backup.py
Run the backup script
sudo python backup.py
Locate the backup artifact
cd /opt/sftpgw/backups/ ls -la
Look for a backup file in the format
This will later be used to recover SFTP Gateway users and configuration.
Move this backup artifact to your home directory
cp -a /opt/sftpgw/backups/sftpgw-*.tar.gz /home/ec2-user/
In a different terminal session, copy this file to your local machine
scp -i <private-key> ec2-user@<ip-address>:/home/ec2-user/sftpgw-*.tar.gz .
Run a backup script to generate an artifact (1.004.x)
If you are running SFTP Gateway
1.004.x or SFTP Gateway Classic,
you will need to use a different script to export your users and settings.
cd /home/ec2-user/ wget https://s3.amazonaws.com/thorntech-public-documents/sftpgateway/migration-scripts/sftpgw-export.py sudo python sftpgw-export.py
This will generate a file
sftpgw.yml in your current directory.
Transfer this artifact to the new CloudFormation stack, and run a script to restore settings from the artifact
To import SFTP Gateway users and configuration:
Upload the backup artifact to the new server
scp -i <private-key> sftpgw-*.tar.gz ec2-user@<ip-address>:/home/ec2-user/
SSH to the server as the administrator user
ssh -i <private-key> ec2-user@<ip-address>
Download the recovery script:
Run the python recovery script
sudo python recovery.py sftpgw-YYYY-MM-DD-HH-MM-SS.tar.gz
If have the web admin UI open, make sure you hard-refresh the web browser to see the latest changes.
Your new instance will be in the same state as the original instance, including your users and SFTP Gateway configuration.