-
Notifications
You must be signed in to change notification settings - Fork 7
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 file src/index.js will be the one to route to the individual functions.
function.yml
admin-access:
handler: src/index.handler
events:
- http:
path: /
method: post
authorizer:
type: COGNITO_USER_POOLS
authorizerId:
Ref: ApiGatewayAuthorizer
cors: true
- http:
path: /{id}
method: get
authorizer:
type: COGNITO_USER_POOLS
authorizerId:
Ref: ApiGatewayAuthorizer
cors: true
- http:
path: /
method: get
authorizer:
type: COGNITO_USER_POOLS
authorizerId:
Ref: ApiGatewayAuthorizer
cors: true
- http:
path: /{id}
method: put
authorizer:
type: COGNITO_USER_POOLS
authorizerId:
Ref: ApiGatewayAuthorizer
cors: true
- http:
path: /{id}
method: patch
authorizer:
type: COGNITO_USER_POOLS
authorizerId:
Ref: ApiGatewayAuthorizer
cors: true
- http:
path: /{id}
method: delete
authorizer:
type: COGNITO_USER_POOLS
authorizerId:
Ref: ApiGatewayAuthorizer
cors: truePros:
- 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.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request