Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Eventbridge: Pattern to capture ALL events

I'd like to deploy an AWS Event Rule in Eventbridge which is triggered by all events, with no filtering whatsoever.

I've tried the following patterns with no luck.

{
source: ["*"]
}

According to the documentation you cannot leave the pattern empty. Also, any fields not included in the pattern are wildcarded meaning they can be any value.

I've read articles saying Eventbridge can replace services such as SNS and SQS but without these finer controls I don't see that happening.

Thanks

like image 811
Harry Daniels Avatar asked Jun 16 '20 11:06

Harry Daniels


People also ask

Is EventBridge the same as CloudWatch events?

EventBridge is the evolution of the CloudWatch Events service. It brings new features, including the ability to integrate data from popular SaaS providers as events within AWS.

What is event pattern in CloudWatch?

A pattern either matches an event or it doesn't. Event patterns are represented as JSON objects with a structure that is similar to that of events, for example: { "source": [ "aws.ec2" ], "detail-type": [ "EC2 Instance State-change Notification" ], "detail": { "state": [ "running" ] } }

When should I use EventBridge?

Use Eventbridge when:You want to publish messages to many subscribers, and use the event data itself to match targets interested certain patterns. Want integration with other SaaS providers such as Shopify, Datadog, Pagerduty, or others.

How do I generate event patterns for events in AWS eventbridge?

Events are generated by AWS services in a predefined JSON format and sent to Amazon EventBridge. You can create rules that use event patterns to filter incoming events and then trigger a target. There are three methods for determining the JSON format for an incoming event: 1. Refer to this list of event examples. 2.

How do I create an eventbridge rule?

3. Create an EventBridge rule with a simple event pattern that matches all events for a specific service. For Define pattern, choose Event Pattern. Note: Wildcards aren't permitted in the event pattern. Empty event patterns are also not allowed.

What is Amazon eventbridge?

Amazon EventBridge is a serverless event bus that makes it easier to connect applications with data from a variety of sources. These event sources can be custom applications, AWS services and partner SaaS applications.

What is the difference between order and email in AWS eventbridge?

AWS EventBridge routes them to the Email service, which reads the event and sends out an email. Both services are based on Java. But the Order service runs in a container while the Email service is a Lambda function. The Order service uses AWS Java SDK to publish a custom EventBridge event that has the following format.


3 Answers

Based on the comments.

The solution was to use empty prefix to match all events:

{
"source": [{"prefix": "" }]
}
like image 109
Marcin Avatar answered Oct 13 '22 12:10

Marcin


You can try to use exists filter: https://docs.aws.amazon.com/eventbridge/latest/userguide/content-filtering-with-event-patterns.html#filtering-exists-matching

One caveat of using this is that it's not working properly when defined in CloudFormation, but at least it works in SDK and in console.

like image 40
Oleksii Donoha Avatar answered Oct 13 '22 12:10

Oleksii Donoha


My favorite was { "version": ["0"] }

like image 28
Tim Bray Avatar answered Oct 13 '22 12:10

Tim Bray