I created an sftp server in aws for testing.
- Generate an ssh key pair
ssh-keygen -t ed25519
- Log in to AWS
- Go to s3 and create a bucket for the server
- Go to IAM and create a role
- Pick 'AWS Service'
- Select 'Transfer' as the use case
- Add the following permissions:
- AmazonS3FullAccess
- Go to AWS Transfer Family
- Create a server and click 'next' on everything
- Go to the server and add a user
- set the role you created on the user
- set the s3 bucket you created as his home directory
- set the 'optional folder' to /
- add the public ssh key you created to the user
- Now it's setup. Be aware that connecting and using rooted paths will start at the s3-level, so
list("/")
will list all buckets in your s3. - Test it works
sftp -i path-to-ssh-private-key username@transfer-family-server-url <<<ls
Remember to delete the server, role, and bucket again when you're done.