Skip to content

Instantly share code, notes, and snippets.

@coingraham
Created March 21, 2016 19:27
Show Gist options
  • Save coingraham/73b0ba8bc55c84e78f90 to your computer and use it in GitHub Desktop.
Save coingraham/73b0ba8bc55c84e78f90 to your computer and use it in GitHub Desktop.
Python - Update the redrive policy for existing queues
import boto3
import json
# update these with your actual settings
maxreceivecount = 3
queueurl = "https://sqs.region.amazonaws.com/accountnumber/queuename"
deadlettertargetarn = "arn:aws:sqs:region:accountnumber:deadletterqueuename"
# you could just create a json string
policy = {"maxReceiveCount" : maxreceivecount, "deadLetterTargetArn": deadlettertargetarn}
policy = json.dumps(policy)
sqs_client = boto3.client('sqs')
response = sqs_client.set_queue_attributes(QueueUrl=queueurl, Attributes={"RedrivePolicy" : policy})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment