Integrations: Lambda, HTTP, and Mock
Wire API Gateway methods to Lambda proxy integrations, upstream HTTP endpoints, and mock integrations for testing.
API Gateway Integration Types Overview
Every API Gateway method needs a backend integration—the system that processes the request and returns a response. API Gateway supports five integration types: Lambda Proxy, Lambda Custom, HTTP Proxy, HTTP Custom, and Mock. HTTP APIs support only Lambda Proxy and HTTP Proxy. REST APIs support all five. Choosing the right integration determines how much control you have over the request and response transformation.
Lambda Proxy Integration
With Lambda Proxy integration, API Gateway passes the entire HTTP request to Lambda as a structured event object including headers, query strings, path parameters, body, and context. Your Lambda function is responsible for returning a properly formatted response object with statusCode, headers, and body. This is the simplest and most common pattern—no mapping templates needed, and your Lambda controls the full response.
def lambda_handler(event, context):
# event.httpMethod, event.path, event.queryStringParameters
# event.headers, event.body
user_id = event['pathParameters']['userId']
return {
'statusCode': 200,
'headers': {'Content-Type': 'application/json'},
'body': '{"userId": "' + user_id + '", "name": "Alice"}'
}All lessons in this course
- REST API vs HTTP API vs WebSocket API
- Integrations: Lambda, HTTP, and Mock
- Authorization: IAM, Lambda Authorizers, and Cognito
- Throttling, Caching, and Usage Plans