S3 Notifications using Lambda and SQS
1 min readSep 9, 2019
Terraform code to fetch the existing bucket details:
Terraform code for setting up Lambda function and its IAM role, policies :
Terraform code for setting up s3 Event trigger:
Terraform code for setting up SQS Queue:
The key concepts to understand:
- Create a Lambda function with IAM role and s3 access permissions attached to it.
- Set up an s3 Event trigger to existing s3 bucket so then Lambda will get triggered when a new file is uploaded in this bucket.
- Create an SQS Queue in which we want to send the file details.
Verifying the Setup:
- Login to AWS console and upload any file in the bucket under input-data folder.
- Which will trigger the Lambda and lambda will send the file name to SQS
- Go to the SQS console and select your SQS queue.
- You will find the file name with the folder name in SQS.