Build an event-driven order processing pipeline on AWS.
Architecture:
[Order API (Lambda + API GW)] ↓ PutEvents [EventBridge custom bus] ↓ Rule: source=com.myapp.orders ┌────┴────────┬──────────────────┐ ↓ ↓ ↓ [SQS: payments] [SQS: inventory] [Lambda: notifications] ↓ ↓ [Lambda: charge] [Lambda: reserve] ↓ on failure [DLQ: payments-dlq]
order.placed
Resources: OrderEventBus: Type: AWS::Events::EventBus Properties: { Name: order-events } PaymentsQueue: Type: AWS::SQS::Queue Properties: RedrivePolicy: maxReceiveCount: 3 deadLetterTargetArn: !GetAtt PaymentsDLQ.Arn OrderRule: Type: AWS::Events::Rule Properties: EventBusName: !Ref OrderEventBus EventPattern: source: ["com.myapp.orders"] detail-type: ["order.placed"] Targets: - Id: payments Arn: !GetAtt PaymentsQueue.Arn - Id: inventory Arn: !GetAtt InventoryQueue.Arn - Id: notifications Arn: !GetAtt NotificationFunction.Arn
# Submit 10 test orders for i in $(seq 1 10); do aws apigateway test-invoke-method \ --rest-api-id $API_ID \ --resource-id $RESOURCE_ID \ --http-method POST \ --body "{\"order_id\":\"order-$i\",\"amount\":$((RANDOM % 1000))}" done # Verify DLQ is empty (all payments succeeded or retried successfully) aws sqs get-queue-attributes \ --queue-url $PAYMENTS_DLQ \ --attribute-names ApproximateNumberOfMessages # Check CloudWatch logs for all Lambda functions aws logs tail /aws/lambda/payments-processor --follow
Next week: DynamoDB internals — the data model, capacity planning, and advanced patterns.