BEFORE YOU BEGIN!

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

  • 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 server, such as the /usr/local/bin/movetos3.sh or the /etc/ssh/sshd_config, make a backup of these files. These backups can be used for reference should these files be modified during the update process.

  • We recommend that you perform the update 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.

Updating a High Availability stack of SFTP Gateway

SFTP Gateway version 2.0 High Availability uses an auto scaling group to keep the desired number of instance running at all times. The auto scaling group uses a launch configuration generated by the CloudFormation stack as a base configuration for all new instances that are launched into that auto scaling group. For this reason, the conventional method of updating an instance in the manner of connecting over SSH and running the update command does not work. If an instance was to go down for some reason, the instance that is brought up to replace it would be at the state of the original launch configuration that is behind a version. So to update any existing instances and any new instances created in case of failure or termination, you must update the launch configurations by editing the CloudFormation template.

To update your instances you must update the CloudFormation template then perform a scale out scale in process to maintain instance data:

  1. Update the CloudFormation stack:

    1. Go to the CloudFormation console

    2. Select your SFTP Gateway stack select-stack.png

    3. Click Actions -> Update Stack actions-update.png

    4. Click View/Edit template in Designer view-edit-template-in-designer.png

    5. In the text editor of Designer, find the userdata Property of LaunchConfiguration and add the update command sudo sftpgw update. add-update-command.png Note: You can specify which version number you would like to keep your instances at by supplying the UPDATE_TO_VERSION=<version_number> channel to the update command.

    6. Click the create stack icon at the top of the Designer create-stack-button.png

    7. Click Next through all of the configuration pages

    8. On the Review page, tick the IAM capabilities check box and click Update and click Update update-stack.png

    9. Once the stack says that the update is complete, proceed to the next step involving auto-scaling groups. update-complete.png

  2. Scale out/in your auto-scaling group:

    1. Go to the EC2 console -> Auto Scaling Groups

    2. Select your SFTP Gateway Auto Scaling Group select-auto-scaling-group.png

    3. Click Actions -> Edit actions-edit-asg.png

    4. In the Desired Capacity field, enter 4 (if your desired capacity is already at 4 you will have to drop it down to 2, let 2 instances terminate then go back to 4) and Save scale-out-instances.png

    5. Wait for the additional instances to enter “InService”. service-status.png

      Note: that the instances without launch configurations are the older instances that will eventually be terminated. You should let the new instances run for a couple minutes to allow the older instances to transfer their existing data to the new instances.

    6. After a couple minutes of the new instances in the “InService” state, edit the auto scaling group again to set the desired capacity back to 2 and save. scale-in-instances.png

Using this upgrade technique, if a server happens to be terminated in the future, any new servers instantiated to replace it will update to the most recent compatible version automatically before going into service.

Updating a single instance

If you are running a single instance stack of SFTP Gateway, you can update it by the conventional means.

  1. Log into the server over SSH with the ec2-user
ssh -i /path/to/private/key ec2-user@ip_address
  1. run the update command
sudo sftpgw update

The SFTP Gateway packages will be downloaded and installed automatically.