Loading…
While this loads — worth knowing
Redis has data structures — sorted sets, counters, pub/sub. Memcached has plain keys and nothing else.
Loading…
While this loads — worth knowing
Redis has data structures — sorted sets, counters, pub/sub. Memcached has plain keys and nothing else.
Runs your code in response to events, with no servers to manage. You pay per request and by the millisecond, and a run lasts 15 minutes at most.
Where Lambda takes you7 steps, all open
Lambda runs your code when something happens: a call to its function URL, a file landing in S3, a message on a queue. It gives each request it is handling at the same moment an execution environment of its own, adds environments as the load grows, and removes them after they sit idle. There is no server to size or patch.
It is built for short work. A run lasts 15 minutes at most, and a function gets between 128 MB and 10,240 MB of memory, with CPU in proportion. You pay for each request and for the time the code runs, to the millisecond.
You do not own a car; you take a taxi when you need a ride and pay for the trip. When a crowd arrives, more taxis come, up to the number the rank is licensed for. A taxi that has been standing cold takes a moment to start. One kept waiting with its engine running leaves at once, but you pay for it while it waits.
InvocationExecution environmentConcurrency limitCold startProvisioned concurrencyReserved concurrencyThe role must allow every call the function makes. Here that is the table, and sending to the queue for the on-failure destination. Nothing about the triggers grants those.
The triggers need permission the other way. A resource-based policy on the function lets S3 or another service, or another account, invoke it.
Capacity: 5 requests a second for each.
400 concurrent executions can take 2,000 requests a second, and 100% of that is in use.
Here every request takes 200 ms, so one environment handles five a second. Past the limit, requests are throttled: a synchronous caller gets the error back, and an asynchronous event returns to Lambda's queue to be tried again.
Reserved concurrency sets aside part of the account's concurrency for one function and caps the function there, so it cannot starve the others or flood a database. It costs nothing.
Provisioned concurrency keeps environments initialised before the requests arrive, so they skip the cold start. It is charged for as long as it is configured.
How fast it grows. Each function can add up to 1,000 execution environments every 10 seconds.
Lambda puts the event on its own queue and tells the caller it was accepted.
A free execution environment, within the function's and the account's concurrency.
The function runs. After an error or a timeout, Lambda tries twice more, about one and then two minutes apart.
An event that fails every attempt goes to the on-failure destination or dead-letter queue if one is set, and is otherwise discarded.
Pick a case to follow the event through each check.
The same event can arrive twice. Lambda's queue is eventually consistent, so write the handler to be safe when it runs twice on one event.
With an SQS trigger, handle failures on the queue. Set the dead-letter queue on the SQS queue, not on the function.
An execution role with only what the function needs. It is an IAM role that Lambda assumes. IAM Access Analyzer can generate a policy from the calls the function actually made.
Who may invoke it is a separate policy. A resource-based policy on the function grants other accounts, organisations or AWS services permission to invoke or manage it.
In a VPC only when it must be. Attached to private subnets, a function reaches resources there, such as an RDS database, and then reaches the internet only through a NAT gateway. A public subnet gives it no public IP address and no internet access.
The off switch. Setting a function's reserved concurrency to zero stops anything invoking it.
Per request, and per GB-second. You pay for the number of requests, and for how long the code runs, rounded up to the nearest millisecond and weighted by the memory you gave it.
Memory is the dial. It runs from 128 MB to 10,240 MB, and CPU comes with it.
Extras: ephemeral storage beyond what is included, and provisioned concurrency for as long as it is configured, rounded up to five minutes. Reserved concurrency is free.
A free tier of requests and duration each month applies to standard functions, not to provisioned concurrency.
Prices change, so none are printed here. Check the Lambda pricing page on aws.amazon.com.
| How it is invoked | Who waits | When the function fails | Examples |
|---|---|---|---|
| Synchronous | The caller, for the response | The caller gets the error, and retries if it wants to | The Invoke API with RequestResponse, a function URL |
| Asynchronous | Nobody: Lambda queues the event and answers at once | Two more attempts, then a destination or dead-letter queue | S3 and SNS notifications, Invoke with Event |
| Event source mapping | Lambda, which polls the source and sends batches | Up to the source: an SQS message comes back after its visibility timeout | SQS queues, Kinesis and DynamoDB streams |
| Setting | What it does | Cold starts | Extra charge |
|---|---|---|---|
| No setting | The function shares the account's unreserved pool | Possible | No |
| Reserved concurrency | Sets aside capacity for one function, and caps it there | Possible: environments are made on demand | No |
| Provisioned concurrency | Keeps environments initialised in advance | Not within what is provisioned | Yes, while it is configured |
| SnapStart | Starts from a cached snapshot of the environment | Shorter | No, for Java 11 and Java 17 |
the job takes 40 minutesNot Lambda
A run can last at most 15 minutes, 900 seconds.
the first requests after a quiet spell are slowProvisioned concurrency
Environments are initialised in advance, so requests skip the cold start. It is charged while it is configured.
one function must never use up the concurrency the others needReserved concurrency
It sets aside a share for that function and caps it there.
the function opens too many connections to the databaseReserved concurrency, as a ceiling
No more copies of the function run at once than it allows.
a function in a VPC cannot reach the internetPrivate subnets with a route to a NAT gateway
A function attached to a VPC gets no public IP address, even in a public subnet.
keep the asynchronous events that failed, to run again laterAn on-failure destination, or a dead-letter queue
After the last attempt Lambda sends the event there instead of discarding it.
how often does Lambda retry an asynchronous event that errorsTwice more
About a minute after the first failure, then two minutes after the second.
the same library in many functionsA layer
A .zip archive of shared code, extracted into /opt, up to five per function.
the function must write to a DynamoDB tableAllow it in the execution role
The role Lambda assumes decides what the code may call.
stop a function from being invoked at all, at onceSet its reserved concurrency to zero
With no concurrency, nothing can run it.
A company's order API runs on Lambda behind API Gateway. At the start of each sale, the first customers wait several seconds longer than usual for a response, although the function itself runs in under 200 ms. Which change fixes this most directly?
Each photo uploaded to a bucket must have its size and camera details read and written to a table within seconds. Uploads come in bursts with hours of nothing between them, and nobody wants a server to patch or to pay for while it sits idle. What reads each photo?
15 min a run; 128 MB to 10,240 MB of memory.1,000 per Region by default.This whole page is free right now.The AWS library is still being written, so every page of it is open to everyone while that lasts. It becomes a paid bundle later; what you read today costs you nothing.
Next: API GatewayA managed front door for APIs: REST, HTTP and WebSocket APIs that take each call, check who is calling, throttle it, and pass it to Lambda, another service or any HTTP backend.
Open API GatewayEvery fact on this page was checked against AWS’s own documentation on 15 Sept 2026. If AWS has changed something since, its page is the one to trust.