RedrivePolicy

From wikieduonline
Jump to navigation Jump to search


aws sns set-subscription-attributes \
--subscription-arn arn:aws:sns:us-east-2:123456789012:MyEndpoint:1234a567-bc89-012d-3e45-6fg7h890123i
--attribute-name RedrivePolicy
--attribute-value "{\"deadLetterTargetArn\": \"arn:aws:sqs:us-east-2:123456789012:MyDeadLetterQueue\"}"



# SNS Topic Subscription with DLQ
resource "aws_sns_topic_subscription" "main_order" {
  topic_arn = aws_sns_topic.main_order.arn
  protocol  = "sqs"
  endpoint  = aws_sqs_queue.main_queue.arn

  # Configure the redrive policy to point to the DLQ
  redrive_policy = jsonencode({
    deadLetterTargetArn = aws_sqs_queue.dlq.arn
  })
}


aws sns set-subscription-attributes

Advertising: