【发布时间】:2023-02-11 07:05:08
【问题描述】:
Serverless 相当新,在创建 SSM 参数的动态路径时遇到问题......我尝试了一些想法,但我确信这真的很接近,但还不完全......
我正在尝试生成一个 ssm 路径作为自定义变量,然后用于填充 Lambda 函数的值。
这是自定义变量代码
custom
securityGroupSsmPath:
dev: "${self:service}/${self:custom.stage}/rds/lambdasecuritygroup"
other: "${self:service}/${env:SHARED_INFRASTRUCTURE_ENV}/rds/lambdasecuritygroup"
securityGroupId: ${ssm:, "${self:custom.securityGroupSsmPath.${env:SHARED_INFRASTRUCTURE_ENV}, self:custom.securityGroupSsmPath.other}"}
这是函数中引用它的地方
functions:
someLambda:
handler: build/handlers/someLambda/handler.handler
timeout: 60
memorySize: 256
vpc:
securityGroupIds:
- ${self:custom.securityGroupId}
这是错误输出。好像没有解析 ssm 参数
Serverless Error ----------------------------------------
Cannot resolve serverless.yml: Variables resolution errored with:
- Cannot resolve variable at "custom.securityGroupId": Parameter name: can't be prefixed with "ssm" (case-insensitive). If formed as a path, it can consist of sub-paths divided by slash symbol; each sub-path can be formed as a mix of letters, numbers and the following 3 symbols .-_
非常感谢所有帮助,
谢谢!
山姆
【问题讨论】:
标签: amazon-web-services serverless serverless-framework aws-ssm