HTTP API Support
See original GitHub issueSupport HTTP API:
https://aws.amazon.com/blogs/compute/announcing-http-apis-for-amazon-api-gateway/
Proposal of a configuration schema within a Serverless Framework
Note: This proposal is “live” (updated in place whenever there’s an agreement on changes to it)
provider:
# (optional) general API settings
httpApi:
id: xxx # Attach to existing, already deployed, HTTP API id
timeout: 5 # Default timeout for endpoints
# Following options are supported only for HTTP API's to be created in context of this service
cors: # Can also be set to `true` which will apply below defaults. If not set, there's no CORS
allowedOrigins: "*"
allowedHeaders: "*"
allowMethods: "*"
allowCredentials: true
exposedResponseHeaders: "*"
maxAge: 300
authorizers:
# JWT authorizers
jwtAuthorizer:
identitySource: $request.header.Authorization
issuerUrl: <url>
audience:
- <audience1>
- <audience2>
# (optional) access logging for HTTP API
logs:
httpApi: # Can also be set to `true` which will apply below defaults. If not set, no logs are written
format: '{ "requestId":"$context.requestId", "ip": "$context.identity.sourceIp", "requestTime":"$context.requestTime", "httpMethod":"$context.httpMethod","routeKey":"$context.routeKey", "status":"$context.status","protocol":"$context.protocol", "responseLength":"$context.responseLength" }'
functions:
# Individual HTTP route example
users:
handler: users.handler
events:
- httpApi:
path: /users
method: GET # Can be "*" as a catch-all for all HTTP methods for given path
timeout: 5 # Optional, timeout in seconds
authorizer: # Optional, if not set, endpoint is public
name: jwtAuthorizer
scopes:
- user.id
- user.email
# Catch all other routes example
api:
handler: api.handler
events:
- httpApi:
path: "*" # Once deployed, cannot be removed
In addition support for importing Open API objects can be added as:
provider:
httpApi:
# Endpoints configuration provided via Open API object
openApi: # can be imported as e.g. ${file(open-api.json)}
openapi: "3.0.0"
info:
title: "HTTP API example"
version: "1.0.0"
paths:
/users:
get:
operationId: usersGet
post:
operationId: usersPost
/other:
get:
operationId: other
functions:
# Individual HTTP route example
users:
handler: users.handler
events:
- httpApi:
operationId: usersGet # Match endpoint specified within Open API object
# Catch all other specified routes example
api:
handler: api.handler
events:
- httpApi:
operationId: "*"
Implementation roadmap
Implement and publish HTTP API support in following stages:
- Basic routes support, no cors, no authorizers, no open API objects import (#7274, #7331 & #7383)
- CORS support (#7336)
- JWT authorizers support (#7346)
- Access logs (#7385)
- Support existing HTTP API’s (#7396)
- Support
timeout
setting (#7401) - (eventually) Open API object support - possibly leave out for community to implement (when demand shows)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:105
- Comments:53 (20 by maintainers)
Top Results From Across the Web
Choosing between REST APIs and HTTP APIs
REST APIs support more features than HTTP APIs, while HTTP APIs are designed with minimal features so that they can be offered at...
Read more >API Gateway REST vs. HTTP API: What Are The Differences?
AWS API Gateway is a great technology for managing and securing access to your backend REST APIs. However, AWS currently supports two very ......
Read more >HTTP API vs REST API: 3 Critical Differentiators - Learn | Hevo
Do you know the differences between HTTP API and REST API. ... Hevo supports robust and native connectors for REST APIs to help...
Read more >What are REST APIs? HTTP API vs REST API - Educative.io
Today, we'll help you get started in web development by exploring the definition and use of REST APIs.
Read more >The Official Guide to AWS HTTP APIs - Serverless Framework
The new AWS HTTP API portion of the Amazon API Gateway service dramatically simplifies this process and in some cases allows configuring an...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jplock We we will propose an implementation spec proposal next week, and actual implementation work should follow up shortly after we agree on most important details.
Looks like CloudFormation support just landed: https://aws.amazon.com/about-aws/whats-new/2019/12/aws-cloudformation-updates-for-api-gateway-codepipeline-s3-iam-ecs-rds-es-lambda-and-more/