Application Programming Interfaces (APIs) are the primary way that external users are going to make calls to your application.
Now more than ever, companies are modernizing their large legacy monolithic apps into smaller individual microservices. These microservices are loosely coupled to make your application more scalable and highly available. However, the result of using a microservice architecture is that more API calls are exchanged between your client and the microservice.
In this blog post, we explore what you need to know about a managed API Gateway, its security, benefits, and also Amazon API Gateway basics, features, and how it interacts with AWS Lambda.
An API Gateway is a service that sits before an API or set of microservices to facilitate requests and the delivery of data.
For example, every time you use an app of your favorite social network or check travel prices for your next vacation, you're using an API.
An API Gateway is a way to decouple the client interface from the backend. When a client makes a request, the API gateway breaks it into multiple requests, routes them to the right services, produces a response, and keeps track of everything.
An API Gateway should also include:
API gateways allow different applications/services to communicate with each other and exchange data on and off the network. It receives requests (called "API calls") from internal and external sources, forwards them to the appropriate API, and then receives and transmits responses to the requesting user or device.
For example, suppose there is an application user that needs to call four different services as part of a process. Instead of having microservices calling each other directly, we do all the calls through the API Gateway.

At its most basic, an API Gateway accepts a remote request and returns a response. It is particularly useful for overcoming the challenge of offering your clients a simple and dependable experience.
Generally, API gateway security can be divided into:
Access control is the number-one security driver for API Gateway technology, serving as a governor of sorts so an organization can manage who can access an API and establish rules around how data requests are handled.
When all traffic is routed through an API Gateway, IT security experts tend to feel more confident that they have their finger on the pulse of an organization.
Gateways are a great way to route all API calls through a single place for evaluating, transforming, and securing them across the whole infrastructure. When all traffic is routed through a gateway, security specialists know what is happening and can make changes much more easily.
Without threat protection, the API Gateway, its APIs, and the native services of the integration server are insecure. That means malware or any anonymous outsiders could easily attempt to propagate a series of attacks such as DDoS or SQL injection.
Taking advantage of loose input validations allows a hacker to find the gaps in a system. Using existing inputs, an attacker will explore what is accepted or rejected and push what is possible until they find a way into an API and break down the system's integrity.
Here are the most common input validations.
Amazon API Gateway is a managed service that lets you easily handle common API tasks such as routing, security, caching, throttling, and monitoring.
Amazon API Gateway provides a highly scalable solution for creating and deploying these API types:
Build a CRUD API with Lambda and DynamoDB
Building a serverless chat app with a WebSocket API, Lambda and DynamoDB
Build an API Gateway REST API with Lambda integration
AWS provides flexibility in choosing backend technologies such as AWS Lambda functions, AWS Step Functions state machines, or call HTTP(s) endpoints hosted on AWS Elastic Beanstalk, Amazon EC2, or any other hosted HTTP based services.
It can also allow backends to be simple web applications for web portal access or Amazon S3 buckets for providing access to static web content or documents.

With Amazon API Gateway, you only pay when you use your API. There are no minimum fees or upfront payments.
For HTTP APIs and REST APIs, you only pay for the API calls you receive and the amount of data transferred. Private APIs do not incur data transfer charges. Learn more here: Amazon API Gateway pricing.
You can enable API caching in Amazon API Gateway to cache your endpoint's responses. With caching, you can reduce the number of calls made to your endpoint and also improve the latency of requests to your API.
When you enable caching for a stage, API Gateway caches responses from your endpoint for a specified time-to-live (TTL) period in seconds.
Caching is charged by the hour and is not eligible in the AWS Free Tier.


Run multiple versions of the same API simultaneously so you can quickly iterate, test, and release new versions. You pay for API calls and data transfer, and there are no minimum fees or upfront fees.
Provide end users with the lowest possible API request and response latency by leveraging the global network of edge locations and Amazon CloudFront CDN. Limit traffic and authorize API calls to ensure backend operations can withstand traffic spikes and don't call backend systems unnecessarily.
Monitor performance metrics and information on API calls, data latency, and error rates from the API Gateway dashboard, which allows you to visually monitor calls to your services using Amazon CloudWatch.

Authorize access to your APIs with AWS Identity and Access Management (IAM) and Amazon Cognito. If you use OAuth tokens, API Gateway offers native OIDC and OAuth2 support.
To support custom authorization requirements, you can execute a Lambda authorizer from AWS Lambda.
Together with AWS Lambda, API Gateway forms the app-facing part of the AWS serverless infrastructure.
It’s also possible to combine these serverless services with, for example, Amazon Cognito for authorization/authentication purposes, and Amazon DynamoDB to play the role of the non-relational serverless database.

For an app to call publicly available AWS services, you can use Lambda to interact with required services and expose Lambda functions through API methods in API Gateway.
AWS Lambda runs your code on highly available computing infrastructure. It performs the necessary execution and administration of computing resources.
To enable serverless applications, API Gateway supports Lambda proxy integration or Lambda non-proxy integration:
The Stormit team holds the AWS Service Delivery Program designation for AWS Lambda and helps organizations to redesign their legacy applications or release new ones by leveraging the Amazon API Gateway and other AWS serverless services.
Because API is used widely, it’s common that customers want to have a global API presence. But is it always sensible not to use your CloudFront distribution? This is a good question that we've tried to answer in our article: Does Putting CloudFront CDN in Front of API Gateway Make Sense?
An API Gateway is a component that sits between clients and backend services. It routes requests, manages traffic, enforces security, and provides a single entry point for APIs.
You need an API Gateway to simplify communication between clients and microservices. It improves security, enables monitoring, handles authentication, and makes scaling APIs easier.
Most API Gateway services are billed based on usage. AWS API Gateway, for example, has a free tier with a limited number of requests per month, but beyond that, usage is charged per request and for additional features.
It receives client requests, applies policies such as authentication or rate limiting, and forwards the request to the appropriate backend service. It also manages responses before returning them to the client.
An AWS Solutions Architect with over 5 years of experience in designing, assessing, and optimizing AWS cloud architectures. At Stormit, he supports customers across the full cloud lifecycle — from pre-sales consulting and solution design to AWS funding programs such as AWS Activate, Proof of Concept (PoC), and the Migration Acceleration Program (MAP).