AWS API Gateway HTTP

feature image

(Continue from https://www.teachonetofish.net/aws-lambda-function-url/)

Amazon API Gateway is an AWS service for creating, publishing, maintaining, monitoring, and securing REST, HTTP, and WebSocket APIs at any scale. API developers can create APIs that access AWS or other web services, as well as data stored in the AWS Cloud. It support 4 API types:

  • HTTP API
  • WebSocket API
  • REST API
  • REST API (Private)

HTTP API

HTTP APIs are designed with minimal features so that they can be offered at a lower price. It is used to “Build low-latency and cost-effective REST APIs with built-in features such as OIDC and OAuth2, and native CORS support.”

It works with Lambda or HTTP backends(EC2 or containers).

Go to API Gateway -> Choose HTTP API -> Build

In Create an API page, choose “Add Integrations” -> Lambda -> Choose your Lambda Function -> Add an API name.

In Configure routes, it automatically adds Resource path. (Don’t change)

In Define stages, it adds a default Stage name “$default”. (Don’t change)

Review and create

You can see the API Gateway URL.

Invoke the URL and you will see an error.

It is because we defined the route will be “/redirect-url”. So you need to add it at the end of your URL.

https://o4qy78y6l0.execute-api.ap-east-1.amazonaws.com/redirect-url

,