When a new version of the SFTP Gateway is available containing bug fixes or new features, it may not be practical to launch a new AMI and recreate all your users. Follow the steps below to upgrade an existing instance of SFTP Gateway with the latest application binaries.

Determining SFTP Gateway Version

In SFTP Gateway version 1.002 and later, updating the server is simple and straight forward. If you have Version 1.001, you must manually download and run the update application. Use the command below to determine your application version, then refer to the sections that follow.

When logged into your SFTP Gateway server as the ec2-user, run the following command:

[ec2-user@ip-172-31-9-70 ~]$ sudo sftpgw version

If you receive sudo: sftpgw: command not found, proceed to the section labeled “Upgrading Versions Prior to Version 1.002”. If this commands returns version 1.002 or later, proceed to the section labeled “Upgrading Version 1.002 and Later” below.

Before upgrading

There are a couple of things to consider before upgrading your existing SFTP Gateway instance.

  • Make a snap shot of your existing EC2 instance as a backup in the event that something should go wrong during the update process. For more information on creating a snapshot, see this AWS EC2 documentation.

  • If you have made any modifications to the /usr/local/bin/movetos3.sh file for pre or post move processing, make a backup of this file. This backup can be used for reference should this file be modified during a version release, such as it does from version 1.003.2 to 1.003.3.

  • We recommend that you perform the upgrade process in a test environment to verify continued functionality before applying changes to production environments. This can be done using the snapshot image suggested above.

Upgrading to Version 1.004.2

To update to version 1.004.2.

  1. Run the SFTP Gateway update command:
[ec2-user@ip-172-xxx-xxx-xxx ~]$ sudo sftpgw update
  1. Create the sync configuration directory for user based sync files:
[ec2-user@ip-172-xxx-xxx-xxx ~]$ sudo mkdir -p /opt/sftpgw/sync.d/
  1. Run the SFTP Gateway setup command to apply the updated changes:
[ec2-user@ip-172-xxx-xxx-xxx ~]$ sudo sftpgatewaysetup
  1. Apply changes to any existing users:
[ec2-user@ip-172-xxx-xxx-xxx ~]$ sudo sftpgw reset john

Upgrading Version 1.002 and Later

If you are using version 1.002 or later, updating SFTPGateway is simple.

  1. Run from the application to update…
[ec2-user@ip-172-xxx-xxx-xxx ~]$ sudo sftpgw update
  1. If necessary, reset the monitoring of your users’ upload directories. In version 1.002 and above, this step should NOT be necessary. Refer to specific version Release Notes to determine if this step is required.
[ec2-user@ip-172-xxx-xxx-xxx ~]$ sudo sftpgw reset john
  1. Finally, make sure your sftpgateway.properties file is up to date:
[ec2-user@ip-172-xxx-xxx-xxx ~]$ sudo sftpgatewaysetup
  1. Optional - If you want to leverage new user-specific features in version 1.003 or later (private download directory, server side encryption, etc.), you may rerun sudo addsftpuser <username> at any time to modify or update user settings. As of version 1.003 this command is idempotent and can be executed multiple times to change settings for a single user.

Upgrading Versions Prior to Version 1.002

When logged into the SFTP Gateway server as the ec2-user, enter the following commands:

  1. Download zip from our public S3 bucket…
[ec2-user@ip-172-xxx-xxx-xxx ~]$ wget https://s3.amazonaws.com/thorntech-amis/sftpgateway/sftpgw.zip
  1. Extract the sftpgw application…
[ec2-user@ip-172-xxx-xxx-xxx ~]$ unzip sftpgw.zip sftpgw
  1. Run the sftpgw application to update…
[ec2-user@ip-172-xxx-xxx-xxx ~]$ sudo ./sftpgw update
  1. Clean up local directory. New application binaries will be installed in /usr/local/bin.
[ec2-user@ip-172-xxx-xxx-xxx ~]$ rm -f sftpgw
  1. Reset the monitoring of your users’ upload directories. NOTE: This must be done for EACH SFTP Gateway user.
[ec2-user@ip-172-xxx-xxx-xxx ~]$ sudo sftpgw reset john
  1. Finally, make sure your sftpgateway.properties file is up to date:
[ec2-user@ip-172-xxx-xxx-xxx ~]$ sudo sftpgatewaysetup

Going forward, you can now following the directions listed above to update SFTP Gateway.