From aabd0333b5f813c890ff4e718dd3ca557eb06909 Mon Sep 17 00:00:00 2001 From: xss Date: Sun, 6 Mar 2022 10:31:04 +1100 Subject: [PATCH] add better dlq --- historic.tf | 19 +++++++++++++++++-- sqs_to_elk.tf | 4 ++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/historic.tf b/historic.tf index ccee621..f565623 100644 --- a/historic.tf +++ b/historic.tf @@ -108,8 +108,23 @@ resource "aws_lambda_function" "queue_data_update" { resource "aws_sqs_queue" "historic_to_s3" { name = "update-history" receive_wait_time_seconds = 0 - message_retention_seconds = 1209600 # 14 days - visibility_timeout_seconds = 300 + message_retention_seconds = 259200 + visibility_timeout_seconds = 3600 + + + redrive_policy = jsonencode( + { + deadLetterTargetArn = aws_sqs_queue.historic_to_s3_dlq.arn + maxReceiveCount = 100 + } + ) +} + +resource "aws_sqs_queue" "historic_to_s3_dlq" { + name = "update-history-dlq" + receive_wait_time_seconds = 1 + message_retention_seconds = 1209600 # 14 days + visibility_timeout_seconds = 10 } diff --git a/sqs_to_elk.tf b/sqs_to_elk.tf index 81598c8..3bdb9f8 100644 --- a/sqs_to_elk.tf +++ b/sqs_to_elk.tf @@ -97,10 +97,10 @@ resource "aws_sqs_queue" "sqs_to_elk" { redrive_policy = jsonencode( { deadLetterTargetArn = "arn:aws:sqs:us-east-1:143841941773:to-elk-dlq" - maxReceiveCount = 10 + maxReceiveCount = 100 } ) - visibility_timeout_seconds = 3600 + visibility_timeout_seconds = 10 } resource "aws_sqs_queue_policy" "sqs_to_elk" {