AWS Transfer Family (SFTP)

Photo by Joan Gamell on Unsplash

AWS Transfer Family (SFTP)

ALL PASSWARD AND ID's ALL ALREADY GONE ;>

SFTP setup

Create bucket

Buckets for POC

img_7.png

Create roll for tf service. (Base config from documentation)

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AllowListingOfUserFolder",
            "Action": [
                "s3:ListBucket",
                "s3:GetBucketLocation"
            ],
            "Effect": "Allow",
            "Resource": [
                "arn:aws:s3:::aws-tf-poc-bucket"
            ]
        },
        {
            "Sid": "HomeDirObjectAccess",
            "Effect": "Allow",
            "Action": [
                "s3:PutObject",
                "s3:GetObject",
                "s3:DeleteObject",
                "s3:DeleteObjectVersion",
                "s3:GetObjectVersion",
                "s3:GetObjectACL",
                "s3:PutObjectACL"
            ],
            "Resource": "arn:aws:s3:::aws-tf-poc-bucket/*"
        }
    ]
}

Create transfer server

Chose protocol

img.png

Chose what will manage identity

img_1.png

Select networking options

img_2.png

  • Selected option VPC Hosted, will allow us to use Security Groups and Network Access Control
  • VPC / subnet(s) / elastic IP need to be already created

Security Group

Security group needs to have port 22 (SSH) open to allow incoming connections from EIP

img_3.png

Choosing domain aka. Storage Backend

img_4.png

Logging settings

img_5.png

Display Banner if you need one.

img_6.png

Add user to server

img_8.png

User can connect

img_9.png

Create files to test.

for x in {1..10}; do dd if=/dev/urandom of=test_$x.data bs=1024 count=10240; done

List and upload files

Each file is 10mb in size.

img_10.png

Creating workflow

Workflow will copy uploaded files to bucket called archive, And run lambda function.

In transfer family portal go to workflows and create one or add existing. You will see modal which will guide you, click add step and start adding workflow.

img_11.png

img_12.png

Attaching workflow

Click edit "Additional details" In Managed workflows add your workflow and IAM role which will allow in this example to run Lambda function and use different bucket.

img_13.png

Testing

img_14.png

main bucket

img_15.png

archive bucket

img_16.png

lambda test output

img_17.png

img_18.png