Professional Documents
Culture Documents
API Gateway
API Gateway
© 2022, Amazon Web Services, Inc. or its affiliates. © 2022, Amazon Web Services, Inc. or its affiliates.
Agenda
Overview of Serverless
What is Amazon API Gateway
API Types
Amazon API Gateway Features
Best Practices
Compute
AWS AWS
Lambda Fargate
Data stores
Integration
“
“ In building applications, an API simplifies programming by abstracting the underlying
implementation and only exposing objects or actions the developer needs.
Request
Web-based companies and services offer APIs for developers to use, such as:
• Social Networks – Facebook, Twitter, etc
• Payment Processing – Amazon Pay, PayPal, etc
© 2022, Amazon Web Services, Inc. or its affiliates. https://en.wikipedia.org/wiki/Application_programming_interface
Amazon API Gateway
AWS Cloud
• Throttling
• Caching
• Authorization
• API Keys
• Usage Plans
• Request/Response Mapping
Edge-Optimized
Fully-managed
CloudFront
roundtrip time) Distribution
Designed for a globally distributed set of clients
Regional [BOTH]
Recommended API type for general use cases
Designed for building APIs for clients in the same region
Regional
Private [REST]
Only accessible from within VPC (and networks connected to VPC)
Private
Designed for building APIs used internally or by private microservices
Edge-Optimized
Mobile client
CloudFront API Gateway Cache
Distribution
HTTPS Any other AWS
service
Websites
All publicly accessible
endpoints
Customer-managed
CloudFront Distribution
Regional
Services
Endpoints
Applications in VPC
& Services
in the same
AWS Region AWS Direct
Connect
Private
Applications
& Services Amazon
in VPC CloudWatch On-premises
Monitoring
© 2022, Amazon Web Services, Inc. or its affiliates.
API Types
Client Client
WAF
Mutual TLS
Cognito User Pools
IAM + Resource Policies
Lambda Authorizers
JWT
© 2022, Amazon Web Services, Inc. or its affiliates.
Throttling and Usage Plans
Rest only
Service
• Validations
The required request parameters in the URI, query string, and headers of an incoming
request are included and non-blank.
The applicable request payload adheres to the configured JSON schema request model
of the method.
• Transformations
Transform request to match expected format from backend
Transform response from API to match expected format for front end
Override request and response parameters based on message body
Override response status code
API Gateway enables you to set stage • APIs are deployed to staging environments.
variables, allowing the same API to point
to different backends. You choose what to name them.
Your APIs are versioned and can be rolled • For example, these environments:
back.
Dev (e.g., example.com/dev)
Stages v0.0.1
Stage variable = lambdaAlias
v0.0.2
aliases v0.0.3
Prod stage
lambdaAlias = prod prod v0.0.4
v0.0.5
Beta stage beta
v0.0.6
lambdaAlias = beta
dev v0.0.7
Dev stage v0.0.8
lambdaAlias = dev v0.0.9
My API My API
Amazon Amazon
CloudWatch CloudWatch
• Access Logs
Customizable format for machine parsable logs (CLF, JSON, XML, CSV)
CloudWatch Logs OR Kinesis Firehose
© 2022, Amazon Web Services, Inc. or its affiliates. © 2022, Amazon Web Services, Inc. or its affiliates.