AWS API Gateway Flashcards
Amazon API Gateway
API Gateway is a fully managed service that makes it easy for developers to publish, maintain, monitor, and secure APIs at any scale.
API Gateway supports the following:
- Creating, deploying, and managing a REST application programming interface (API) to expose backend HTTP endpoints, AWS Lambda functions, or other AWS services.
- Creating, deploying, and managing a WebSocket API to expose AWS Lambda functions or other AWS services.
- Invoking exposed API methods through the frontend HTTP and WebSocket endpoints.
All the APIs created with Amazon API Gateway expose HTTPS endpoints only (does not support unencrypted endpoints) ? T/F
True
CloudFront is used as the public endpoint for API Gateway ? T/F
True
Permissions to invoke a method are granted using IAM roles and policies or API Gateway custom authorizers ? T/F
True
API Gateway Certificate Concepts ?
By default API Gateway assigns an internal domain that automatically uses the API Gateway certificates.
When configuring your APIs to run under a custom domain name you can provide your own certificate.
What are Amazon API Gateway core Features ?
Support for RESTful APIs and WebSocket APIs
- With API Gateway, you can create RESTful APIs using either HTTP APIs or REST APIs
Private integrations with AWS ELB & AWS Cloud Map
- With API Gateway, you can route requests to private resources in your VPC. Using HTTP APIs, you can build APIs for services behind private ALBs, private NLBs, and IP-based services registered in AWS Cloud Map, such as ECS tasks.
Metering
- Define plans that meter and restrict third-party developer access to APIs.
Security
- API Gateway provides multiple tools to authorize access to APIs and control service operation access.
Resiliency
- Manage traffic with throttling so that backend operations can withstand traffic spikes.
Operations Monitoring
- API Gateway provides a metrics dashboard to monitor calls to services.
Lifecycle Management
- Operate multiple API versions and multiple stages for each version simultaneously so that existing applications can continue to call previous versions after new API versions are published.
AWS Authorization
- Support for signature version 4 for REST APIs and WebSocket APIs, IAM access policies, and authorization with bearer tokens (e.g., JWT, SAML) using Lambda functions.
What is an Endpoint ?
An API endpoint type is a hostname for an API in API Gateway that is deployed to a specific region.
The hostname is of the form {api-id}.execute-api.{region}.amazonaws.com.
The API endpoint type can be edge-optimized, regional, or private, depending on where most of your API traffic originates from.
What is Edge-Optimized Endpoint ?
An edge-optimized API endpoint is best for geographically distributed clients. API requests are routed to the nearest CloudFront Point of Presence (POP). This is the default endpoint type for API Gateway REST APIs.
Edge-optimized APIs capitalize the names of HTTP headers (for example, Cookie).
CloudFront sorts HTTP cookies in natural order by cookie name before forwarding the request to your origin. For more information about the way CloudFront processes cookies, see Caching Content Based on Cookies.
Any custom domain name that you use for an edge-optimized API applies across all regions.
What is a Regional Endpoint ?
- A regional API endpoint is intended for clients in the same region.
- When a client running on an EC2 instance calls an API in the same region, or when an API is intended to serve a small number of clients with high demands, a regional API reduces connection overhead.
- For a regional API, any custom domain name that you use is specific to the region where the API is deployed.
- If you deploy a regional API in multiple regions, it can have the same custom domain name in all regions.
- You can use custom domains together with Amazon Route 53 to perform tasks such as latency-based routing.
- Regional API endpoints pass all header names through as-is.
What is a Private Endpoint ?
A private API endpoint is an API endpoint that can only be accessed from your Amazon Virtual Private Cloud (VPC) using an interface VPC endpoint, which is an endpoint network interface (ENI) that you create in your VPC.
Private API endpoints pass all header names through as-is.
Define API Gateway REST API ?
A collection of HTTP resources and methods that are integrated with backend HTTP endpoints, Lambda functions, or other AWS services.
This collection can be deployed in one or more stages.
Typically, API resources are organized in a resource tree according to the application logic.
Each API resource can expose one or more API methods that have unique HTTP verbs supported by API Gateway.
What is API Gateway WebSocket API ?
A collection of WebSocket routes and route keys that are integrated with backend HTTP endpoints, Lambda functions, or other AWS services.
The collection can be deployed in one or more stages.
API methods are invoked through frontend WebSocket connections that you can associate with a registered custom domain name.
What is Stages and Stage variables ?
A stage is a logical reference to a lifecycle state of your REST or WebSocket API (for example, ‘dev’, ‘prod’, ‘beta’, ‘v2’).
API stages are identified by API ID and stage name.
Stage variables can be used in ?
Stage variables can be used in:
- Lambda function ARN.
- HTTP endpoint.
- Parameter mapping templates.
Stage variables are passed to the “context” object in Lambda.
Stage variables are used with Lambda aliases.
You can create a stage variable to indicate the corresponding Lambda alias.
You can create canary deployments for any stage – choose the % of traffic the canary channel receives.
Use cases for stage variables ?
Use cases for stage variables ?
- Configure HTTP endpoints your stages talk to (dev, test, prod etc.).
- Pass configuration parameters to AWS Lambda through mapping templates.
What is a Mapping Template
- Mapping templates can be used to modify request / responses.
- Rename parameters.
- Modify body content.
- Add headers.
- Map JSON to XML for sending to backend or back to client.
- Uses Velocity Template Language (VTL).
- Filter output results (remove unnecessary data).