Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

4.2.2. Event-Driven Automation: Lambda and S3 Event Notifications

šŸ’” First Principle: Polling is expensive and slow. Instead of checking "has anything changed?" every 60 seconds, event-driven architecture inverts this: resources announce when they change, and automation responds immediately. This makes systems faster, cheaper, and more responsive than any polling approach.

AWS services emit events when things happen: an S3 object is uploaded, a DynamoDB stream record is written, an EC2 instance changes state. By connecting these events to Lambda functions, you create automation that responds in near real-time without any infrastructure to manage.

S3 Event Notifications:

S3 can publish events when objects are created, deleted, tagged, restored from Glacier, or replicated. Destinations:

DestinationUse Case
SNSFan-out notification to multiple subscribers
SQSQueued processing (handles backpressure for high-volume events)
LambdaDirect invocation for immediate processing
EventBridgeAdvanced routing with filtering and cross-account delivery

Example pipeline: Images uploaded to S3 → S3 event → Lambda → generate thumbnail → store in different S3 prefix.

EventBridge as the Central Event Bus:

EventBridge (covered in Phase 2) is the preferred integration point for operational automation because it supports:

  • Pattern matching on event content
  • Multiple simultaneous targets
  • Cross-account and cross-region routing
  • Scheduled rules (cron-based automation)
  • Dead-letter queues for failed deliveries

AWS Step Functions orchestrates multi-step workflows where the overall process must be tracked, steps may have human approval requirements, or individual steps can fail and need retry logic:

Lambda Limitations for Automation:
ConstraintValueImplication
Max execution timeout15 minutesLong operations need Step Functions or SSM Automation
Max memory10,240 MBMemory-intensive operations may need EC2 or Fargate
Max package size250 MB (unzipped)Large dependencies need Lambda layers or container images
Concurrent executions1,000 (default, adjustable)High-volume event processing needs throttling consideration
Common Event-Driven Automation Patterns:
TriggerEventLambda Action
S3 uploads3:ObjectCreatedParse, transform, validate, route
EC2 state changeEC2 Instance State-changeUpdate DNS, notify, deregister from monitoring
Config rule violationConfig Rules Compliance ChangeAuto-remediate, notify, create OpsItem
CloudTrail API callAWS API Call via CloudTrailDetect suspicious activity, block access, alert
DynamoDB streamRecord insert/modify/deleteReplicate to Elasticsearch, audit, trigger downstream

āš ļø Exam Trap: S3 event notifications and EventBridge are two separate systems for S3 events. S3 Event Notifications deliver directly to SNS/SQS/Lambda with no filtering beyond event type. EventBridge receives all S3 events (when enabled) and supports rich filtering by prefix, suffix, event type, and metadata — plus cross-account delivery. For complex filtering or cross-account routing, enable S3 → EventBridge integration and use EventBridge rules.

Reflection Question: Every time a new object is uploaded to an S3 bucket, you need to: (1) immediately trigger a Lambda to validate the file format, (2) send a notification to an SQS queue for async processing, and (3) route events matching *.csv to a different Lambda than events matching *.json. Which approach — S3 Event Notifications or EventBridge — best handles requirement 3, and why?

Alvin Varughese
Written byAlvin Varughese
Founder•15 professional certifications