Bird
0
0

Given this AWS SAM template snippet, what will happen when the API Gateway endpoint is called?

medium📝 Predict Output Q13 of 15
AWS - API Gateway
Given this AWS SAM template snippet, what will happen when the API Gateway endpoint is called?
{
  "Resources": {
    "MyFunction": {
      "Type": "AWS::Serverless::Function",
      "Properties": {
        "Handler": "index.handler",
        "Runtime": "nodejs18.x",
        "Events": {
          "ApiEvent": {
            "Type": "Api",
            "Properties": {
              "Path": "/hello",
              "Method": "get"
            }
          }
        }
      }
    }
  }
}
AAPI Gateway triggers the Lambda function on GET /hello requests
BAPI Gateway returns a static response without calling Lambda
CLambda function is triggered only on POST requests
DThe template will fail to deploy due to missing integration
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the SAM template event

    The event defines an API trigger on path /hello with GET method linked to the Lambda function.
  2. Step 2: Understand behavior on API call

    Calling GET /hello triggers the Lambda function as defined.
  3. Final Answer:

    API Gateway triggers the Lambda function on GET /hello requests -> Option A
  4. Quick Check:

    API event with GET triggers Lambda [OK]
Quick Trick: API event with GET method triggers Lambda [OK]
Common Mistakes:
MISTAKES
  • Assuming static response without Lambda call
  • Confusing HTTP methods for trigger
  • Thinking deployment fails without explicit integration

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes