Prompt
How do I trigger code from S3 uploads without servers?
Latest observation
Oct 25, 2026
OpenAI APIWeb search: off
Use Amazon S3 event notifications to trigger a serverless function, usually AWS Lambda, whenever an object is uploaded.
Common setup
- Create an S3 bucket
- Create a Lambda function
- Configure the S3 bucket event notification
- Event type:
s3:ObjectCreated:* - Destination: your Lambda function
- Event type:
- Give S3 permission to invoke Lambda
- AWS adds a resource-based permission on the function
What happens
When a file is uploaded to the bucket, S3 sends an event to Lambda, and your code runs automatically—no servers to manage.
Example use cases
- Resize uploaded images
- Scan files for malware
- Extract metadata
- Move/rename files
- Start downstream workflows
Other serverless options
- S3 → EventBridge → Lambda if you want more routing/filtering
- S3 → SNS/SQS if you want buffering or fan-out before processing
Notes
- S3 notifications are for events, not polling.
- For large or bursty workloads, SQS in between can help with reliability and throttling.
- Make sure your Lambda is in the same AWS region as the bucket, or follow the supported cross-region pattern.
If you want, I can give you:
- a console walkthrough,
- an AWS CLI example, or
- a Terraform/CloudFormation snippet.