【发布时间】:2021-12-20 20:07:40
【问题描述】:
我在 API 网关后面创建了一个 lambda 函数,并且我也在尝试为它实现健康检查,但现在我需要分两步完成:
- 运行
serverless deploy,这样它就会为api网关输出端点。 - 手动将端点插入到 healthcheck.environment.api_endpoint 参数中,然后再次运行
serverless deploy
functions:
app:
handler: wsgi_handler.handler
events:
- http:
method: ANY
path: /
- http:
method: ANY
path: '{proxy+}'
healthcheck:
environment:
api_endpoint: '<how to reference the api endpoint?>'
handler: healthcheck.handler
events:
- schedule: rate(1 minute)
custom:
wsgi:
app: app.app
pythonBin: python3
packRequirements: false
pythonRequirements:
dockerizePip: non-linux
有没有办法在创建时获取对 api 网关的引用,以便可以将它作为环境变量传递给 healthcheck 应用程序?我能想到的替代方案基本上是创建一个特定的 serverless.yaml 仅用于健康检查目的。
【问题讨论】:
标签: aws-lambda aws-api-gateway serverless-framework wsgi