Difference between revisions of "API KEY"

Line 35: Line 35:
  
  
https://datanextsolutions.com/wp-content/uploads/2018/09/create-api-key-2.png|width:500
+
https://datanextsolutions.com/wp-content/uploads/2018/09/create-api-key-2.png||width:500
  
  

Revision as of 01:55, 16 July 2019

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

api-endpoints.png

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.

overview-lambda.png

Before API key protection you can call the API using the browser or Postman

api-no-security.png

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

create-api-key.png


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/