Reputation: 459
I have a cloudformation template in which I send a JSON parameters file over. 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?enter code here
Upvotes: 2
Views: 3881
Reputation: 760
This is a known problem with Cloudformation. You can use comma demlimited list as parameter type.
Cloudformation Template (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
Upvotes: 5