capabilities.work

Provision a Metered REST API

A 6-step recipe with Amazon API Gateway. We can help you get access.

Recipe · 6 steps

Provision a Metered REST API

Create a REST API, attach a key-aware method, and branch into metering when required.

  1. Create the REST API container.
  2. List resources to obtain the root resource id.
  3. Attach the method to the root resource, honoring the api-key requirement.
  4. Create an API key to meter access to the key-protected method.
  5. Create a usage plan to govern the API key.
  6. Create a deployment to publish the API to the named stage.
What you'll need to have ready
  • name: Name of the new REST API.
  • httpMethod: HTTP verb to add to the root resource.
  • authorizationType: Authorization type for the method.
  • apiKeyRequired: Whether the method requires an API key.
  • keyName: Name of the API key to create when one is required.
  • planName: Name of the usage plan to create when a key is required.
  • stageName: Stage to deploy the API to.
For your developer

Arazzo workflow aws-api-gateway:metered-rest-api, 6 operations: CreateRestApi → GetResources → PutMethod → CreateApiKey → CreateUsagePlan → CreateDeployment. Specs on APIs.io.