Socket
Socket
Sign inDemoInstall

aws-sqs-redriver

Package Overview
Dependencies
17
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    aws-sqs-redriver

Re-drives messages from one SQS queue to another, e.g. to re-process "dead letters"


Version published
Maintainers
1
Created

Readme

Source

AWS SQS Redriver

Greenkeeper badge

Re-drives messages from one SQS queue to another, e.g. to re-process "dead letters".

Meant to be triggered by an SNS notification and run on a Lambda.

Example usage

  1. Deploy to Lambda (having all permissions needed as defined by AWS and subscribing to SNS topic)
  2. Trigger with SNS notification, having stringified JSON as body (subject can be any value, but not empty), e.g: {"source_queue_url":"https://queue.amazonaws.com/80398EXAMPLE/MyDLQ","target_queue_url":"https://queue.amazonaws.com/80398EXAMPLE/MyQueue"}

Message Redriver API

redriveMessages({ sns_event }) -> Promise

Moves messages from source_queue_url to target_queue_url, which should be defined as stringified JSON in the event Message.

NOTE: When added to target_queue_url, the message will only include the MessageBody property, not any MessageAttributes or other properties of the message in the source queue.

Example
const redriver = require('./build/sqs-redriver');
const dead_letter_queue_url = 'arn:aws:sqs:region:account-id:queuename_dlq';
const target_queue_url = 'arn:aws:sqs:region:account-id:queuename';

const queue_params = {
  source_queue_url: 'https://queue.amazonaws.com/80398EXAMPLE/MyDLQ',
  target_queue_url: 'https://queue.amazonaws.com/80398EXAMPLE/MyQueue',
};

// SNS Event should have Message: JSON.stringify(queue_params)

redriver.redriveMessages({ sns_event: sns_event })
      .then(() => console.log('Success!'))
      .catch(err => console.log('Failed to redrive messages: %j', err));
IAM access to queues

source_queue_url

  • sqs:ChangeMessageVisibility
  • sqs:ReceiveMessage
  • sqs:DeleteMessage

target_queue_url

  • sqs:SendMessage

License

MIT.

Keywords

FAQs

Last updated on 30 Dec 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc