Home > Enterprise >  Trigger AWS Lambda with input parameters using S3 event trigger from multiple file paths
Trigger AWS Lambda with input parameters using S3 event trigger from multiple file paths

Time:09-20

New to AWS Lambda Development

My lambda is reading a parquet file path from S3 location to move the data into DynamoDB.

Have a use case where I will have to trigger the same Lambda function to read the new files uploaded in multiple S3 paths. I am not sure how can we pass the file path into the Lambda call. If I put it in example -

  • Lambda1 Call 1 for reading parquet from file_path1 - new parquet uploaded in path file_path1 - /abc/abc1/abc_1.parquet

  • Lambda1 Call 2 for reading parquet from file_path2 - new parquet uploaded in path file_path2 - /xyz/xyz1/xyz_1.parquet

I am not sure if I have to provision multiple lambdas or can use one single lambda to be called multiple time with different file paths

CodePudding user response:

You can use a single Lambda function for this, there is no reason to provision multiple copies of the function. You can probably just setup a single trigger on the S3 bucket that triggers the Lambda function on any new files. The path of the new file will be in the event parameter that your Lambda function handler receives.

  • Related