📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials AWS Solutions Architect S3 Event Notifications

S3 Event Notifications

4 min read
Configure S3 Event Notifications to trigger Lambda, SQS, and SNS when files are created or deleted. Build event-driven file processing pipelines.

S3 Event Notifications — React to File Changes

S3 Event Notifications automatically trigger actions when files are uploaded, deleted, or modified. This enables event-driven architectures where file activity kicks off downstream processing.

Teacher Note: Imagine you own a mail room (S3). Every time a package arrives (file uploaded), you want: security to scan it (Lambda), a notification sent to the recipient (SNS), and the tracking system updated (SQS). S3 Events does all three automatically when something arrives.

Triggering Events

EventWhen TriggeredExample Use Case
s3:ObjectCreatedAny object creation (PUT, POST, COPY, multipart)Process image after upload
s3:ObjectRemovedObject deletion or version deletionAudit file deletion, clean up thumbnails
s3:ObjectRestoreRestore from Glacier completedProcess restored archive
s3:ReplicationReplication events (success/failure)Monitor replication health

Event Destinations

DestinationUse WhenPattern
LambdaImmediate processing, transformation, validationUpload photo → Lambda creates thumbnails
SQSQueue for async processing, rate limitingUpload CSV → SQS → batch Lambda processes records
SNSFan-out to multiple destinationsUpload → SNS → SQS email queue + SQS audit queue + Lambda

Event Notification Configuration

# S3 Event Notification (JSON)
{
  "LambdaFunctionConfigurations": [
    {
      "LambdaFunctionArn": "arn:aws:lambda:...:thumbnail-generator",
      "Events": ["s3:ObjectCreated:*"],
      "Filter": {
        "Key": {
          "FilterRules": [
            {"Name": "prefix", "Value": "uploads/"},
            {"Name": "suffix", "Value": ".jpg"}
          ]
        }
      }
    }
  ]
}

EventBridge vs S3 Event Notifications

For S3, EventBridge provides more advanced routing capabilities — multiple destinations, content-based routing, archive and replay. S3 native notifications are simpler and have lower latency.

Exam Tip: Filter by prefix and suffix to avoid triggering on every S3 object. For example: only process files in the uploads/ prefix with .jpg suffix. This prevents infinite loops where Lambda output files trigger more Lambda invocations.