
Day 8: AWS Lambda – Running Code Without Managing Servers
Day 8 of my 90-day AWS challenge: what serverless means, how AWS Lambda runs code in response to events, the key concepts (triggers, handlers, execution roles, timeouts), and how I created and tested my first function.
Recap of Week 1
Last week I learned the foundations: IAM, EC2, S3, VPC, and RDS. This week starts with serverless, where I write code and AWS runs it for me. The first service is AWS Lambda.
What is AWS Lambda?
Lambda runs your code in response to events without you provisioning or managing servers. AWS handles the infrastructure, scaling, and availability. You pay only for the number of requests and the time your code runs, and nothing when it is idle.
Key concepts
| Concept | What it is |
|---|---|
| Function | Your code plus its configuration |
| Runtime | The language environment, e.g. Python, Node.js, or Java |
| Handler | The method that Lambda calls when the function is invoked |
| Trigger | The event source that starts the function, e.g. an S3 upload, an API request, or a schedule |
| Execution role | An IAM role that gives the function permission to use other AWS services |
| Memory and timeout | Memory you allocate (CPU scales with it) and the maximum run time, up to 15 minutes |
Common triggers
- Amazon S3: run code when a file is uploaded
- API Gateway: build a serverless REST API
- EventBridge: run code on a schedule
- DynamoDB, SQS, SNS: react to data and messages
A simple handler (Python)
1
2
3
def lambda_handler(event, context):
name = event.get("name", "World")
return {"statusCode": 200, "body": f"Hello, {name}!"}What I practiced today
- Opened the Lambda console and chose Create function
- Selected the Python runtime and let AWS create a basic execution role
- Pasted in a small handler and clicked Deploy
- Created a test event and ran it
- Checked the logs in CloudWatch
Things to know
- Cold start: the first invocation after idle time takes a bit longer while the environment starts
- Stateless: do not rely on local memory or disk between invocations; store data in S3 or a database
- Least privilege applies: give the execution role only the permissions the function needs
- Lambda has a free monthly allowance, but check the current limits on the AWS pricing page
Key takeaways
- Serverless means no servers to manage, not no servers at all
- Lambda fits short, event-driven tasks, not long-running processes
- IAM from Day 2 matters here: the execution role controls what the function can do
Up next: Day 9
Amazon CloudWatch: logs, metrics, and alarms.
Learning AWS too? Follow along and share what you're building. #90DaysOfAWS
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article