Amazon API Gateway
Put REST, HTTP and WebSocket APIs in front of your Lambda functions or HTTP backends on Floci, and call them from your machine or from containers in the compose.
Features
APIs
- List REST, HTTP and WebSocket APIs with type, ID and creation date; find by name
- Create an API: HTTP (optionally sends every request to a Lambda function with a
$defaultroute and stage), REST, or WebSocket with a route selection expression - Edit name, description or route selection expression; delete an API
- Stack: X link when CloudFormation created the API
Resources and methods (REST)
- Resource tree with every method
- Create resources, including
{name}path variables and greedy{name+} - Create, edit and delete methods (
ANY,GET,POST,PUT,PATCH,DELETE,HEAD,OPTIONS) with a Lambda proxy or HTTP proxy integration - Authorization per method: none, AWS IAM or an authorizer
- Method overview: integration, URI, authorizer, API key requirement
- Test a method: path parameters, query string, headers and body; see status, latency, response body and headers, with a link to the Lambda function's logs
- Delete resources that have no child resources
Routes (HTTP and WebSocket)
- Create, edit and delete routes with integration and authorizer per route
- HTTP routes: method and path, or the
$defaultroute; Lambda function or HTTP URL integration - WebSocket routes:
$connect,$disconnect,$defaultor your own route keys, with a Lambda function integration - WebSocket routes can send the function's response back to the client
- Choosing a Lambda function can grant API Gateway permission to invoke it, so the API shows on the function's Triggers tab
Authorizers
- Create, edit and delete authorizers
- REST: Lambda (TOKEN or REQUEST) and Cognito user pools
- HTTP: Lambda (REQUEST) and JWT
- WebSocket: Lambda (REQUEST), attached to
$connect - Identity source from headers or query string parameters; target links to the Lambda function or Cognito user pool
Stages
- List stages with invoke URLs from your machine and from a container in the compose
- WebSocket stages show the WebSocket URL and the
@connectionsURL - Create and delete stages
Typical workflow
- Open APIs and choose Create API; pick REST and name it.
- On the Resources tab, choose Create resource, then Create method with a Lambda function.
- On the Stages tab, choose Create stage and copy the invoke URL.
- Select the method on the Resources tab and use its Test tab to send a request.
Works with
- AWS Lambda: Lambda proxy integrations, WebSocket routes and Lambda authorizers
- Amazon Cognito: Cognito user pool authorizers for REST APIs
- AWS CloudFormation: Stack: X link for APIs a stack created
Limitations
- Floci serves the latest configuration on every stage; deployments have no effect.
- Floci replies to a WebSocket client only when the route is set to send the function's response. Once on, it can't be turned off: delete the route and create it again.
- Floci leaves child resources behind when a resource is deleted, so the console deletes only resources without children.
- Floci can't change the user pool of a Cognito authorizer: create a new authorizer instead.
- Floci blocks local Cognito issuers for JWT authorizers, so requests get 401. Use a Lambda or Cognito user pool authorizer on a REST API to test sign-in locally.
- Floci checks the request signature for AWS IAM methods, not IAM policies; the Test tab sends unsigned requests.
- Floci doesn't check the Lambda invoke permission.
- API Gateway writes no logs in Floci.
- The console is checked against Floci 2.4.0; API Gateway changes in later Floci versions may behave differently.