Use case :
- Need to have 1 API Gateway with multiple stages as dev, test and prod, so that i can invoke different lambdas corresponding to each environment as https://APIGW_ENDPOINT/dev/{proxy} or https://APIGW_ENDPOINT/test/{proxy} or https://APIGW_ENDPOINT/prod/${proxy}
serverless.yml file is as follows
service: whatsapp-k8-orchestration
plugins:
- serverless-python-requirements
- serverless-wsgi
custom:
wsgi:
app: app.app
packRequirements: false
pythonRequirements:
dockerizePip: true
currentStage: ${opt:stage, self:custom.defaultStage}
configs: ${file(sls_config.yml):${self:custom.currentStage}}
provider:
name: aws
runtime: python3.6
stage: ${self:custom.currentStage}
region: ${self:custom.configs.REGION}
endpointType: PRIVATE
timeout: 300
vpc:
securityGroupIds: ${self:custom.configs.LAMBDA_SECURITYGROUPS}
subnetIds: ${self:custom.configs.SUBNETS}
functions:
app:
handler: wsgi.handler
events:
- http: ANY /
- http: 'ANY {proxy+}'
However, when i run sls deploy --stage dev and sls deploy --stage test , two separate APIGateways are created.
What changes i should do, so that there is only 1 APIGateway created, but with different stages for each environment lambda ???