Skip to content

[aws-events] Add support for Rule Dead Letter Queue #11612

@DaWyz

Description

@DaWyz

Amazon EventBridge recently added support for dead letter queues.

Use Case

It makes event-driven applications more resilient and durable by storing your events in queues when the events can't be delivered, or the target is unavailable. See the documentation for more information.

Proposed Solution

Following the CloudFormation documentation, it is possible to pass the deadLetterConfig at the rule level and at the target level. I suspect it makes more sense to set it at the target level so we can target different DLQs for targets on the same rule if needed.

A target would have the possibility to pass a Queue as a property. That would be straight forward. Also, we would need to attach a policy to the queue to allow the rule to SendMessage to the queue.

See below a usage example.

import * as logs from "@aws-cdk/aws-logs";
import * as sqs from "@aws-cdk/aws-sqs";
import * as events from "@aws-cdk/aws-events";
import * as targets from "@aws-cdk/aws-events-targets";

const logGroup = new logs.LogGroup(this, 'MyLogGroup', {
  logGroupName: 'MyLogGroup',
});

const rule = new events.Rule(this, 'rule', {
  eventPattern: {
    source: ["aws.ec2"],
  },
});

const myDeadLetterQueue = new sqs.Queue(this, 'Queue');

rule.addTarget(new targets.CloudWatchLogGroup(logGroup, {
  deadLetterQueue: myDeadLetterQueue
}));

Others

I'm happy to have a go at it.

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-eventsRelated to CloudWatch Eventseffort/mediumMedium work item – several days of effortfeature-requestA feature should be added or improved.in-progressThis issue is being actively worked on.p1

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions