All Projects → orasik → aws_lambda_ftp_function

orasik / aws_lambda_ftp_function

Licence: other
AWS Lambda Function to connect to FTP, download files and save them to S3 bucket

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to aws lambda ftp function

Serverless Sharp
Serverless image optimizer for S3, Lambda, and Cloudfront
Stars: ✭ 102 (+85.45%)
Mutual labels:  lambda, api-gateway, s3-bucket
Apilogs
Easy logging and debugging for Amazon API Gateway and AWS Lambda Serverless APIs
Stars: ✭ 216 (+292.73%)
Mutual labels:  lambda, api-gateway
Aws Mobile React Native Starter
AWS Mobile React Native Starter App https://aws.amazon.com/mobile
Stars: ✭ 2,247 (+3985.45%)
Mutual labels:  lambda, api-gateway
serverless-certificate-creator
serverless plugin to manage the certificate of your lambdas custom domain (API Gateway=
Stars: ✭ 33 (-40%)
Mutual labels:  lambda, api-gateway
Zappa
Serverless Python
Stars: ✭ 11,859 (+21461.82%)
Mutual labels:  lambda, api-gateway
Aws Lambda Fastify
Insipired by aws-serverless-express to work with Fastify with inject functionality.
Stars: ✭ 190 (+245.45%)
Mutual labels:  lambda, api-gateway
Hands-On-Serverless-Applications-with-Go
Hands-On Serverless Applications with Go, published by Packt.
Stars: ✭ 92 (+67.27%)
Mutual labels:  lambda, api-gateway
shim
HTTP Handler shim for Go projects running on AWS Lambda
Stars: ✭ 64 (+16.36%)
Mutual labels:  lambda, api-gateway
aws-tutorial-code
AWS tutorial code.
Stars: ✭ 114 (+107.27%)
Mutual labels:  lambda, s3-bucket
cim
CIM takes the pain out of Infrastructure as Code and CloudFormation
Stars: ✭ 51 (-7.27%)
Mutual labels:  lambda, api-gateway
Serverless Next.js
⚡ Deploy your Next.js apps on AWS Lambda@Edge via Serverless Components
Stars: ✭ 2,977 (+5312.73%)
Mutual labels:  lambda, api-gateway
lambda-redirector
Redirect an entire website using AWS Lambda
Stars: ✭ 21 (-61.82%)
Mutual labels:  lambda, api-gateway
Hexaville
The modern serverless web application engine and framework for Swift
Stars: ✭ 123 (+123.64%)
Mutual labels:  lambda, api-gateway
Serverless Sinatra Sample
Demo code for running Ruby Sinatra on AWS Lambda
Stars: ✭ 195 (+254.55%)
Mutual labels:  lambda, api-gateway
Hello Lambda
🔥 An example of a Python (AWS) Lambda exposed with API Gateway, configured with Terraform.
Stars: ✭ 114 (+107.27%)
Mutual labels:  lambda, api-gateway
yake
A Rake-like DSL for writing AWS Lambda handlers
Stars: ✭ 146 (+165.45%)
Mutual labels:  lambda, api-gateway
Up
Up focuses on deploying "vanilla" HTTP servers so there's nothing new to learn, just develop with your favorite existing frameworks such as Express, Koa, Django, Golang net/http or others.
Stars: ✭ 8,439 (+15243.64%)
Mutual labels:  lambda, api-gateway
Aws Cli Cheatsheet
☁️ AWS CLI + JQ = Make life easier
Stars: ✭ 94 (+70.91%)
Mutual labels:  lambda, api-gateway
aws-maven-plugin
Deploys resources to AWS using maven
Stars: ✭ 25 (-54.55%)
Mutual labels:  lambda, s3-bucket
super-serverless-sample
Backend serverless que simula o sistema de votação do BBB
Stars: ✭ 30 (-45.45%)
Mutual labels:  lambda, api-gateway

#AWS Lambda FTP Function

The following How-To will demonstrate how to use AWS Lambda service to:

  • Connect to FTP
  • Download files
  • Archive files in FTP (moving them to archive folder)
  • Save files to S3

Later this will trigger another event on Lambda to parse these files and send data to API Gateway. Make sure that S3 and Lambda are on the same region, otherwise Lambda event will not work.

Flow diagram:

This how-to assume that you have an AWS account with admin access.

Step 1

Create S3 bucket.

Step 2

Create Role to access this S3 bucket

  1. Click on Identity & Access Management (IAM)
  2. Click on Roles
  3. Create New Role
  4. Name it lambda_ftp_to_s3
  5. Select AWS Lambda.
  6. Select AWSLambdaFullAccess and click Next.
  7. This will then show you a review screen like below.

Step 3

Create Lambda function

  1. Click on Get started now.

  2. Skip the next screen as it just showing pre-defined functions

  3. In configure function, please fill the form as below

  4. In the code section, copy and paste the code in aws_lambda_ftp_function.py

  5. **Please make sure to populate data with your own specific credentials for S3 bucket name and FTP connection.

  6. Handler, keep it as it is

  7. Role, use the one that we have created on step 2.

  8. 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.

  9. Click create function

Step 4

Now we need to setup the event to call this function to fetch FTP and download files.

  1. In Lambda function page, go to Event sources
  2. Add event source
  3. Choose CloudWatch Events - Schedule
  4. Use Rule name as you prefer and choose Schedule expression
  5. You can either use pre-defined rates (1 minute, 5 minutes, 15 minutes, 1 hour or cron type schedule)

Testing

To test your function, run Test from function page and you should be able to see output at buttom.

If everything was ok, you should be able to see files in your S3.

TODO

  • Add code to archive files in FTP
  • Add code to read files from S3, parse them and send them to API gateway
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].