devuplabs.cloud
PreviewLab5 hours

Integration Lab

Wire EventBridge across Lambda, SQS, SNS, and ECS, event-driven integration patterns end to end.

Complete Lab 1 (Standalone) before this. Concepts like event buses, rules, patterns, and DLQs are not re-explained here.

Mental model

EventBridge is the nervous system. Lambda, SQS, SNS, and ECS are the organs. EventBridge doesn't do the work, it decides which organ gets activated based on what just happened.

Prerequisites

0 of 4 checked

Shared setup, run before any part:

bash
export BUS_ARN=$(aws events create-event-bus \
  --name integration-bus \
  --region $AWS_REGION \
  --query 'EventBusArn' --output text)

export DLQ_URL=$(aws sqs create-queue \
  --queue-name eb-integration-dlq \
  --region $AWS_REGION \
  --query 'QueueUrl' --output text)

export DLQ_ARN=$(aws sqs get-queue-attributes \
  --queue-url $DLQ_URL --attribute-names QueueArn \
  --region $AWS_REGION --query 'Attributes.QueueArn' --output text)

aws sqs set-queue-attributes --queue-url $DLQ_URL \
  --attributes '{"Policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"events.amazonaws.com\"},\"Action\":\"sqs:SendMessage\",\"Resource\":\"'$DLQ_ARN'\"}]}"}' \
  --region $AWS_REGION

echo "Bus: $BUS_ARN | DLQ: $DLQ_ARN"

The Architecture We're Building

javascript
com.myapp.orders events
        │
        ▼
  integration-bus
        │
        ├── Rule: order-to-lambda ────▶ Lambda (validate + enrich)
        ├── Rule: order-to-sqs ───────▶ SQS (fulfillment queue)
        ├── Rule: high-value-to-sns ──▶ SNS (notify fraud/VIP team)
        └── Rule: order-to-ecs ───────▶ ECS (run batch processor)

One event → four parallel actions
Producer has zero knowledge of any consumer

EventBridge → Lambda

Goal

Route order events to Lambda. Understand the push invocation model. Use input transformation to reshape events before Lambda receives them.

Estimated time: 1 hour


How EventBridge invokes Lambda

What's happening here

EventBridge invokes Lambda synchronously via push: it calls lambda:InvokeFunction and treats any error (exception, timeout, throttle) as a failed invocation subject to retry. This differs from SQS → Lambda where Lambda polls. With EventBridge → Lambda:

  • EventBridge controls delivery timing
  • Retry policy is configured on the EventBridge target, not an event source mapping
  • Lambda receives the full EventBridge event envelope as its event parameter
  • Your business data lives in event['detail']

Permissions: Lambda needs a resource-based policy granting lambda:InvokeFunction to events.amazonaws.com. Without it, EventBridge silently fails, FailedInvocations increments, nothing else happens. This is the #1 EventBridge → Lambda mistake.

Unlock all 24 AWS services & 291+ lab sessions (~180 hours)

Pricing