Skip to content

S3 to SQS

A Lambda function that receives S3 object-creation events, transforms each record into a typed ProcessedMessage, and publishes it to an SQS queue.

Architecture

The template sets up:

  1. Amazon S3 bucket: Generates events when objects are created.
  2. AWS Lambda function: Transforms S3 event metadata into ProcessedMessage objects.
  3. Amazon SQS queue: Receives the processed messages.

Architecture diagram showing an S3 bucket generating events on object creation, which triggers an AWS Lambda function to process the event and send a message to an SQS queue.

Code

Deployment

Deploy the stack using:

mise run deploy s3

ProcessedMessage model

Field Type Description
bucket string S3 bucket name (3-63 chars)
key string S3 object key (1-1024 chars)
event_time string ISO-8601 event timestamp
source string Origin event source (s3)

Environment variables

Variable Description Required Default
SQS_QUEUE_URL SQS queue URL to publish processed messages to Yes -
SERVICE_NAME Powertools service name No s3-processor
METRICS_NAMESPACE CloudWatch Metrics namespace No S3Processor
LOG_LEVEL Log level for the Lambda Logger No INFO