Set up SFTP to upload files to S3

Create an SFTP Server with AWS Transfer Family

  1. Open the Amazon Transfer Family console
  • Choose Create server. AWS transfer
  1. Step 1 (Choose protocols): There are four options. In this lab, we have to choose SFTP and then click Next. AWS transfer
  2. Step 2 (Choose an identity provider): Choose Service managed and then click Next. AWS transfer
  3. Step 3 (Choose an endpoint): Choose Publicly accessible and then click Next. AWS an endpoint
  4. Step 4 (Choose a domain): Choose Amazon S3 and then click Next. Choose a domain
  5. Step 5 (Configure additional details): Choose Create a new role and then click Next. Config additiona details
  6. Step 6 (Review and create): We review the SFTP Server details and then click Create server Review create sftp server
  7. The server should be ready in a few minutes. This state is Starting as you can see. But you can click the SFTP Server and see what the server looks like (save the Endpoint URL for next steps).

So far, we have only the SFTP server running with the S3 bucket as the source.

Add an sftp user

Add an SFTP user

  1. Click Add user. Add an sftp user

  2. You type in the Username, choose the IAM role, your S3 bucket, paste SSH public keys. Then click Add.

    • Username: ant
    • Role: sftp-access-s3 (the user to be able to read from S3)
    • Policy: None
    • Home directory:
      • field 1: choose Your S3 bucket
      • field 2: empty
    • Restricted: don’t select.
    • SSH public keys: read the below guide. add user terminal
Create SSH keys
  1. With this command, we generate an SSH key pair (sftp_s3 (private key) and sftp_s3.pub (public key)):
ssh-keygen -m PEM -f sftp_s3

add user terminal Using the command cat sftp_s3.pub to display the content of the sftp_s3.pub key. We copy it and paste it into the SSH public key section. add user terminal

  1. We successfully created an SFTP server with an SFTP user. add user terminal

Using FileZilla with the SFTP Server

  1. Open FileZilla:

    • From the top menu, select File
    • Select Site Manager
    • Click New site
    • Input name sftp-s3 filezilla SFTP
  2. Select the General tab:

    • Protocol: SFTP
    • Host: Endpoint URL
    • Logon Type: Key file
    • User: ant
    • Key file: You click Browser and then select the path to the sftp_s3 key on your computer.
    • Click Connect.

filezilla SFTP

With the window pop-up, select Save passwords, then click OK and Connect.

filezilla SFTP

Click OK.

filezilla SFTP

  1. We successful connect to the SFTP Server with FileZilla filezilla SFTP

  2. Upload files from your computer to the SFTP Server.

You navigate to the folder containing the files, select them, right-click your mouse, and select Upload. filezilla SFTP 17. Files were upload. filezilla SFTP 18. Open the S3 bucket, you will see the files that we have just uploaded. Uploaded S3 bucket

  1. Delete a file from your S3 bucket.

You select a file and then press the Delete button.

del file S3 bucket SFTP Type permanently delete and then click Delete Object. del file S3 bucket SFTP

  1. Right-click your mouse in the right zone and select Refresh. refresh SFTP There is only two files viewable. refresh SFTP

  2. Delete files from the SFTP Server with FileZilla. You select two files, right-click, and then select Delete. del file from filezilla SFTP Click Yes. del file from filezilla SFTP

Your S3 bucket will be empty.