amazon-web-services - 如何使用cloudformation中的aws_ssm_parameter在 'values'参数中输入字典结构

标签 amazon-web-services aws-cloudformation

我在AWS System Manager中有一个参数,值的类型是字符串,但值具有字典结构:

值:

{"key1": "value1","key2": "value2","key3": "value3"}

现在我正在尝试使用 cloudformation 创建此参数。但是当我尝试在 cloudformation 中编写此内容时收到错误:

AWSTemplateFormatVersion: "2010-09-09"
Description: Systems Manager Parameter Store Parameters
Resources:
  Test-Channels:
    Type: AWS::SSM::Parameter
    DeletionPolicy: Delete
    Properties:
      Name: test-Channels
      Description:Lambda required parameter key and values
      Type: String
      Value: "{ "key1": "value1","key2": "value2", "key3", "value3"}"

来自云信息的错误: 属性验证失败:[属性值 {/Value} 与类型 {String} 不匹配]

有人可以告诉我我做错了什么或者使用cloudformation将字典类型的值分配给参数名称的正确方法吗?

非常感谢!

最佳答案

您可以使用单引号:

AWSTemplateFormatVersion: "2010-09-09"
Description: Systems Manager Parameter Store Parameters
Resources:
    TestChannels:
        Type: AWS::SSM::Parameter
        DeletionPolicy: Delete
        Properties:
            Name: test-Channels
            Description: Lambda required parameter key and values
            Type: String
            Value: dddd
            Value: '{ "key1": "value1","key2": "value2", "key3", "value3"}'

关于amazon-web-services - 如何使用cloudformation中的aws_ssm_parameter在 'values'参数中输入字典结构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74493945/

相关文章:

amazon-web-services - 我可以在云形成中使用公共(public)安全组来进行 ec2 启动配置吗?

aws-cloudformation - 创建仅限 S3 的用户

json - 通过 Cloudformation 模板创建 RDS Opsworks 层

python - 如何上传多个文件并在 S3 中组合它们

string - CloudWatch 自定义指标可以是变量而不是硬编码字符串吗

aws-cloudformation - 在 Cloud Formation 中创建蓝绿色部署(一个负载均衡器 2 个目标组

aws-cloudformation - 属性 Targets 的值必须是对象列表“AWS::ElasticLoadBalancingV2::TargetGroup”错误

amazon-web-services - CodeDeployToECS 的每个操作配置属性在 AWS CodePipeline 中指什么?

java - Spring 启动 AWS ElastiCache

python - 同步本地和 Elastic Beanstalk 数据库?