Triggering AWS Lambda with S3 Event Notifications

🚀 Serverless in Action: AWS Lambda + S3 Event Trigger As part of my DevOps learning, I built a simple AWS Lambda function that gets triggered whenever a file is uploaded to an S3 bucket. 👉 The function extracts key details like: Bucket name File name File size Here’s a simplified version of the script 👇 import json def lambda_handler(event, context): kp = event['Records'][0]['s3'] bucket = kp['bucket']['name'] file_name = kp['object']['key'] file_size = kp['object']['size'] print(f"Bucket: {bucket}") print(f"File: {file_name}") print(f"Size: {file_size} bytes") 💡 What I learned: ✅ How S3 event notifications trigger Lambda functions ✅ How to parse JSON event structures in Python ✅ Real-time processing of uploaded files ✅ Basics of serverless architecture 🔧 Next steps: Add error handling & logging (CloudWatch) Decode S3 object keys properly Integrate with SNS/Slack for alerts Extend to automate workflows (e.g., file validation, ETL) Serverless is powerful — no servers to manage, just focus on logic 🚀 How are you using AWS Lambda in your projects? #AWS #Lambda #Serverless #DevOps #CloudComputing #Python #S3

To view or add a comment, sign in

Explore content categories