Introduction to serverless computing with AWS API Gateway
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 is true for all serverless solutions, at least on AWS.
AWS API Gateway is an important service in the AWS Serverless Platform to ensure proper communication of deployed services (e.g., AWS Lambda) with the Internet in a secure and effective manner.
The service establishes communication, so to speak, from the web to your backend services so 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 benefits?
As with other serverless solutions, you only pay when you use the service, giving you tremendous cost flexibility and making unused resources a thing of the past. You only pay for API calls and outbound data transfer, and if your service is heavily used, there is a tiered pricing system to reduce costs.
However, let’s take a closer look at the different types to understand how the service can facilitate our work and where the possible applications are.
Which APIs are available?
Basically, a distinction is made between RESTful APIs and WEBSOCKET APIs. In the case of RESTful APIs, a differentiation is also made between HTTP APIs and REST APIs.
RESTful APIs are optimized for serverless workloads and HTTP backends. If you only need API proxy functions, opt for the HTTP API, and if the use case also requires management functions, opt for the REST API. Basically, both are HTTP-based, provide stateless client-server communication, and use standard HTTP methods such as GET, POST, PUT, PATCH, and DELETE as implemented in the service. HTTP APIs can be considered entry-level with basic functionality. Once you need additional features like API keys, usage throttling, caching, private API endpoints, or AWS WAF integration, the RESTful API is the preferred solution.
WEBSOCKET APIs go one step further by enabling bidirectional real-time communication. The gateway maintains a permanent connection and takes control of the message transfer between client and cloud backend. This is done with stateful VOLLDUPLEX communication. Chat applications and streaming dashboards are examples of the use of the WEBSOCKET API.
If you are interested further, we recommend that you take a look 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