Go to file
2023-07-11 18:45:59 +03:00
modules first commit 2023-07-11 18:45:59 +03:00
.gitignore first commit 2023-07-11 18:45:59 +03:00
locals.tf first commit 2023-07-11 18:45:59 +03:00
main.tf first commit 2023-07-11 18:45:59 +03:00
README.md first commit 2023-07-11 18:45:59 +03:00
variables.tf first commit 2023-07-11 18:45:59 +03:00

S3 bucket with a Lambda function as a listener and append to a DynamoDB table With Terraform

This is a simple example of how to use a Lambda function as a listener for an S3 bucket and append the data to a DynamoDB table.

Prerequisites

  • Terraform 1.4.x
  • AWS CLI
  • AWS account with permissions to create the resources
  • AWS credentials configured

Usage

  1. Clone this repository
  2. go to locals.tf in the root directory and change the account_id to your own account id
  3. need to make sure the javascript file inside module/lambda/files/lambda_function.zip is wil the right region and table name
  4. Run terraform init
  5. Run terraform apply

Example playlod file *.json

{
  "id": "00a6fa25-df29-4701-9077-557932591766",
  "timestamp": 23764783264,
  "data": "CONTENT OF THE FILE"
}

Test

  1. Upload a file to the S3 bucket
  2. Check the DynamoDB table for the new item
  3. check the CloudWatch logs for the Lambda function