Skip to main content

AWS CDK SQS Construct with alarms and dead letter queue

Project description

AWS CDK SQS Construct with alarms and dead letter queue

What it does

Creates:

  • two queues, one main and one dead letter. Dead letter has added suffix "--dead-letter" to name passed in queueSettings.queueName

  • SNS topic with target configured to email from alarmEmail parameter

  • alarms for both queues

    • for main queue: message age, passed as alarmWhenMessageOlderThanSeconds parameter
    • for dead letter: alarm triggered if there is any message

Alarms are configured to be sent as fast as possible. Note that SQS report values to CloudWatch every 5 mins.

Installation

npm install --save cdk-sqs-monitored

Usage

Minimal config:

import * as cdk from '@aws-cdk/core';
import * as lib from 'cdk-sqs-monitored';

const app = new cdk.App();

export class SampleAppStack extends cdk.Stack {
  constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
      super(scope, id, props);

      new lib.MonitoredQueue(this, 'q1', {
          alarmEmail: 'your-email@test.com',
          alarmWhenMessageOlderThanSeconds: 300,
          maxReceiveCount: 3,
          queueSettings: {
              queueName: 'test-queue',
          }
      })
  }
}

new SampleAppStack(app, 'SampleappStack');

queueSettings parameter expects standard @aws-cdk/aws-sqs QueueProps object

Modyfying and PR

You're always welcome to create PR, but it might be best solution for you to just fork the repository and apply the changes in your repo.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for cdk-sqs-monitored, version 1.0.3
Filename, size File type Python version Upload date Hashes
Filename, size cdk_sqs_monitored-1.0.3-py3-none-any.whl (18.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size cdk-sqs-monitored-1.0.3.tar.gz (18.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page