简体   繁体   English

向Cloudformation模板的参数文件添加列表

[英]Adding a list to the parameters file for Cloudformation template

I have a cloudformation template in which I send a JSON parameters file over. 我有一个cloudformation模板,在其中发送JSON参数文件。 It was not a real problem, as my parameters file used to look like this: 这不是一个真正的问题,因为我的参数文件以前看起来像这样:

[
    "InstanceType=t2.medium",
    "AmiStack=amilookup-stack"
]

However, I want to add a list to the parameters file, something like this: 但是,我想向参数文件添加一个列表,如下所示:

[
    "InstanceType=t2.medium",
    "AmiStack=amilookup-stack",
    [
        "CertificateArn1=arn:aws:acm:us-east-1:xxx",
        "CertificateArn2=arn:aws:acm:us-east-1:xxy",
    ]
]

What is the best way to express this in my parameters json file, and how to express this in the cloudformation template itself? 在我的参数json文件中表达此信息的最佳方法是什么,以及如何在cloudformation模板本身中表达此信息? enter code here

This is a known problem with Cloudformation. 这是Cloudformation的已知问题 You can use comma demlimited list as parameter type. 您可以使用逗号分隔列表作为参数类型。

Cloudformation Template (test.json) Cloudformation模板(test.json)

 {
  "AWSTemplateFormatVersion": "2010-09-09",
  "Parameters": {
    "Name": {
      "Type": "String",
      "Description": "SubnetGroup Name"
    },
    "Subnets": {
      "Type": "CommaDelimitedList",
      "Description": "The list of SubnetIds in your Virtual Private Cloud (VPC)"
    }
  },
  "Resources": {
    "myDBSubnetGroup": {
      "Type": "AWS::RDS::DBSubnetGroup",
      "Properties": {
        "DBSubnetGroupDescription": "description",
        "DBSubnetGroupName": {
          "Ref": "Name"
        },
        "SubnetIds": {
          "Ref": "Subnets"
        }
      }
    }
  }
}

Parameter.json Parameter.json

[
  {
    "ParameterKey": "Name",
    "ParameterValue": "testName"
  },
  {
    "ParameterKey": "Subnets",
    "ParameterValue": "subnet-abcdefg,subnet-abcdef1,subnet-abcdef2"
  }
]


aws cloudformation create-stack --stack-name testStack --template-body file://test.json --parameters file://parameter.json --profile yourawsprofile

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

相关问题 cloudformation模板中的opsworks参数和资源 - opsworks parameters and resources in the cloudformation template AWS Cloudformation json模板中的“参数”内应是什么,以及“资源”内应是什么? - What should be inside “Parameters” and what in “Resoures” in AWS Cloudformation json template? 我可以在 AWS Cloudformation json 模板的“参数”中使用“Fn::Join”吗 - Can I use "Fn::Join" in "Parameters" of AWS Cloudformation json template 如何在亚马逊的云信息模板中列出现有子网? - How do I list existing subnets in a cloudformation template from Amazon? 用于创建EC2的AWS CloudFormation模板-列出IAM角色 - AWS CloudFormation Template to Create EC2 - List IAM Roles CloudFormation嵌套堆栈参数 - CloudFormation nested stack parameters 将 cloudformation 模板移植到 terraform - Porting a cloudformation template to terraform Cloudformation 模板创建 EMR 集群 - Cloudformation template to create EMR cluster 将参数作为json文件传递时,AWS Cloudformation CLI使用简写语法 - AWS Cloudformation CLI uses shorthand syntax when passing parameters as json file Eclipse:使用Json编辑器插件自动格式化JSON文件(如AWS Cloudformation Template) - Eclipse: Autoformat JSON file like AWS Cloudformation Template with Json editor plugin
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM