AWS Lambda is a serverless compute service that lets you run code without provisioning or managing servers. This post covers how Lambda works, supported runtimes, event sources and triggers, function configuration (memory, timeout, concurrency), cold starts, and how Lambda enables event-driven, serverless architectures on AWS.
Lambda in AWS
Why AWS Lambda?
- Amazon EC2
- Virtual Servers in the Cloud
- Limited by RAM and CPU
- Continuously running
- Scaling means intervention to add/remove servers
- Amazon Lambda
- Virtual functions - no servers to manage
- Limited by time - short executions
- Run on-demand
- Scaling is automated!
Benefits of AWS Lambda
- Easy Pricing:
- Pay per request and compute time
- Free tier of 1,000,000 AWS Lambda requests and 400,000 GBs of compute time
- Integrated with the whole AWS suite of services
- Integrated with many programming languages
- Easy monitoring through AWS CloudWatch
- Easy to get more resources per functions (up to 10GB of RAM!)
- Increasing RAM will also improve CPU and network!
AWS Lambda Pricing: example
- You can find overall pricing information here:
- Pay per calls:
- First 1 million requests are free
- $0.20 per 1 million requests thereafter ($0.00000002 per request
- Pay per duration )in increment of 1 ms)
- 400000 GB seconds of compute time per month if FREE
- == 400000 seconds if function is 1GB RAM
- == 3200000 seconds if function is 128 MB RAM
- After that $1.00 doe 600000 GB seconds
- It is usually very cheap to run AWS Lambda so it’s very popular
Lambda Hands-On
Go Lambda > Click Lambda responds to events button > click Next: Scale seamlessly > Click Create function button > Choose use a blueprint option > Choose Hello world function with python > give function name and choose create a new role with basic Lambda permissions > click create function button > Click test button > choose Create new event > put Event name> Click Save button
Lambda By Default
- By default, your Lambda function is launched outside your own VPC ( in an AWS-owned VPC)
- Therefore, it can’t access resources in your VPC (RDS, ElastiCAche, Inter ELB …)
Lambda in VPC
- You must define the VPC ID< the subnets and the security Groups
- Lambda will create an ENI(Elastic Network Interface) in your subnets
Lambda with RDS Proxy
- If Lambda functions directly access your database, they may open too many connections under high load
- RDS Proxy
- Improve scalability by pooling and sharing DB connections
- Improve availability by reducing by 66% the failover time and preserving connections
- Improve security by enforcing IAM authentication and storing credentials in Secrets Manager
- The Lambda function must be deployed in your VPC because RDS Proxy is never publicly accessible
Frequently Asked Questions
What is AWS Lambda?
AWS Lambda is a serverless compute service that automatically runs your code in response to events (like HTTP requests, S3 uploads, or DynamoDB changes) and scales from zero to thousands of concurrent executions without you managing any servers.
What is a Lambda cold start?
A cold start occurs when Lambda needs to initialize a new execution environment for your function, adding latency (typically 100ms to several seconds) to the first invocation; subsequent invocations reuse the warm container and execute faster.

