API Gateway Essentials:
- API Gateway is a fully-managed service that allows you to create and manage your own APIs for your application.
- API Gateway acts as a "front door" for your application, allowing access to data/logic/functionality from your back-end services.
API Gateway Main Features:
- Build RESTful APIs with:
- Resources
- Methods (i.e. GET, POST, PUT)
- Settings
- Deploy APIs to a "Stage" (different envs: i.e. dev, beta, production)
- Each stage can have it's own throttling, caching metering, and logging.
- Create a new API version by cloning an existing one.
- You can create and work on multiple versions of an API (API version control).
- Roll back to previous API deployments
- A history of API deployments are kept.
- Custom domain names.
- Custom domain names can point to an API or Stage.
- Create and manage API keys for access AND meter usage of the API keys through Amazon CloudWatch Logs.
Set throttling rules based on the number of request per second (for each HTTP method)
- Request over the limit throttled (HTTP 429 response)
Security using Signature v.4 to sign and authorize API calls
- Temporary credentials generated through Amazon Cognito and Security Token Service (STS)
Benefits of API Gateway:
- Ability to cache API responses.
- DDoS protection via CloudFront.
- SDK generation for IOS, Android and Javascript.
- Supports Swagger (a very popular framework of API development tools).
- Request/response data transformation (i.e. JSON IN to XML OUT).
API Gateway: CloudFront
- API Gateway benefits from using CloudFront infrastructure:
- Built in Distributed Denial of Service (DDoS) attach protection and mitigation.
- All CloudFront Edge Location become entry points for your API into your back-end.
- Summary: Benefits are reduced latency and improved projection.
API Gateway Caching:
- API Gateway will cache API responses so that duplicate API request do not have to hit your back-end.
- This reduces load on your back-end.
- Speeds up calls to your back-end.
- You can configure a cache key and Time to Live (TTL) of the API response.
- Caching can be setup on a per API or per stage basis.
API Gateway: CloudWatch
- CloudWatch can be used to monitor API Gateway activity and usage.
- Monitoring can be done on the API or Stage level.
- Throttling rules are monitored by CloudWatch.
- Monitoring metrics include such statitics as:
- Caching
- Latency
- Detected errors
- Method-level metrics can be monitored.
- You can create CloudWatch alarms based on these metrics.