By the end you'll know
- What Lambda runs, what you pay for, and what the free allowance covers
- What a function's role is, and why the lab's role can do exactly two things
- What a cold start is, and that it's billed
- Why a function's crash comes back as a successful call, and how to tell
- How memory buys speed, and how to find the cheapest size
- How another service, here S3, runs a function for you, and what happens when a background run fails
Before you start
- You need: the
juniper-ryeprofile from Lesson 4, signed in, and Lesson 20's virtual environment, which has boto3. - The script:
lambda-lab.pyfrom the practice folder'slesson-21. Everything it creates is namedjr-lesson21-*and taggedlesson=21, and itsdeletestep removes it. - How the script talks to AWS: only through boto3, as in Lesson 20. The function itself also uses boto3, inside Lambda, with no keys anywhere.
- To see every call the script makes that changes something, put
SHOW=1in front of any step. The "By hand" section has the same lab as AWS CLI commands. - Where you run things: your own machine, labeled (Your machine). The function runs in AWS.
- Every output below is from real runs on November 13, 2026.
A function can trigger itself
If a function writes to the bucket, queue or table that triggers it, each write runs it again, and the loop runs as fast as Lambda can scale, billing every run. The lab's bucket only sends files under orders/ to the function, and the function writes to a table, not back to the bucket. Keep triggers and outputs apart like that, and keep the budget alarm from Lesson 2 on.
The short version
- Lambda runs your code when something asks it to, and you pay per run and per millisecond, times the memory you chose. Nothing runs, or bills, in between.
- The first run in a new environment is a cold start, and since August 2025 it's billed.
- A function's role decides what its code may do. Give it only what it needs.
- A crash isn't an error to the caller: the call succeeds, with
FunctionErrorset. - Memory brings CPU with it. More memory can be faster and cheaper; measure it.
- Background runs that fail are tried three times in all, then dropped, unless you give Lambda somewhere to send them.
What this lesson costs
| Part | Cost, in us-east-2 |
|---|---|
| Lambda runs | $0.20 per million |
| Lambda compute, on Arm | $0.0000133334 per GB-second |
| Free every month, on the free plan too | 1 million runs and 400,000 GB-seconds |
| The lab's runs | About 30 runs and under 20 GB-seconds: inside the free allowance |
| The table, the bucket and the logs | Under 1 cent |
| This lesson | $0 for Lambda, under 1 cent in all |
Code without a server
Every lab so far has built something that sits and waits: an instance, a database, a load balancer. They bill by the hour whether anyone uses them or not. Lambda is the other way round. You give it a function, and it runs the function when something asks: a call from a script, a file landing in S3, a message on a queue, a schedule. Between runs, nothing is running and nothing is billed.
| Part | Is | In the lab |
|---|---|---|
| Function | Your code, its runtime and its settings | jr-lesson21-new-order |
| Handler | The function Lambda calls on each run, named file.function | app.handler |
| Runtime | The language and version AWS keeps patched for you | Python 3.13 |
| Architecture | The processor: x86, or Arm (Graviton), which costs 20% less | Arm |
| Event | The JSON a run is given | |
| Execution role | The IAM role the code runs as | May write its logs and add items to one table |
| Memory | 128 MB to 10,240 MB; CPU comes with it | 128 MB, and four sizes compared |
| Timeout | How long a run may take, up to 15 minutes | 10 seconds |
| Trigger | A service that runs the function for you | An S3 bucket |
Is it allowed, and what does it cost?
(Your machine)
cd ~/Apps/aws-practice/lesson-21
source ../lesson-20/.venv/bin/activate
python lambda-lab.py fence
== Is this allowed in us-east-2?
Lambda allowed
IAM roles allowed
CloudWatch Logs allowed
DynamoDB allowed
S3 allowed
== What Lambda costs, in us-east-2, on Arm (Graviton)
a run: $0.20 per million
compute: $0.0000133334 per GB-second (memory in GB x seconds run)
free every month, on the free plan too: 1 million runs and 400,000 GB-seconds
this lab: about 30 runs and under 20 GB-seconds: inside the free allowance, so $0
the table, bucket and logs: under 1 cent
A GB-second is one gigabyte of memory for one second. A 128 MB function running for one second uses 0.125 GB-seconds, so the free 400,000 GB-seconds are 3.2 million seconds at 128 MB, every month. The prices come from AWS's Price List API, as in Lesson 15. Lambda's allowance is one of AWS's always-free offers: it doesn't end with the free plan's credits.
The function, and who it runs as
In the console: Lambda > Functions > Create function > Author from scratch, then Configuration > Permissions for the role.
python lambda-lab.py build
== The orders table
ready
== The log group, made first so it's kept 1 day, not forever
/aws/lambda/jr-lesson21-new-order, kept 1 day
== The function's role: who it runs as, and what it may do
may: write its own logs, and put items in jr-lesson21-orders. Nothing else.
== The function: Python 3.13 on Arm, 128 MB, 10-second timeout
the new role isn't usable yet; retrying every 3 seconds
the role was usable after 3 retries, 10 seconds
state right after create_function: Pending
state after the waiter: Active (14.0 seconds)
== jr-lesson21-new-order
runtime python3.13, arm64, 128 MB, timeout 10 s, package 662 bytes
Here's the whole function, 662 bytes once zipped:
import hashlib
import json
import os
import time
import urllib.parse
import boto3
ddb = boto3.client("dynamodb")
TABLE = os.environ["TABLE"]
STARTED = time.time()
runs = 0
def save(order, item, via):
ddb.put_item(TableName=TABLE, Item={"order": {"S": str(order)}, "item": {"S": item}, "via": {"S": via}})
print(json.dumps({"saved": order, "item": item, "via": via}))
def handler(event, context):
global runs
runs += 1
if "Records" in event:
for r in event["Records"]:
key = urllib.parse.unquote_plus(r["s3"]["object"]["key"])
save(key.rsplit("/", 1)[-1].split(".")[0], "from a file", "s3")
return {"saved": len(event["Records"])}
if "work" in event:
h = b"rye"
for _ in range(event["work"]):
h = hashlib.sha256(h).digest()
return {"hashes": event["work"]}
if "wait" in event:
time.sleep(event["wait"])
save(event["order"], event.get("item", "sourdough"), "invoke")
return {"saved": event["order"], "run_in_this_environment": runs,
"environment_age_seconds": round(time.time() - STARTED, 1)}
| Part | Does |
|---|---|
Everything above handler() | Runs once per environment, on its cold start: imports, the DynamoDB client, reading TABLE |
handler(event, context) | Runs on every run. event is the JSON it was given; context has the request ID and time left. |
boto3.client("dynamodb") | No profile and no keys: inside Lambda, boto3 takes the execution role's temporary credentials, as Lesson 20's table promised |
os.environ["TABLE"] | An environment variable set on the function, so the code doesn't hard-code the table name |
print() | Anything printed goes to the function's log in CloudWatch Logs |
"Records", "work", "wait" | The S3 trigger, the memory test and the timeout test, later in the lab |
The role is the function's permissions, and it's the part that matters most. Lambda takes on the role for every run, so the code can do whatever the role allows and nothing else. The lab's role has two statements:
{"Effect": "Allow", "Action": ["logs:CreateLogStream", "logs:PutLogEvents"],
"Resource": "arn:aws:logs:us-east-2:111122223333:log-group:/aws/lambda/jr-lesson21-new-order:*"},
{"Effect": "Allow", "Action": "dynamodb:PutItem",
"Resource": "arn:aws:dynamodb:us-east-2:111122223333:table/jr-lesson21-orders"}
The console's default role uses AWS's AWSLambdaBasicExecutionRole policy, which may write to any log group in the account. Fine to start; narrower is better. If the function's code had a bug, or a dependency was compromised, this role could still only add orders to one table.
Three things in the output are worth a second look:
- The role needed 10 seconds and 3 retries before Lambda would take it on. IAM changes take a few seconds to reach every service, as Lesson 19 found with AWS Backup. Lambda says "The role defined for the function cannot be assumed by Lambda," and the script waits and tries again.
- The function was
Pending, thenActiveafter a waiter. Calling aPendingfunction fails. Lesson 20's waiters again. - The script made the log group itself, kept 1 day. Lambda would otherwise make one the first time the function logs, kept forever, billed per GB stored.
A cold start, then a warm one
In the console: the function > Test, with an event like {"order": 1001, "item": "sourdough"}.
python lambda-lab.py invoke
== Run 1: order 1001
returned: {"saved": 1001, "run_in_this_environment": 1, "environment_age_seconds": 0.2}
cold start: 279 ms to start a new environment and run the code above handler()
handler ran: 233.2 ms, billed 512 ms (the cold start is billed too)
memory: 91 MB used of 128 MB
cost: $0.000001053, or $1.05 per million runs like it
== Run 2: order 1002
returned: {"saved": 1002, "run_in_this_environment": 2, "environment_age_seconds": 0.3}
warm start: reused the environment from run 1
handler ran: 23.6 ms, billed 24 ms
memory: 91 MB used of 128 MB
cost: $0.000000240, or $0.24 per million runs like it
== In the table
order 1002: rye, via invoke
Run 1 was billed 512 ms: 279 ms of cold start plus 233 ms of handler. Lambda had to start a new environment, load Python, and run everything above handler(), including importing boto3. Since August 1, 2025, that start-up time is part of the billed duration for every function. The handler itself took 233 ms because its first call to DynamoDB had to open a connection.
Run 2 reused the same environment: run_in_this_environment is 2, the DynamoDB client was already connected, and it took 24 ms, a tenth of the time and a quarter of the cost. Lambda keeps an environment around for a while after a run, usually minutes, and sends the next run to it if it's free. When runs arrive at the same time, Lambda starts more environments, each with its own cold start.
| Field | Run 1 | Run 2 | Means |
|---|---|---|---|
| Init Duration | 279 ms | none | The cold start. Missing means warm. |
| Duration | 233.2 ms | 23.6 ms | The handler's run |
| Billed Duration | 512 ms | 24 ms | What you pay for: start-up plus handler, rounded up to the next millisecond |
| Max Memory Used | 91 MB | 91 MB | How much of the 128 MB was used |
The script asks for the last 4 KB of each run's log with LogType="Tail" and reads the REPORT line Lambda writes at the end of every run. Put slow set-up above the handler, where it runs once per environment, not on every run: clients, configuration, anything that can be reused.
When it fails
python lambda-lab.py errors
== 1. An order with no order number
HTTP status: 200 (the call worked; the function didn't)
FunctionError: Unhandled
errorType: KeyError
errorMessage: 'order'
== 2. An order that takes longer than the 10-second timeout
FunctionError: Unhandled, after 10.1 seconds
errorType: Sandbox.Timedout
errorMessage: Error: Task timed out after 10.00 seconds
billed: 10000 ms: a timeout is paid for in full
== 3. A function that doesn't exist
ClientError: ResourceNotFoundException, HTTP 404
message: Function not found: (an ARN)
== 4. A bad order sent to run in the background (InvocationType=Event)
HTTP status: 202: accepted, and nothing more is known yet
FunctionError: None
Lambda runs it, it fails, and Lambda tries twice more, about 1 and 2 minutes apart.
Run the logs step in 4 minutes to see all three attempts.
Error 1 is the one that catches people out: the code crashed, and boto3 raised nothing. The call to Lambda worked, so it returned HTTP 200; the function's crash is reported inside the response, in FunctionError and a JSON body with errorType and errorMessage. A script that only catches ClientError, as Lesson 20 taught, would treat the crash as success. Check the response:
r = lam.invoke(FunctionName=FN, Payload=json.dumps(event).encode())
body = json.loads(r["Payload"].read())
if "FunctionError" in r:
raise RuntimeError("%s: %s" % (body["errorType"], body["errorMessage"]))
| Failure | Comes back as | Teaches |
|---|---|---|
| 1. The code crashed | HTTP 200, FunctionError | Check the response, not just for exceptions |
| 2. Too slow | HTTP 200, Sandbox.Timedout | Lambda stops the run at the timeout, and bills all 10 seconds. A timeout set too high pays for every hung run. |
| 3. No such function | ClientError, HTTP 404 | Lambda itself refused, so this one is an exception |
| 4. Crashed in the background | HTTP 202, nothing else | The caller can't know. The next section watches what happens. |
What happens to a failed background run
Most triggers don't wait for an answer. S3, SNS (Simple Notification Service) and EventBridge call functions in the background, like error 4: Lambda puts the event on a queue, answers 202, and runs it later. The retries step sends one bad order that way, then watches the logs and Lambda's own counts:
python lambda-lab.py retries
== A bad order sent to run in the background: HTTP 202, request req-3008
watching the logs every 15 seconds, for up to 6 minutes, then a minute more for the counts
== Every run of the function since then
attempt 1: 23:40:01, 1 seconds after sending, request req-3008 (the ID it was sent with)
attempt 2: 23:41:08, 68 seconds after sending, request req-3008 (the ID it was sent with)
attempt 3: 23:43:05, 184 seconds after sending, request req-3008 (the ID it was sent with)
then Lambda gives up, and the order is dropped: nothing kept it
== Every log line since sending
23:40:01 INIT_START Runtime Version: python:3.13.mainlinev2.v86 Runtime Version ARN: (an ARN)
23:40:01 START RequestId: 3008177c-120f-437c-a20e-a13bb7bbb8dd Version: $LATEST
23:40:01 [ERROR] KeyError: 'order' Traceback (most recent call last): File "/var/task/app.py", line 35, [...]
23:40:01 END RequestId: 3008177c-120f-437c-a20e-a13bb7bbb8dd
23:40:01 REPORT RequestId: 3008177c-120f-437c-a20e-a13bb7bbb8dd Duration: 13.38 ms Billed Duration: 272 [...]
23:41:08 START RequestId: 3008177c-120f-437c-a20e-a13bb7bbb8dd Version: $LATEST
23:41:08 [ERROR] KeyError: 'order' Traceback (most recent call last): File "/var/task/app.py", line 35, [...]
23:41:08 END RequestId: 3008177c-120f-437c-a20e-a13bb7bbb8dd
23:41:08 REPORT RequestId: 3008177c-120f-437c-a20e-a13bb7bbb8dd Duration: 6.87 ms Billed Duration: 7 ms [...]
23:43:05 START RequestId: 3008177c-120f-437c-a20e-a13bb7bbb8dd Version: $LATEST
23:43:05 [ERROR] KeyError: 'order' Traceback (most recent call last): File "/var/task/app.py", line 35, [...]
23:43:05 END RequestId: 3008177c-120f-437c-a20e-a13bb7bbb8dd
23:43:05 REPORT RequestId: 3008177c-120f-437c-a20e-a13bb7bbb8dd Duration: 13.02 ms Billed Duration: 14 [...]
== Lambda's own counts for this function, per minute (metrics can lag a minute or two)
background settings: the defaults (none set on the function)
Invocations 23:40 1, 23:41 1, 23:43 1
Errors 23:40 1, 23:41 1, 23:43 1
AsyncEventsReceived 23:40 1
AsyncEventsDropped 23:43 1
AsyncEventAge 23:40 124, 23:41 67663, 23:43 183829
Three attempts, about one and two minutes apart, all with the same request ID, then the order was dropped. One event was received, three runs failed, and one event was dropped. AsyncEventAge is how long the event had waited, in milliseconds: a tenth of a second, then about a minute, then about three. Only the first attempt was a cold start (INIT_START); the retries found the environment still warm.
A dropped event is gone. For a bakery that means a lost order and no one told. Two settings change that:
| Setting | Default | Does |
|---|---|---|
| Maximum retry attempts | 2 | 0 to 2 retries after a crash or timeout |
| Maximum event age | 6 hours | How long an event may wait, when Lambda is throttled, before it's dropped |
| On-failure destination | None | Where a dropped event goes instead: an SQS queue, SNS topic, S3 bucket, EventBridge bus or another function. Lesson 23. |
A retried event runs your code again, so the code must be safe to run twice. Here a retry would just save the same order again, because put_item with the same key replaces it. A function that charged a card or sent an email on every run would do it three times.
The logs step prints the last 15 minutes of the function's log, the same lines as above. In the console: the function > Monitor > View CloudWatch logs. CloudWatch is Lesson 32.
More memory, less money
In the console: the function > Configuration > General configuration > Edit > Memory.
python lambda-lab.py memory
== 300,000 SHA-256 hashes, at four memory sizes (each run is the second, warm, one)
memory billed ms GB-seconds per million runs
128 MB 3,004 0.376 $5.21
512 MB 435 0.217 $3.10
1024 MB 208 0.208 $2.97
1769 MB 171 0.295 $4.14
(set back to 128 MB)
CPU comes with memory: 1,769 MB gets one full virtual CPU, 128 MB about a fourteenth of one.
The cheapest size was 1,024 MB, eight times the memory of the smallest, and 14 times as fast. Lambda has no CPU setting: it gives CPU in proportion to memory. At 128 MB the hashing crawled through 3 seconds on a sliver of a CPU, and paid for every millisecond. At 512 MB it took a seventh of the time for four times the price per millisecond, so the run cost less. 1,769 MB was faster still, but not by enough to pay for itself, and above it Lambda adds a second CPU, up to six at 10,240 MB, which code that does one thing at a time can't use.
The cheapest size depends on the work, so measure it. A function that mostly waits on other services, like saving an order, gains little from more CPU, and the smallest size that doesn't run out of memory is usually cheapest. A function that computes, resizes images or parses big files often runs cheaper with more. The open-source AWS Lambda Power Tuning tool runs this test for you across many sizes.
Letting S3 run it
In the console: the function > Add trigger > S3, with the bucket, All object create events and the prefix orders/.
python lambda-lab.py trigger
== The inbox bucket, jr-lesson21-inbox-199212
== Letting S3 run the function, for this bucket only
added to the function's resource policy
the bucket now sends each new file under orders/ to jr-lesson21-new-order
== Three order files land in the bucket
in the table after 3 seconds: 2001, 2002, 2003
== Everything in the table
1001 sourdough via invoke
1002 rye via invoke
2001 from a file via s3
2002 from a file via s3
2003 from a file via s3
Three files uploaded, three orders in the table within 3 seconds, and no script calling the function. Two settings made it work, one on each side:
| Setting | On | Says |
|---|---|---|
| Resource policy | The function | S3 may run it, for this one bucket in this account only |
| Event notification | The bucket | Send each new object under orders/ to the function |
That's two different kinds of permission. The execution role is what the function may do; the resource policy is who may run the function. S3 runs it in the background, as in the last section, so a file that made the function crash would be tried three times, then dropped. The orders/ prefix also keeps the loop in the warning box from happening if the function ever writes files back to the bucket under another prefix.
Take it down
In the console: empty and delete the bucket; delete the function; in CloudWatch > Log groups, delete its log group; in IAM > Roles, delete the role; delete the table.
python lambda-lab.py delete
== Emptying and deleting jr-lesson21-inbox-199212
== Deleting the function jr-lesson21-new-order
== Deleting the log group
== Deleting the role
== Deleting the table
== Anything left from Lesson 21
nothing: all clear
Deleting a function leaves its log group behind, and a role you made for it, which is why the script deletes both itself. Orphaned log groups kept forever are one of the most common small costs in an AWS account.
By hand: the same lab with the AWS CLI
The same lab without the script, in order. (Your machine) Save the function above as app.py, and the two policies as trust.json and access.json, with your own account ID in access.json.
export AWS_PROFILE=juniper-rye AWS_REGION=us-east-2
F=jr-lesson21-new-order
aws dynamodb create-table --table-name jr-lesson21-orders --billing-mode PAY_PER_REQUEST \
--attribute-definitions AttributeName=order,AttributeType=S --key-schema AttributeName=order,KeyType=HASH
aws logs create-log-group --log-group-name /aws/lambda/$F
aws logs put-retention-policy --log-group-name /aws/lambda/$F --retention-in-days 1
aws iam create-role --role-name jr-lesson21-role --assume-role-policy-document file://trust.json
aws iam put-role-policy --role-name jr-lesson21-role --policy-name new-order --policy-document file://access.json
zip function.zip app.py
aws lambda create-function --function-name $F --runtime python3.13 --architectures arm64 \
--handler app.handler --zip-file fileb://function.zip --memory-size 128 --timeout 10 \
--role "$(aws iam get-role --role-name jr-lesson21-role --query Role.Arn --output text)" \
--environment Variables={TABLE=jr-lesson21-orders}
aws lambda wait function-active-v2 --function-name $F
aws lambda invoke --function-name $F --cli-binary-format raw-in-base64-out \
--payload '{"order": 1001, "item": "sourdough"}' --log-type Tail response.json
cat response.json
aws lambda invoke --function-name $F --invocation-type Event --cli-binary-format raw-in-base64-out \
--payload '{"item": "croissant"}' response.json
aws logs tail /aws/lambda/$F --since 15m --follow
aws lambda update-function-configuration --function-name $F --memory-size 1024
aws lambda wait function-updated-v2 --function-name $F
aws lambda delete-function --function-name $F
aws logs delete-log-group --log-group-name /aws/lambda/$F
aws iam delete-role-policy --role-name jr-lesson21-role --policy-name new-order
aws iam delete-role --role-name jr-lesson21-role
aws dynamodb delete-table --table-name jr-lesson21-orders
trust.json lets Lambda take on the role:
{"Version": "2012-10-17", "Statement": [{"Effect": "Allow", "Action": "sts:AssumeRole",
"Principal": {"Service": "lambda.amazonaws.com"}}]}
--cli-binary-format raw-in-base64-out lets you pass the event as plain JSON; without it, CLI version 2 expects it base64-encoded. --log-type Tail returns the end of the log, base64-encoded, in the command's output, and aws logs tail --follow streams the log as it's written: press Ctrl+C to stop.
In real systems
- Functions are built and deployed by a pipeline, with their code, role and triggers in Terraform (Lesson 28) or AWS SAM, never zipped by hand.
- Every function has its own role, with only the actions and resources it needs.
- Background functions have an on-failure destination and an alarm on errors, so a dropped event is seen.
- Code is safe to run twice, because retries and duplicate events happen.
- Log groups have a retention period, and logs are structured JSON so they can be searched (Lesson 32).
- Memory is chosen by measuring, and Arm is the default unless a library needs x86.
- Lambda is for short work that comes and goes. A steady load running all day is often cheaper on containers (Lesson 27).
Spot the problem
Work out what's wrong before you read the explanation.
"Some online orders never reach the kitchen, and nothing shows an error." Each order lands as a file in S3, which runs a function that saves it. A batch of orders with an unusual product code goes missing; the function's logs show three KeyErrors for each, and the shop's monitoring shows nothing. What's wrong? S3 runs the function in the background, so after three failed attempts Lambda drops each order, and nothing was set up to keep it or raise an alarm. The fix: give the function an on-failure destination, such as an SQS queue, and an alarm on its Errors metric, then fix the code and replay the kept orders. Then check: send a bad order on purpose; does it appear in the queue after the third attempt, and does the alarm fire?
Keep this
| Remember | Why |
|---|---|
| Pay per run and per GB-second | Nothing bills between runs; 1 million runs and 400,000 GB-seconds a month are free |
| Cold starts are billed | Run 1 billed 512 ms for a 233 ms handler |
| Set-up above the handler | It runs once per environment; the warm run took 24 ms |
| One role per function, as narrow as you can | The role is everything the code can do |
A crash is HTTP 200 with FunctionError | Exceptions only cover Lambda refusing the call |
| A timeout bills the full timeout | Set it close to what the work needs |
| Memory brings CPU | 1,024 MB was cheaper than 128 MB |
| Background failures: 3 attempts, then dropped | Unless there's an on-failure destination |
| Make your own log group with retention | The default keeps logs forever |
Where you are now
Juniper & Rye has its first serverless code: a function that saves each order, run by a script and then by S3 the moment an order file lands, with a role that can do two things and nothing else. You measured a cold start and saw it billed, watched a crash come back as a successful call, paid for a full timeout, found that more memory was cheaper, and followed one failed background order through three attempts until Lambda dropped it. Next, Lesson 22 puts the function behind a web address with API Gateway, so the bakery's website can send orders straight to it.
Check yourself
Run 1's handler took 233 ms. Why was it billed 512 ms?
The function crashed with a KeyError. What did lam.invoke() do?
Which memory size was cheapest for the hashing work?
What does the function's execution role control?
A background run kept failing. What happened to the event?
An order took longer than the 10-second timeout. What was billed?
What let S3 run the function?
Key terms
- Lambda: AWS's service for running code on demand, without managing servers.
- Function: code, its runtime and its settings, run by Lambda.
- Handler: the function in your code Lambda calls on each run.
- Event: the JSON a run is given.
- Execution role: the IAM role a function's code runs as.
- Resource policy: the function's list of who may run it.
- Cold start: starting a new environment before a run; billed since August 2025.
- Warm start: a run in an environment that's already started.
- GB-second: one gigabyte of memory for one second; how Lambda measures compute.
- Synchronous and asynchronous invocation: the caller waits for the answer, or Lambda queues the event and answers 202.
- On-failure destination: where Lambda sends a background event that failed every attempt.
- Trigger: a service set up to run a function, like an S3 event notification.
Go deeper
- Python track: Functions and errors.
- AWS: the Lambda developer guide (opens in a new tab), Lambda pricing (opens in a new tab), and the execution role (opens in a new tab).
- AWS: how Lambda handles errors and retries with asynchronous invocation (opens in a new tab), and standardized billing for the INIT phase (opens in a new tab).
- Try: run
build, then give the function an on-failure destination withaws lambda put-function-event-invoke-configand an SQS queue (Lesson 23 builds one properly), send a bad order in the background, and find it in the queue about three minutes later. Rundelete, and delete the queue, when you're done.