Development with AWS Services

An Amazon API Gateway REST API uses Lambda proxy integration, and a successfully executed function returns HTTP 200 with a business-error message in its body. Clients must receive HTTP 409 for that condition while retaining proxy integration; what should the developer change?

Show the answer

Correct answerD. Set statusCode to 409 in the function's proxy response for that condition.

AWhy not this: Integration response selection patterns are not how Lambda proxy responses select HTTP status codes.

BWhy not this: A response model describes response data; it does not select the runtime HTTP status.

CWhy not this: A successful invocation reporting a business condition is not an API Gateway integration failure.

DWhy this is right: The proxy response's statusCode field tells API Gateway which HTTP status to return.

With Lambda proxy integration, the function's response statusCode determines the HTTP status returned to the client. Integration response selection patterns apply to non-proxy integrations, not this proxy response.