Difference between revisions of "RedrivePolicy"
Jump to navigation
Jump to search
Line 8: | Line 8: | ||
* [[Configuring an Amazon SNS dead-letter queue for a subscription]] | * [[Configuring an Amazon SNS dead-letter queue for a subscription]] | ||
+ | |||
+ | |||
+ | # 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}} | {{aws sns set-subscription-attributes}} |
Revision as of 09:23, 13 March 2025
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 }) }
Advertising: