Safe Deployments with API Gateway and Lambda AutoPublishAlias

Take advantage of the automatic versioning and aliasing of your Lambdas to instantly shift traffic to your new API deployments. Rollback by repointing the problematic Lambda’s alias to the previous version.

TL;DR

  1. Use the Serverless Application Model (SAM) AutoPublishAlias parameter to have CloudFormation automatically version and alias your Lambdas upon deployment
  2. Reference your Lambda Alias from your OpenAPI definition
  3. Deploy
Continue reading “Safe Deployments with API Gateway and Lambda AutoPublishAlias”

How to use OpenAPI with API Gateway

Use an OpenAPI specification to define API Gateway APIs. This is good practice because:

  1. The specification forces you to think about the design upfront before touching code which is expensive to correct later
  2. This contract first approach allows frontend, backend, and test developers to work in parallel
  3. Endpoints can be mocked for developers to test against
  4. Serverless Application Model (SAM) uses the specification to configure the API Gateway API, this makes it living documentation, evolving alongside code and infrastructure.
Continue reading “How to use OpenAPI with API Gateway”