AWS Lambda: Core Features and Configuration
What you'll learn: How AWS Lambda's execution environment, runtime options, memory/CPU allocation, timeout settings, and ephemeral storage work together to power your serverless functions.
The Lambda Execution Environment
AWS Lambda runs your code inside a secure, isolated execution environment—think of it as a temporary container that spins up when needed. Each environment includes:
- A runtime (the language interpreter: Node.js, Python, Java, Go, .NET, Ruby, or custom)
- A
/tmpdirectory for ephemeral storage (up to 10 GB) - Environment variables for configuration
- Network access (VPC optional)
Key Configuration Settings
Memory and CPU Allocation
Lambda allocates CPU power proportionally to memory. Setting memory from 128 MB to 10,240 MB automatically scales CPU from 0.08 to 6 vCPUs. More memory = faster execution but higher cost per millisecond.
Analogy: It's like renting a car—choosing a bigger engine (more memory) gives you more horsepower (CPU) automatically.
Timeout Settings
You can configure functions to run from 1 second to 15 minutes maximum. Set this based on expected execution time to avoid unnecessary charges for hung functions.
Ephemeral Storage (/tmp)
Functions get 512 MB of /tmp storage by default (configurable up to 10 GB). This is temporary scratch space that persists only during the execution environment's lifetime. Use it for caching files or intermediate data processing—never for permanent storage.
Runtime Selection
Choose your runtime based on your code language. Lambda supports multiple versions of each runtime, but remember: older versions eventually reach end-of-life and require migration.
Key Takeaway: Lambda's configuration triangle—memory/CPU, timeout, and ephemeral storage—must be balanced based on your function's workload, with runtime selection matching your code's language requirements.