Skip to content

Instantly share code, notes, and snippets.

@jgcmarins
Created February 15, 2024 13:51
Show Gist options
  • Save jgcmarins/dd160c28e0841afaa8a37da21e35edcb to your computer and use it in GitHub Desktop.
Save jgcmarins/dd160c28e0841afaa8a37da21e35edcb to your computer and use it in GitHub Desktop.
Multiple Lambdas with a single API Gateway
# serverless-api-gateway.yml
service: central-api-gateway
provider:
name: aws
runtime: nodejs14.x
stage: dev
region: sua-região
resources:
Resources:
MySharedApiGateway:
Type: AWS::ApiGateway::RestApi
Properties:
Name: SharedAPIGateway
Description: Um API Gateway central para todos os microserviços.
# serverless-microservice.yml
service: microservice-nome
provider:
name: aws
runtime: nodejs14.x
stage: dev
region: sua-região
apiGateway:
restApiId: "ID_DO_SEU_API_GATEWAY_CENTRAL"
restApiRootResourceId: "ID_DO_RECURSO_RAIZ_SE_NECESSÁRIO" # Opcional
functions:
minhaFuncao:
handler: handler.minhaFuncao
events:
- http:
path: caminho/da/funcao
method: get
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment