What is an API Gateway
An API Gateway is an interface that sits in between the application and the microservices. Developers use them to create, publish, maintain, monitor and secure APIs.
Without using an API Gateway you’d have to connect all your API resources directly with your user-facing applications which would make it more difficult to manage responses, implement updates to your business logic or even secure your API.
Not only will the API Gateway simplify the way you build and manage APIs but it will boost your security since you are not exposing any endpoints, minimizing the attack vector considerably
What does an API Gateway do?
An API Gateway can handle any type of interaction between your website, web or mobile application or even IoT devices and your microservices. Here are some of the most used scenarios:
What is AWS API Gateway
It’s a fully managed service that provides all the necessary tools for developers in order to create, publish, manage and secure your API regarding of scale. Amazon API Gateway will take care of all the tasks involved in accepting and processing up to hundreds of thousands of concurrent API calls, including traffic management, authorization and access control, monitoring, and API version management.
Deployable with a couple of clicks, your Amazon API Gateway will act as the single point of entry to your backend services and will handle the data management, business logic or any other type of functionality or workloads running on services like EC2, AWS Lambda and many more.
How much does AWS API Gateway cost?
Amazon API Gateway is a SaaS that’s available to all AWS users for free for the first 12 months as long as you stay under the 1 million calls per month limit. Past that 1 million requests you’ll be charged as follows:
For the first 300 million: $1 per 1 million requests and after that it is $0.90 for every 1 million calls.
That’s not it as you will also have to pay for data transfer, caching, services like Cloudwatch and AWS Lambda. Check out their pricing here.
AWS API Gateway architecture
Written in Node.js, it can be configured as the backbone of the AWS Cloud as it is the gateway between all the connected services in the AWS ecosystem.
Amazon API Gateway is a closed-source software-as-a-service (SaaS) product written in Node.js available only on AWS. Amazon API Gateway can be considered a backplane in the AWS ecosystem.
In conjuncture with AWS Lambda, the API gateway forms the client-facing part of Amazon’s serverless infrastructure. Lambda runs the code on the highly available, fully managed computing infrastructure but relies on API gateway to expose those endpoints to the required services.
To enable the serverless applications, API Gateway supports streamlined proxy integrations with AWS Lambda and HTTP endpoints.
- Build, deploy and manage APIs
- API lifecycle management
- SDK generation
- API operations monitoring
- AWS authorization
- API keys for third-party developers
Deploying an AWS API Gateway
Deploying Amazon API Gateway is done via GUI or AWS’ CLI. You need to create a new deployment and a new stage. You can think of a stage as a snapshot of the API configuration, similar to how git tag works.
To deploy the configured resources for an API to a new Stage:
_aws apigateway create-deployment --rest-api-id 1234123412 --stage-name dev --stage-description 'Development Stage' --description 'First deployment to the dev stage'_
To deploy the configured resources for an API to an existing stage
aws apigateway create-deployment --rest-api-id 1234123412 --stage-name dev --description 'Second deployment
to the dev stage'