API KEY
Contents
Protect AWS API Gateway Endpoints using API Keys
Overview
AWS API Gateway offers various ways to protect API endpoints, most recently AWS announced Private Endpoints which are only accessible from VPC. In addition to that, you can protect APIs using the following methods
- Custom Authorizers
- API Keys
- Client Certificates
- Or a combination of these
In this post, we will cover the API keys method only. Using API keys you can also create Usage Plans which allows you to enable Throttling and Quota on the APIs.
API Keys
Example
In this example, we have an AWS lambda function which is exposed using the AWS API Gateway endpoint, we will protect the endpoint using API keys and test it using Postman tool. The API is called My API with a resource called hello and a GET method calling Lambda function hello-lambda as shown on the slide.
Before API key protection you can call the API using the browser or Postman
Create API Keys
The first step is to create API Keys, the steps are simple
- Log in to AWS Console and AWS API Gateway
- Click on API Keys then from the Actions drop-down list select Create API key
- Enter required API key name and description
https://datanextsolutions.com/wp-content/uploads/2018/09/create-api-key-2.png%7C%7Cwidth:500
original source : https://datanextsolutions.com/blog/protect-aws-api-gateway-endpoints-using-api-keys/