What is AWS API Gateway?
What is AWS API Gateway?
Amazon Web Services API Gateway is among the wide range of AWS services offered by Amazon. This platform allows developers to create, publish, regulate, and secure APIs. You can create Application Programming Interface (API) to access different web services, Amazon Web Services, or to access the cloud storage.
However, what is an API gateway?
An API Gateway is a software program that acts as the façade for Application Programming Interface. For defined microservices, the gateway provides a single point of entry. This is especially beneficial when the client uses multiple and incongruous APIs. One of the primary benefits that an API offers to developers is the ability to encapsulate the internal structure of an API in various forms, depending on the requirement.
This becomes possible because apart from facilitating direct requests, API gateways can be used for multiple back-end services and to amass the results.Several API gateways are available in the market; however, the best APIs have features such as authentication, load balancing, dependency resolution, security policy enforcement, cache management, and SLA management.
Benefits of Amazon API Gateway
If you are an AWS customer thinking of developing micro-services using the EC2 or Lambda, then the Amazon API Gateway encapsulates your services helping to reduce the drawback impact. Using the Management Console of AWS, you can create, regulate, oversee, and protect APIs through Amazon API Gateway.
Amazon API gateway provides several benefits for a developer looking to deploy micro-services on AWS. Below, we have listed five.
Flexible, Self-service, and Pay-as-you-go
As with all the services included in AWS, the Amazon API gateway also provides you with the option of paying as you go. The service does not require any monthly or annual subscription. There is no startup or minimum cost; you only pay for incoming calls and data processed out. To implement the API gateway, you do not have to go through the process of launching EC2 and the setup of gateway software. You can achieve it within a few minutes through the AWS Management Console.The API gateway allocates resources as the traffic towards the API increases and retracts as the traffic decreases without any manual configuration. This helps reduce the latency of incoming calls and outgoing data.
API Caching and Throttling
Instead of accessing the API backend for every call, you can enable the caching feature offered by Amazon API gateway; it will increase the performance and reduce latency. Size of the cache is the primary factor that determines the price of this service.
To avoid the misuse of API, which can create spike and overload the API, you can configure throttle and assign quota limits per API key.
The Amazon API Gateway integrates CloudWatch, an AWS monitoring service. This tool provides you with the dashboard through which you can view the matrix of incoming calls, latency, and errors.
You can set up the API to request authorization and verify request to API access with the AWS services. The Amazon API Gateway provides you with authorization options such as Identity Access Management (IAM) and AWS Lambda functions. The IAM integrated with the gateway provides several tools such as the AWS credentials to access the API – access and secret keys. The AWS Lambda function can be used to verify tokens and if validated grant access to the API.
API Lifecycle Management
The Amazon API Gateway supports multiple versions of an API allowing calling of the previous version even when the latest version has been published. The platform allows you to maintain custom domains for each API versions while the endpoints remain the same. This helps in an easy rollback to the previous version of API.
Native Code Generation
After the deployment of an API, you can test the API from your application by generating SDKs. The SDK helps the developer by automatically managing retires and detecting network or other errors.
Drawback or Cons of Amazon API Gateway
Even though the API Gateway comes with numerous benefits, it is a new introduction in the API Gateway market and more developments can be expected with the product, similar to several other AWS products. These are some of the cons of Amazon API Gateway that we hope will be addressed in the near future:
- Issues created due to 3rd-party API systems
- Complex architecture
- Problems in implementing the APIs
- Lack of operational tools
Example of Amazon API Gateway Pricing
This example demonstrates the regional API that receives 2 million calls per month, where each API call response is 2kb. The caching feature is not used. The example shows the pricing for Ireland, US East, and US West.
|Amazon API Gateway API call charges = 2 million * $3.50/million = $7.00
Total data transfer size = 2 KB * 2 million = 4 million/KB = 4 GB
Amazon API Gateway data transfer charges = 4 GB * $0.09 = $0.36
Total Amazon API Gateway charges = $7.00 + $0.36 = $7.36
The Amazon API Gateway has several benefits such as it is flexible, secure, allows easy integration with other AWS services; however, it also has some limitations. Nevertheless, the product is new and we can expect it to evolve further.