1.1.6 Create, Extend, and Maintain APIs

API Gateway

API Types

TypeUse CaseFeatures
REST APIFull-featured APIsWAF, request validation, caching, resource policies
HTTP APISimple, low-latencyJWT authorizer, cheaper, faster
WebSocket APIReal-time two-wayChat, gaming, streaming

Request/Response Transformations

  • Mapping templates (VTL — Velocity Template Language)
  • Request validation (body, parameters, headers)
  • Response status code overriding

Validation

  • Request validators: body, query string parameters, headers
  • Models (JSON Schema) cho request/response validation

Proxy vs Non-Proxy Integration

Proxy IntegrationNon-Proxy Integration
RequestToàn bộ request → LambdaMapping template transform
ResponseLambda trả về format chuẩnMapping template transform
FlexibilityÍtNhiều
ComplexityĐơn giảnPhức tạp

Exam Tip: Lambda Proxy Integration là phổ biến nhất. Response format bắt buộc: statusCode, headers, body.