Overview
- Support
web-socketprotocol - Handle
APIversioning- Multiple Environment
- Security (Authentication, Authorization)
- Using
APIkeys, handle request throttling Swagger/Open APIto importDefinition- Transform and validate the
RequestandResponse - Generate
SDKandAPI Specification - Cache
APIresponse - Can be orchestrate multiple web app and micro services
- Can set different usage plan for different users for different level of access
- Can set different quota and throttling to different level of access
- To pass a stage variable, use
$stagevariables.<variableName>concept
Integration
- Lambda
- Invoke
Lambdafunction - Expose
REST APIbacked byLambda - HTTP Endpoint
- AWS Service
- Expose any
AWS ServiceasAPI Gateway
Endpoint Types
- 3 types of
API Gateway Endpoints - Edge Optimized (By default use global network using cloudfront)
- This is
defaultbehavior APIis only one region- But to improve latency, request is routed through
Cloudfront Edge Locations
- This is
- Regional
APIis in the one region
- Private
- Use inside the
VPCasVPC Endpoint - Resource policy is used to define access
- Use inside the
Advantage of Edge Optimized is
- We can get Edge Optimized behavior
- In this case, we have more control over
- Caching
- Strategies
- Distribution
Premium Users
- Api keys can be used to allow special previllages to the resources using API keys
- In this case, the API keys should be associated with the usage plan by invoking
CreateUsagePlan
Security
IAM- When users/roles is within
AWS Account - Handle
AuthenticationandAuthorization - Leverage Sig v4
- It's the
IAMcredentials in theHTTP Header
- It's the
- Authorizer: two types of lambda authorizer
- Token based: get token as bearer token and later verify (OAuth or SAML)
- Request parameter based: get caller identity in form of the context, payload or query string
CUPorCognito User Pool- When user pools are manages by Facebook, Google login
- No need to write custom code
- Only provide
Authentication Authorizationmust be provided from the backend code- Access of developer and users can be separated using
IAM Permission - Developer can manage and deploy API
- User can call API
- SSL/TLS though
AWS Certificate Manageris free forAPI Gateway
Invoke_Asyncis deprecated invocation type. Only theinvokeis being used.