There are 3 main types of Serverless HTTP events:
- Added Cost: 0
- Announcement: https://aws.amazon.com/blogs/aws/announcing-aws-lambda-function-urls-built-in-https-endpoints-for-single-function-microservices/
- Docs: https://docs.aws.amazon.com/lambda/latest/dg/urls-invocation.html
functions:
hello:
handler: handler.hello
# Public by default
url: true
The lambda doesn't support path on the deployment level, so you should do something like:
const { requestContext: { http: { method, path } }, body } = event
if (method !== 'POST' || path !== '/foo') return { statusCode: 404 }
- Added Cost: ~$3.5/million requests
- Compare with v2: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-vs-rest.html
- Docs: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
- Serverless Docs: https://www.serverless.com/framework/docs/providers/aws/events/apigateway
functions:
hello:
handler: handler.hello
events:
- http:
method: GET
path: /hello
- Added Cost: ~$1/million requests
- Compare with v1: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-vs-rest.html
- Docs: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
- Serverless Docs: https://www.serverless.com/framework/docs/providers/aws/events/http-api
functions:
hello:
handler: handler.hello
events:
- httpApi:
method: GET
path: /hello