EventBridge Orchestrator

Infrastructure-as-code repository defining AWS EventBridge schemas, rules, and utility lambdas for a decoupled microservices architecture.

https://github.com/davidbmar/eventbridge-orchestrator  ·  public  ·  shipped

What it is

A centralized configuration and schema registry for an AWS event-driven system. It enforces contract consistency via JSON Schema definitions, manages EventBridge routing rules via Terraform, and provides operational utility Lambdas for logging and dead-letter queue processing. It does not contain business logic but defines how independent services (Frontend, Transcription, Search) communicate asynchronously.

Features

Quickstart

git clone https://github.com/davidbmar/eventbridge-orchestrator.git
cd eventbridge-orchestrator
terraform init
terraform plan
terraform apply

Architecture

flowchart TD
    subgraph Services
        FE[Frontend Service]
        TS[Transcription Service]
        SE[Search Service]
    end

    subgraph EventBridge_Orchestrator
        EB[AWS EventBridge Bus]
        Schemas[JSON Schemas]
        Rules[Terraform Rules]
    end

    subgraph Utilities
        Logger[Event Logger Lambda]
        DLQ[DLQ Processor Lambda]
        CW[CloudWatch Logs/Metrics]
        SNS[SNS Alerts]
    end

    FE -->|Publish AudioUploaded| EB
    TS -->|Publish TranscriptionCompleted| EB
    
    EB -->|Route| TS
    EB -->|Route| SE
    EB -->|Log All| Logger
    Logger --> CW
    
    EB -.->|Failed Events| DLQ
    DLQ -->|Retry| EB
    DLQ -->|Alert| SNS

How it's built

The project uses Terraform to provision AWS EventBridge resources (Event Buses, Rules, Targets) and IAM permissions. Event contracts are defined as versioned JSON Schema files. Operational resilience is handled by Node.js Lambda functions for event auditing and DLQ recovery. Integration tests verify event publishing using the AWS SDK.

How it runs

sequenceDiagram
    participant Pub as Publisher Service
    participant EB as EventBridge Bus
    participant Sub as Subscriber Service
    participant Log as Event Logger Lambda
    participant DLQ as DLQ Processor

    Pub->>EB: putEvents(Detail, Source, DetailType)
    EB->>EB: Validate against Schema
    alt Valid Event
        EB->>Sub: Invoke Target (Lambda/SQS)
        EB->>Log: Invoke Logger Lambda
        Log->>Log: Write to CloudWatch
    else Invalid/Failed Delivery
        EB->>DLQ: Send to Dead Letter Queue
        DLQ->>DLQ: Process Failed Record
        alt Retryable
            DLQ->>EB: Republish Event
        else Fatal Error
            DLQ->>SNS: Send Alert Notification
        end
    end

How to apply & reuse

Clone the repository to manage the central event bus infrastructure. Add new event schemas to the `schemas/` directory following semantic versioning. Update `terraform/` modules to route new event types to specific service targets. Deploy using Terraform to synchronize the event routing layer across environments.

At a glance

CapabilitiesEvent Schema ManagementInfrastructure as CodeEvent RoutingObservability & LoggingError Handling & Recovery
Componentsschemas/lambdas/event-logger/lambdas/dead-letter-processor/terraform/
TechAWS EventBridgeTerraformNode.jsAWS LambdaJSON SchemaAWS SDK
Depends onAWS AccountTerraform CLINode.js Runtime
Integrates withaudio-ui-cf-s3-lambda-cognitotranscription-sqs-spot-s3search-index-serviceAmazon CloudWatchAmazon SNS
PatternsEvent-Driven ArchitecturePublisher-SubscriberDead Letter QueueSchema RegistrySidecar Logging
Reuse tagsawseventbridgeterraformmicroservicesschema-validation

⚠ Needs attention