如何从aws上的无服务器框架输出资源路径?

How to output resource path from serverless framework on aws?

如何将资源 path/URL 输出到 cloudformation Outputs?

例如,我有一个 lambda 正在侦听路径 /hello 上的 http 事件,我希望 cloudformation 输出一个值为 https://kjkjwerwer.execute-api.eu-west-1.amazonaws.com/test/hello

的变量

默认情况下,无服务器框架输出 ServiceEndpoint,但是,我想要每个函数的完整端点

您可以在 resources 部分输出您想要的任何内容。 您可以使用所有相同的模板变量,如 !Ref${self:custom.myEndpointName}!Join 来清理它:

resources:
  Outputs:
    MyEndpointName:
      Description: HTTP Endpoint for MyEndpoint lambda
      Value: ${self:custom.myEndpointName} // Or some other templated/hardcoded string