Amazon API Gateway with an API Key

API Gateway REST API

Create a REST API Gateway with an API Key associated with a Usage Plan.

An API Key is created and added to a Usage Plan (no throttling, no quota). This Usage Plan is then associated with the Prod stage of a REST API.
The GET method of this REST API is configured to require an API Key associated with the Usage Plan.
If the API key is provided, then API Gateway allows the request and sends it to the Lambda integration.
If the API is not provided, API returns a 403 Forbidden.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Launch Stack

Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/apigw-api-key

Deploy

sam deploy --guided


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: sam delete.

Additional resources

Created by:

Albert Blaya

Albert Blaya

Albert is a Solutions Architect at Amazon Web Services based in Australia.

Follow on LinkedIn