繁体   English   中英

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

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

我有一个cloudformation模板,在其中发送JSON参数文件。 这不是一个真正的问题,因为我的参数文件以前看起来像这样:

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

但是,我想向参数文件添加一个列表,如下所示:

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

在我的参数json文件中表达此信息的最佳方法是什么,以及如何在cloudformation模板本身中表达此信息? enter code here

这是Cloudformation的已知问题 您可以使用逗号分隔列表作为参数类型。

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

[
  {
    "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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM