A scalable infrastructure in the cloud is state-of-the-art today. Function as a Service (FaaS) is the next step, allowing users to focus more on their code than their infrastructure. This applies to all serverless solutions, at least on AWS.
AWS API Gateway is a key service in the AWS Serverless platform to ensure the deployed services (such as Lambda) properly communicate with the internet in a secure and effective manner.
The service, so to speak, establishes communication from the web to your backend services so that they can access data, business logic or other functionality with up to hundreds of thousands of concurrent API calls. During this process, it manages traffic, resource sharing across multiple sources, and authorization and access control. This allows you to restrict or monitor the flow of data and have full control over the processes.
What are the advantages?
As with other serverless solutions, you only pay when you use the service, giving you tremendous cost flexibility and making idle resources a thing of the past. You only pay for the API calls and outbound data transfer, and if your service is heavily used, there’s a tiered pricing system to keep costs down.
However, let’s take a closer look at the different types to understand how the service can make our work easier and what the possible uses are.
What APIs are there?
A basic distinction is made between RESTful APIs and WEBSOCKET APIs. The RESTful APIs also differentiate between HTTP APIs and REST APIs.
RESTful APIs
RESTful APIs are optimized for serverless workloads and HTTP backends. If you only need API proxy capabilities, go for HTTP API, and if the use case also requires management capabilities, go for REST API. Basically, both are HTTP-based, provide stateless client-server communication, and use standard HTTP methods like GET, POST, PUT, PATCH, and DELETE as implemented in the service. HTTP APIs can be viewed as a gateway to basic functionality. Whenever you need additional functionality like API keys, usage throttling, caching, private API endpoints or AWS WAF integration, the RESTful API is the preferred solution.
WEBSOCKET APIs
WEBSOCKET APIs take it a step further by enabling real-time, two-way communication. The gateway maintains a permanent connection and takes control of message transfer between the client and the cloud backend. This is done with stateful FULL DUPLEX communication. Chat applications and streaming dashboards are examples of using the WEBSOCKET API.
If you are interested, we recommend looking at the Developer Guide or the resources provided by AWS, which contain tutorials, reference architectures, and other useful documents related to the AWS API Gateway.
Your PROTOS team
Related Links
Developer Guide
AWS resources
Source: https://www.protos-technologie.de/2022/10/27/einfuehrung-in-serverless-computing-mit-aws-api-gateway/