- Notifications
You must be signed in to change notification settings - Fork7
Open
Description
Motivation: As of writing, abu-api- will consume 199 resources. Since the limit is 200, the user cannot create more API endpoints.
Proposed Solution: Merge API entity into one lambda function.
A new filesrc/index.js
will be the one to route to the individual functions.
function.yml
admin-access:handler:src/index.handlerevents: -http:path:/method:postauthorizer:type:COGNITO_USER_POOLSauthorizerId:Ref:ApiGatewayAuthorizercors:true -http:path:/{id}method:getauthorizer:type:COGNITO_USER_POOLSauthorizerId:Ref:ApiGatewayAuthorizercors:true -http:path:/method:getauthorizer:type:COGNITO_USER_POOLSauthorizerId:Ref:ApiGatewayAuthorizercors:true -http:path:/{id}method:putauthorizer:type:COGNITO_USER_POOLSauthorizerId:Ref:ApiGatewayAuthorizercors:true -http:path:/{id}method:patchauthorizer:type:COGNITO_USER_POOLSauthorizerId:Ref:ApiGatewayAuthorizercors:true -http:path:/{id}method:deleteauthorizer:type:COGNITO_USER_POOLSauthorizerId:Ref:ApiGatewayAuthorizercors:true
Pros:
- Use only 1 lambda instead of multiple thus reducing the resources.
- Because we'll be using one lambda for list and CRUD, the lambda maybe kept warm while user is using the endpoint.
Cons:
- Code is bigger because all operations are inside.