【发布时间】:2017-12-09 19:08:24
【问题描述】:
我有一个无服务器项目,它正在创建 API 网关 API 等等。项目中的其中一个函数需要为 API 端点生成 URL。
我的计划是使用 serverless.yml 中的资源输出获取 API ID,然后创建 URL 并将其作为 env 参数传递给 lambda 函数。
我的问题/疑问是如何在 serverless.yml 中获取 API ID 作为云形成输出?
我试过了:
resources:
Outputs:
RESTApiId:
Description: The id of the API created in the API gateway
Value:
Ref: name-of-api
但这给出了错误:
The CloudFormation template is invalid: Unresolved resource dependencies [name-of-api] in the Outputs block of the template
【问题讨论】:
-
如果在同一个项目中,不能直接将
{Ref: myApiGateway}输出到函数的环境变量中吗?
标签: aws-api-gateway amazon-cloudformation serverless-framework