本文介绍了在`aws cloudformation deploy --parameter-overrides`中,如何将多个值传递给`List<AWS::EC2::Subnet::ID>`参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用这个 CloudFormation 模板
我试图传递值的 List 参数是:
The List parameter I'm trying to pass values to is:
"Subnets" : {
"Type" : "List<AWS::EC2::Subnet::Id>",
"Description" : "The list of SubnetIds in your Virtual Private Cloud (VPC)",
"ConstraintDescription" : "must be a list of at least two existing subnets associated with at least two different availability zones. They should be residing in the selected Virtual Private Cloud."
},
我写了一个看起来像这样的实用程序脚本:
I've written an utility script that looks like this:
#!/bin/bash
SUBNET1=subnet-abcdef
SUBNET2=subnet-ghijlm
echo -e "\n==Deploying stack.cf.yaml===\n"
aws cloudformation deploy \
--region $REGION \
--profile $CLI_PROFILE \
--stack-name $STACK_NAME \
--template-file stack.cf.json \
--no-fail-on-empty-changeset \
--capabilities CAPABILITY_NAMED_IAM \
--parameter-overrides \
VpcId=$VPC_ID \
Subnets="$SUBNET1 $SUBNET2" \ #<---------------this fails
InstanceType=$EC2_INSTANCE_TYPE \
OperatorEMail=$OPERATOR_EMAIL \
KeyName=$KEY_NAME \
如果我部署这个,一段时间后我的堆栈无法部署,说一个值为subnet-abcdef subnet-ghijlmn"的子网被不存在.
If I deploy this, after a while my stack fails to deploy saying that a Subnet with the value "subnet-abcdef subnet-ghijlmn" does not exist.
推荐答案
将参数传递给列表的正确方法是用逗号分隔它们
The correct way to pass parameters to list is to comma separate them
所以:
#!/bin/bash
SUBNET1=subnet-abcdef
SUBNET2=subnet-ghijlm
aws cloudformation deploy --parameter-overrides Subnets="$SUBNET1,SUBNET2"
会起作用
这篇关于在`aws cloudformation deploy --parameter-overrides`中,如何将多个值传递给`List<AWS::EC2::Subnet::ID>`参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!