{"id":15519461,"url":"https://github.com/orasik/aws_lambda_ftp_function","last_synced_at":"2025-07-20T20:05:12.824Z","repository":{"id":85767208,"uuid":"56848509","full_name":"orasik/aws_lambda_ftp_function","owner":"orasik","description":"AWS Lambda Function to connect to FTP, download files and save them to S3 bucket","archived":false,"fork":false,"pushed_at":"2024-08-07T08:05:57.000Z","size":122,"stargazers_count":67,"open_issues_count":5,"forks_count":42,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-13T18:55:39.946Z","etag":null,"topics":["api-gateway","aws","ftp","lambda","python","s3-bucket"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/orasik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-22T10:46:30.000Z","updated_at":"2025-02-25T15:13:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"7f6354bf-f81f-4d55-a8b0-84e660342868","html_url":"https://github.com/orasik/aws_lambda_ftp_function","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/orasik/aws_lambda_ftp_function","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orasik%2Faws_lambda_ftp_function","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orasik%2Faws_lambda_ftp_function/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orasik%2Faws_lambda_ftp_function/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orasik%2Faws_lambda_ftp_function/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orasik","download_url":"https://codeload.github.com/orasik/aws_lambda_ftp_function/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orasik%2Faws_lambda_ftp_function/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266189594,"owners_count":23890062,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-gateway","aws","ftp","lambda","python","s3-bucket"],"created_at":"2024-10-02T10:21:37.040Z","updated_at":"2025-07-20T20:05:12.802Z","avatar_url":"https://github.com/orasik.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"#AWS Lambda FTP Function\n\nThe following How-To will demonstrate how to use AWS Lambda service to:\n\n- Connect to FTP\n- Download files\n- Archive files in FTP (moving them to `archive` folder)\n- Save files to S3\n\nLater this will trigger another event on Lambda to parse these files and send data to API Gateway.\n**Make sure that S3 and Lambda are on the same region, otherwise Lambda event will not work.**\n\nFlow diagram:\n\n![](images/lambda.png)\n\n**This how-to assume that you have an AWS account with admin access.**\n\n\n### Step 1\n**Create S3 bucket.**\n\n### Step 2\n**Create Role to access this S3 bucket**\n\n1. Click on Identity \u0026 Access Management (IAM)\n2. Click on Roles\n3. Create New Role\n4. Name it `lambda_ftp_to_s3`\n5. Select AWS Lambda.\n6. Select `AWSLambdaFullAccess` and click Next.\n7. This will then show you a review screen like below.\n![](images/lambda_arn.png)\n\n### Step 3\nCreate Lambda function\n\n1. Click on Get started now.\n2. Skip the next screen as it just showing pre-defined functions\n3. In configure function, please fill the form as below\n![](images/configure_function.png)\n\n4. In the code section, copy and paste the code in [aws_lambda_ftp_function.py](./aws_lambda_ftp_function.py)\n5. **Please make sure to populate data with your own specific credentials for S3 bucket name and FTP connection.\n6. Handler, keep it as it is\n7. Role, use the one that we have created on step 2.\n8. Timeout is quite improtant in this application as you may expect delays, slow FTP connection or large number of files to download. I would put it as 1 minute.\n9. Click create function\n\n\n### Step 4\nNow we need to setup the event to call this function to fetch FTP and download files.\n\n1. In Lambda function page, go to `Event sources`\n2. Add event source\n3. Choose `CloudWatch Events - Schedule`\n4. Use Rule name as you prefer and choose `Schedule expression`\n5. You can either use pre-defined rates (1 minute, 5 minutes, 15 minutes, 1 hour or cron type schedule)\n\n\n### Testing\nTo test your function, run **Test** from function page and you should be able to see output at buttom.\n\nIf everything was ok, you should be able to see files in your S3.\n\n### TODO\n- ~~Add code to archive files in FTP~~\n- Add code to read files from S3, parse them and send them to API gateway\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forasik%2Faws_lambda_ftp_function","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forasik%2Faws_lambda_ftp_function","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forasik%2Faws_lambda_ftp_function/lists"}