amazon-web-services - 云信息 : How to pass a string through cloudformation script into UserData?

标签 amazon-web-services environment-variables aws-cloudformation

云信息命令:

- aws cloudformation create-stack --stack-name stackName --template-body file://cloudformation.yaml --parameters ParameterKey=keyName,ParameterValue=myKeys

我需要将 env 变量粘贴到 UserData cloudformation sctipt 中。所以最后会有 docker pull quay.io/apple/myRepo:myVarName

UserData:
      Fn::Base64: !Sub |
        docker pull quay.io/apple/myRepo:master

最佳答案

如果您使用以下参数执行 aws cloudformation create-stack:

--parameters ParameterKey=keyName,ParameterValue=myKeys

在您的模板中,您需要有Parameters部分:

Parameters:

  keyName:
    Type: String

然后在您的UserData中,您将引用参数keyName,如下所示:

UserData:
  Fn::Base64: !Sub |
     param_value=${keyName}

关于amazon-web-services - 云信息 : How to pass a string through cloudformation script into UserData?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62646136/

相关文章:

qt - 我需要为 Qt5 添加哪些环境变量 PATH 以识别包括 <QtGui/QApplication>

batch-file - 将基于特定大小的日志旋转为日期/时间戳副本

javascript - slim 的框架 : pass environment variables to client-side bundle at runtime

aws-lambda - 是否可以在 lambda 的环境变量中使用 SSM 参数?

amazon-web-services - Cloudformation 自定义资源 "Response is not valid JSON"

dns - 使用 cloudflare 将 CNAME 分配到我在 amazon S3 中的静态网站存储桶

mysql - 如何将 Google Data Studio 与 VPC 后面的 AWS RDS MySQL 连接起来?

javascript - 使用 AWS Cognito 是否可以在给定禁用的未经身份验证的 IdentityId 的情况下解析经过身份验证的 IdentityId?

amazon-web-services - Auto Scaling 组不会在启动配置更改时更新

java - Logentries + AWS 不兼容