Nei*_*son 1 amazon-web-services aws-cloudformation
我正在尝试将子网 ID 列表传递给 Cloud 编队模板,但出现错误。我做错了什么?
模板中的参数:
ClusterSubnets:
Description: Subnets, in the same VPC where cluster ec2 instances reside.
Typically private. Use mutiples, each in a different AZ for HA.
Type: "List<AWS::EC2::Subnet::Id>"
Run Code Online (Sandbox Code Playgroud)
来自 json 文件的参数片段:
{
"ParameterKey": "ClusterSubnets",
"ParameterValue": [ "subnet-8fc8c4f7" ]
},
Run Code Online (Sandbox Code Playgroud)
结果:参数验证失败:参数参数 [1].ParameterValue 的类型无效,值:[u'subnet-8fc8c4f7'],类型:类型“列表”,有效类型:类型“basestring”
小智 5
我知道这个线程已经有一年了,我假设你正在使用 aws cli 创建堆栈,但我遇到了同样的问题,最后偶然发现了答案。给予应有的信用:https : //github.com/aws/aws-cli/issues/2478#issuecomment-427167512
用反斜杠转义“,”,它将解决问题。在我的情况下,这是在 jekins 工作中抨击,所以我不得不加倍反斜杠:
sh "aws cloudformation create-stack --template-url ${TEMPLATE} \
--stack-name $NAME \
--capabilities CAPABILITY_IAM \
--parameters ParameterKey=SecurityGroups,ParameterValue=\"$SG_GROUP2\\,$SG_GROUP1\"; \
aws cloudformation wait stack-create-complete --stack-name $CLUSTER_NAME"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2786 次 |
| 最近记录: |