3.4.2 API Gateway Stages and Custom Domains

API Gateway Stages and Custom Domains

Stages

https://api-id.execute-api.region.amazonaws.com/dev/
https://api-id.execute-api.region.amazonaws.com/prod/
  • Per-stage: throttling, caching, logging, variables
  • Canary: % traffic to new deployment

Custom Domains

api.example.com → Custom Domain → Base Path Mapping
  /v1 → Stage: v1
  /v2 → Stage: v2
  • ACM certificate (same region or us-east-1 for edge)
  • Route 53 alias record
  • Base path mapping: URL → stage

Stage Variables

${stageVariables.tableName}  → orders-dev / orders-prod
${stageVariables.lambdaAlias} → dev / prod

Exam Tip: Custom domains need ACM cert. Base path mapping for versioning. Stage variables for per-env config.