INFRASTRUCTURE LEARNINGINFRASTRUCTURE LEARNING
インフラ大全インフラ大全IT INFRASTRUCTURE / LEARNING
Infrastructure learning guide
Find a lesson or lab/

Esc to close · Search terms stay on your device

LEARNING日本語

ExerciseTopic: Lambda and API Gateway: inputs, testing and failure investigation

Lambda test event lab: distinguish inputs, returns, logs and timeouts

Accepting an invocation and completing the intended function work are separate. Change fixed conditions to compare synchronous 200 with a function error, a timeout, and asynchronous 202 with an unobserved result. No real AWS or user code is executed.

What you will learn

Separate event JSON, caller response, function return and logs; explain what a condition change establishes and what remains unverified.

Prerequisite

Know the roles of a Lambda event and handler. No AWS account or real logs are needed. No functions are created/invoked or reconfigured.

Start the exercise →

Conditions you change and assumptions you retain

The opening example invokes synchronously but the fixed handler returns an error. Compare the caller API response with the function result. Both are modeled examples from supplied conditions, not records of real traffic.

FIXED EVENT / LOCAL MODEL

Change conditions and inspect the result stage

All data is fixed and synthetic. No AWS invocation, real-log retrieval, input storage or input transmission occurs. Duration is stipulated.

1. Choose conditions

Inspect event JSON and the supported function type

Selected event JSON (fixed example)

{}
Go to results ↓

The opening fixed result is below. JavaScript enables the controls.

2. Read the result stage

Input 1 / evaluated 1

The fixed handler returns an error

Caller API response example

200: modeled synchronous invocation

Function result

Fixed function error

The fixed fail preset returns an error. Read it separately from the API 200.

Return/error example
{
  "errorType": "SyntheticExampleError"
}
Log example (synthetic)
MODEL_FIXED_HANDLER_THROW · 1s
Async retry plan

No async retry plan is shown under these conditions.

    Inspect model scope and reasoning
    Model
    lambda-fixed-1
    Reason code
    L22_FUNCTION_ERROR
    Not verified
    Real permissions, duration, invocation count, log arrival, networking or memory performance

    Sources and conditions checked →

    Separate the input, return and log

    One event can produce a return and a separate log
    One event can produce a return and a separate log1: Test event — JSON input — Fixed handler. 2: Fixed handler — Return/error — Function return. 3: Fixed handler — Synthetic log — Example log123Test eventFixed handlerFunction returnExample logOne event can produce a return and a separate log1: Test event — JSON input — Fixed handler. 2: Fixed handler — Return/error — Function return. 3: Fixed handler — Synthetic log — Example log123Test eventFixed handlerFunction returnExample log
    1. Test event → Fixed handlerJSON input
    2. Fixed handler → Function returnReturn/error
    3. Fixed handler → Example logSynthetic log
    Test event
    Choose a fixed JSON input.
    Fixed handler
    Model only the specified preset.
    Function return
    Result or error for the caller.
    Example log
    A separate synthetic record.
    JSON for the fixed area handler
    {
      "length": 6,
      "width": 7
    }

    The area preset multiplies these values when both are numbers in 0–100, returning {"area": 42}. The separate MODEL_FIXED_HANDLER_RETURN log example is synthetic. It is neither retrieved from AWS nor a built-in AWS handler.

    Compare fixed conditions by result stage

    Modeled results, not predicted real performance or counts
    ConditionModeled API responseFunction result
    Sync fail; 3-s deadline/1-s duration200Fixed function error
    Sync slow; 3-s deadline/8-s duration200Timeout
    Sync slow; 10-s deadline/8-s duration200Fixed work completed
    Sync slow; duration unknownAssume 200Deadline comparison unknown
    Async; configure 0–2 retriesAssume 202Execution after acceptance not observed

    Async retries and why results remain unverified

    The 0–2 retry setting concerns asynchronous function errors. It describes retries planned after the initial execution. Throttling/system errors and event source mappings such as SQS follow other conditions.

    Managed Instances and event source mappings are outside this evaluator. It does not impose the ordinary 900-s limit on other execution modes or invent fast/slow outcomes when duration is unknown.

    Check what the result establishes

    Choose an option to see the result and explanation.

    A synchronous Invoke has status 200 and a function error. What does it establish?
    Read the answer and reason

    Answer: Separate invocation from function outcome · Keep the conditions and the stage of the result separate.

    Choose an option to see the result and explanation.

    What can an asynchronous 202 alone establish?
    Read the answer and reason

    Answer: Acceptance, with execution outcome separate · Keep the conditions and the stage of the result separate.

    Choose an option to see the result and explanation.

    Does setting zero function-error retries guarantee no duplicate processing?
    Read the answer and reason

    Answer: No guarantee · Keep the conditions and the stage of the result separate.

    Choose an option to see the result and explanation.

    The deadline is 5s but duration is unknown. What should be recorded?
    Read the answer and reason

    Answer: Deadline comparison is unverified · Keep the conditions and the stage of the result separate.

    Choose an option to see the result and explanation.

    The area handler receives {"length": 6}. How is the missing width handled?
    Read the answer and reason

    Answer: Error in this fixed handler’s input validation · Keep the conditions and the stage of the result separate.

    Choose an option to see the result and explanation.

    Can this evaluator apply the ordinary 900-s limit to Managed Instances?
    Read the answer and reason

    Answer: Keep it outside this model’s scope · Keep the conditions and the stage of the result separate.

    Check, then explain in your own words

    1. Read the initial 200 and function error separately.
    2. Change the slow preset deadline from 3s to 10s and evaluate again.
    3. Compare async retry 0/2 and explain what is unobserved.
    Check your understanding: An async invocation returns 202 with zero retries. Does that prove success and exactly-once processing?

    No. Check acceptance, function execution and possible duplicates separately.

    202 does not establish completion, and the retry setting alone does not rule out duplicate delivery.

    Sources and conditions checked

    The official references used in this lesson are collected here with their scope, conditions and corresponding sections. Independent expert review and live AWS comparison have not been performed.