nik*_*etp 2 parameters json yaml amazon-web-services aws-cloudformation
我有一个 cloudformation 模板,我在其中发送 JSON 参数文件。这不是一个真正的问题,因为我的参数文件过去看起来像这样:
[
"InstanceType=t2.medium",
"AmiStack=amilookup-stack"
]
Run Code Online (Sandbox Code Playgroud)
但是,我想向参数文件添加一个列表,如下所示:
[
"InstanceType=t2.medium",
"AmiStack=amilookup-stack",
[
"CertificateArn1=arn:aws:acm:us-east-1:xxx",
"CertificateArn2=arn:aws:acm:us-east-1:xxy",
]
]
Run Code Online (Sandbox Code Playgroud)
在我的参数 json 文件中表达这一点的最佳方式是什么,以及如何在 cloudformation 模板本身中表达这一点?enter code here
小智 5
这是 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"
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
参数.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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3325 次 |
| 最近记录: |