This is a simple example demonstrating how to use an AWS Lambda function that gets triggered whenever a file is uploaded to an S3 bucket, all running locally using LocalStack.
- 🐳 Starts a LocalStack Docker container to emulate AWS services.
- 🛢️ Creates an S3 bucket named
tinyflix. - 🧾 Creates an IAM role that allows Lambda to assume execution permissions.
- 📦 Packages the Lambda function code into a zip file for deployment.
- 🚀 Deploys the Lambda function using the zipped package and assigned role.
- 🔐 Grants S3 permission to invoke the Lambda function.
- 🔁 Configures S3 event notifications to trigger the Lambda on file upload.
- ✅ Tests the setup by uploading a file to the S3 bucket and checking the Lambda logs via Docker.
- 🐳 Docker installed and running on your machine
- 🔁 LocalStack Docker image pulled (
localstack/localstack) - 🧰 AWS CLI and
awslocalinstalled (pip install awscli-local) - 📄 Your Lambda function code (e.g.,
main.py) in a local folder
✨ Looks good to go!