AWS SDK for Ruby
Developer Guide

Redirecting Dead Letters in Amazon SQS

The following example redirects any dead letters from the queue with the URL URL to the queue with the ARN ARN.

require 'aws-sdk-sqs' # v2: require 'aws-sdk' sqs = Aws::SQS::Client.new(region: 'us-west-2') sqs.set_queue_attributes({ queue_url: URL, attributes: { 'RedrivePolicy' => "{\"maxReceiveCount\":\"5\", \"deadLetterTargetArn\":\"#{ARN}\"}" } })