From 0d06d3776bd1b7590312bb8a5d97e6158a8e7ead Mon Sep 17 00:00:00 2001 From: Alice Lui <54395483+al01010@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:34:38 +0000 Subject: [PATCH] EPBR-7677: Add and increase memory size of lambda in prod As the lambda processing logs was returning OutOfMemory errors. --- service-infrastructure/logging/s3.tf | 1 + service-infrastructure/logging/variables.tf | 4 ++++ service-infrastructure/modules.tf | 1 + 3 files changed, 6 insertions(+) diff --git a/service-infrastructure/logging/s3.tf b/service-infrastructure/logging/s3.tf index d04c806..eccba62 100644 --- a/service-infrastructure/logging/s3.tf +++ b/service-infrastructure/logging/s3.tf @@ -179,6 +179,7 @@ resource "aws_lambda_function" "forward_logs_s3_cloudwatch" { role = aws_iam_role.lambda_forward_logs_s3_cloudwatch_role[0].arn handler = "index.handler" runtime = "nodejs20.x" + memory_size = var.memory_size timeout = 30 // Redeploy when lambda function code change diff --git a/service-infrastructure/logging/variables.tf b/service-infrastructure/logging/variables.tf index b746cfa..a85b5c8 100644 --- a/service-infrastructure/logging/variables.tf +++ b/service-infrastructure/logging/variables.tf @@ -10,3 +10,7 @@ variable "is_cloudwatch_insights_on" { type = number } +variable "memory_size" { + type = number + default = 128 +} diff --git a/service-infrastructure/modules.tf b/service-infrastructure/modules.tf index 5011092..fcc9bbb 100644 --- a/service-infrastructure/modules.tf +++ b/service-infrastructure/modules.tf @@ -729,6 +729,7 @@ module "logging" { prefix = local.prefix region = var.region is_cloudwatch_insights_on = 1 + memory_size = var.environment == "prod" ? 256 : 128 } module "fluentbit_ecr" {