Skip to main content

Lambda: ETL Trigger (Execution-Name Lock)

Purpose

Receives EventBridge events and starts the Step Functions ETL state machine with a deterministic execution name. This provides per-partition locking: Step Functions rejects duplicate execution names, so only one run per partition can be active at a time.

Execution Name Format

etl-transactions-YYYY-MM (e.g. etl-transactions-2026-02)

  • One active run per month per dataset
  • S3 events: derived from event time (UTC)
  • Schedule events: derived from event time (UTC)

Flow

EventBridge (S3 or Schedule) → Lambda (etl_trigger) → Step Functions (StartExecution with name)

If a second event arrives for the same partition while the first run is active, StartExecution returns ExecutionAlreadyExists; the Lambda catches this and returns status: already_running (idempotent).

Environment

  • STATE_MACHINE_ARN: Set by Terraform; the Step Functions state machine to invoke
© 2026 Stephen AdeiCC BY 4.0