简体   繁体   English

如何在 Serverless 中引用 ssm 中的变量

[英]How do I reference a variable inside a ssm in Serverless

Recently I updated a serverless environment from an extremely outdated version to the latest and have run into many issues.最近我将一个无服务器环境从一个非常过时的版本更新到最新版本并且遇到了很多问题。 one of which I don't seem to understand why it isn't working.其中之一我似乎不明白为什么它不起作用。 Previously we reference AWS parameter store variable with ssm references like so:以前我们使用 ssm 引用来引用 AWS 参数存储变量,如下所示:

SQS_URL: ${ssm:/foo/${opt:env}/sqsUrl}

Now I have updated our use of the opt to make use of env so it looks like:现在我已经更新了我们对opt的使用以使用env ,它看起来像:

SQS_URL: ${ssm:/foo/${env:ENV, "NOT_VALID"}/sqsUrl}

But I get the following error:但我收到以下错误:

Cannot resolve variable at "provider.environment.SQS_URL": Value not found at "ssm" source,无法在“provider.environment.SQS_URL”处解析变量:在“ssm”源中找不到值,

We used to make extensive use all over the place of this to set environment variables on lambdas so that we could pass values to them for them to use at run time, but serverless doesn't seem to like this anymore but looking at the documentation it seems like it should work.我们曾经广泛使用它来在 lambdas 上设置环境变量,以便我们可以将值传递给它们以供它们在运行时使用,但无服务器似乎不再喜欢这个,但查看它的文档似乎它应该工作。 Can anyone help me resolve this please?谁能帮我解决这个问题?

Thank you!谢谢!

You have defined SQS_URL variable.您已定义SQS_URL变量。 Error message says it can't find SQS_QUEUE_URL .错误消息说找不到SQS_QUEUE_URL

If it's still working after fixing variable names.如果它在修复变量名称后仍然有效。 Try with a given environment to narrow it down.尝试在给定的环境中缩小范围。

SQS_URL: ${ssm:/foo/DEV/sqsUrl}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AWS 无服务器应用程序模型 (SAM) — 如何更改 StageName? - AWS Serverless Application Model (SAM) -- How do I change StageName? 如何在 Serverless Framework 中分配 function 级别的 IamRoleStatements? - How do I assign function level IamRoleStatements in Serverless Framework? 我如何创建 amazon s3 url 以允许我的部署目标使用 SSM runCommand 下载由构建阶段创建的文件 - How do I create the amazon s3 url in a way that allows my deployment target to download a file created by the build stage using SSM runCommmand 如何在 serverless.yaml 中的自定义块中引用条件变量 - how to reference conditional variables in custom block in serverless.yaml 如何解决 deploy serverless error: The provided access key is not authorized for this operation? - How do I solve the deploy serverless error : The provided access key is not authorized for this operation? 如何使用 Serverless Framework 管理 Lambda 内部的 Aurora Serverless 数据 api 的 typeORM 连接 - How to manage typeORM connection of Aurora Serverless data api inside Lambda using Serverless Framework AWS::EC2::Instance/Metadata 不支持 SSM 安全引用 - SSM Secure reference is not supported in: AWS::EC2::Instance/Metadata 在双引号内使用 terraform 引用变量 - Use terraform reference variable inside double quotes 我应该如何在无服务器环境中管理 postgres 数据库句柄? - How should I manage postgres database handles in a serverless environment? 如何将 Firestore 文档引用存储为 nextjs 中的字段? - How do I store a Firestore document reference as a field from nextjs?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM