APIs

Nitric APIs are deployed to AWS using Amazon API Gateway.

AWS Resources

The following resources are created when deploying APIs to AWS:

  • API Gateway v2 HTTP APIs
  • API Gateway v2 Stages
  • API Gateway Integration
  • Lambda Functions
  • ECR Images
  • IAM Policies

Deployment

During deployment Nitric's CLI builds your API's routes, methods and handlers:

  • Files containing handler functions, such as api.post(), are built into container images
  • Built container images are pushed to the Amazon Elastic Container Registry as private images
  • Functions in AWS Lambda are created to run the container images
  • All route/handler mappings are built into an Open API v3 definition file (as required by Amazon API Gateway)
  • Lambda ARNs are injected into the API definition using the x-amazon-apigateway-integration object, creating an API Gateway Integration for each.
  • The API definition is deployed as an API Gateway v2 HTTP API, using the $default stage name
  • IAM policies are created enabling API Gateway to execute the Lambdas