Skip to content

New serverless pattern - eventbridge-firehose-opensearch-cdk - #3284

Open
antoinebgit wants to merge 1 commit into
aws-samples:mainfrom
antoinebgit:eventbridge-firehose-opensearch-cdk
Open

New serverless pattern - eventbridge-firehose-opensearch-cdk#3284
antoinebgit wants to merge 1 commit into
aws-samples:mainfrom
antoinebgit:eventbridge-firehose-opensearch-cdk

Conversation

@antoinebgit

Copy link
Copy Markdown

Description

Adds the eventbridge-firehose-opensearch-cdk pattern: a catch-all EventBridge rule streams every event on a custom bus to an Amazon OpenSearch Service domain through Amazon Data Firehose, giving full-text search over event payloads within about 60 seconds.

  • Level: 200
  • Framework: CDK (TypeScript)
  • Services: EventBridge, Data Firehose, OpenSearch Service, Lambda, S3, CloudWatch Logs

How it works

  • A catch-all rule ({"source": [{"prefix": ""}]}) matches every event on the bus and targets a Firehose delivery stream.
  • Firehose buffers 60s / 1MB (the service minimum, which sets the latency of the pattern) and indexes into a daily-rotated index, events-YYYY-MM-DD.
  • An optional Lambda transform flattens the EventBridge envelope: detail-type becomes detail_type and detail fields are promoted to the top level. Envelope fields stay authoritative on key collisions, so a payload carrying its own source is indexed as detail_source.
  • All documents are backed up to S3; transform and delivery failures land under an errors/ prefix. Delivery errors are logged to CloudWatch Logs.

Testing

Deployed and tested end-to-end in a live account: verified daily index rotation, envelope flattening, the collision guard, the S3 backup copy, and zero delivery errors.

Checklist

  • Pattern folder contains README.md, example-pattern metadata JSON, and architecture.png
  • cdk destroy tested and removes all resources
  • No account IDs, IP addresses, or credentials committed

A catch-all EventBridge rule streams every event on a custom bus to an
Amazon OpenSearch Service domain through Amazon Data Firehose, giving
full-text search over event payloads within about 60 seconds.

- Firehose delivers to a daily-rotated index (events-YYYY-MM-DD) and
  backs up all documents to S3, with delivery errors logged to
  CloudWatch Logs.
- An optional Lambda transform flattens the EventBridge envelope so
  detail-type becomes detail_type and detail fields are promoted to the
  top level, keeping envelope fields authoritative on key collisions.
- The Firehose delivery role is authorized on both sides: an identity
  policy and the domain access policy, since a managed domain evaluates
  every request against its own policy.
- Dashboards access is granted to one or more operator CIDRs, because
  browsers cannot sign requests with SigV4.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants