FTP/SFTP access to an Amazon S3 Bucket

zgall1 picture zgall1 · May 29, 2014 · Viewed 228.8k times · Source

Is there a way to connect to an Amazon S3 bucket with FTP or SFTP rather than the built-in Amazon file transfer interface in the AWS console? Seems odd that this isn't a readily available option.

Answer

Martin Prikryl picture Martin Prikryl · Sep 3, 2015

There are three options.

  • You can use a native managed SFTP service recently added by Amazon (which is easier to set up).
  • Or you can mount the bucket to a file system on a Linux server and access the files using the SFTP as any other files on the server (which gives you greater control).
  • Or you can just use a (GUI) client that natively supports S3 protocol (what is free).

Managed SFTP Service

  • In your Amazon AWS Console, go to AWS Transfer for SFTP and create a new server.

  • In SFTP server page, add a new SFTP user (or users).

    • Permissions of users are governed by an associated AWS role in IAM service (for a quick start, you can use AmazonS3FullAccess policy).

    • The role must have a trust relationship to transfer.amazonaws.com.

For details, see my guide Setting up an SFTP access to Amazon S3.


Mounting Bucket to Linux Server

Just mount the bucket using s3fs file system (or similar) to a Linux server (e.g. Amazon EC2) and use the server's built-in SFTP server to access the bucket.

  • Install the s3fs
  • Add your security credentials in a form access-key-id:secret-access-key to /etc/passwd-s3fs
  • Add a bucket mounting entry to fstab:

    <bucket> /mnt/<bucket> fuse.s3fs rw,nosuid,nodev,allow_other 0 0
    

For details, see my guide Setting up an SFTP access to Amazon S3.


Use S3 Client

Or use any free "FTP/SFTP client", that's also an "S3 client", and you do not have setup anything on server-side. For example, my WinSCP or Cyberduck.

WinSCP has even scripting and .NET/PowerShell interface, if you need to automate the transfers.