diff --git a/s3-lambda-terraform/.gitignore b/s3-lambda-terraform/.gitignore new file mode 100644 index 000000000..fb7595fad --- /dev/null +++ b/s3-lambda-terraform/.gitignore @@ -0,0 +1 @@ +lambda.zip diff --git a/s3-lambda-terraform/README.md b/s3-lambda-terraform/README.md index b9c75bad6..173a51653 100644 --- a/s3-lambda-terraform/README.md +++ b/s3-lambda-terraform/README.md @@ -1,4 +1,4 @@ -# AWS S3 to AWS Lambda +# Amazon S3 to AWS Lambda The Terraform template deploys a Lambda function, an S3 bucket and the IAM resources required to run the application. A Lambda function consumes ObjectCreated events from an Amazon S3 bucket. The Lambda code checks the uploaded file and console log the event. @@ -57,7 +57,7 @@ After deployment, upload an object to the S3. Go to the CloudWatch Logs for the ```bash terraform show ``` - ``` + ---- Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/s3-lambda-terraform/main.tf b/s3-lambda-terraform/main.tf index bfbbda705..d69aee68f 100644 --- a/s3-lambda-terraform/main.tf +++ b/s3-lambda-terraform/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = "~> 3.27" + version = "~> 5.0" } random = { source = "hashicorp/random" @@ -32,7 +32,7 @@ resource "aws_lambda_function" "lambda_s3_handler" { source_code_hash = data.archive_file.lambda_zip_file.output_base64sha256 handler = "index.handler" role = aws_iam_role.iam_for_lambda.arn - runtime = "nodejs16.x" + runtime = "nodejs22.x" } data "archive_file" "lambda_zip_file" { @@ -59,9 +59,13 @@ resource "aws_iam_role" "iam_for_lambda" { ] } EOF - inline_policy { - name = "lambda_logs_policy" - policy = <