gpt4 book ai didi

aws-cloudformation - 在 `aws cloudformation deploy --parameter-overrides` 中,如何将多个值传递给 `List` 参数?

转载 作者:行者123 更新时间:2023-12-03 07:12:13 35 4
gpt4 key购买 nike

我正在使用this CloudFormation template

我尝试传递值的列表参数是:

"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."
},

我编写了一个实用程序脚本,如下所示:

#!/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-abcdefsubnet-ghijlmn”的子网不存在。

最佳答案

向列表传递参数的正确方法是用逗号分隔它们

所以:

#!/bin/bash
SUBNET1=subnet-abcdef
SUBNET2=subnet-ghijlm
aws cloudformation deploy --parameter-overrides Subnets="$SUBNET1,SUBNET2"

可以工作

关于aws-cloudformation - 在 `aws cloudformation deploy --parameter-overrides` 中,如何将多个值传递给 `List<AWS::EC2::Subnet::ID>` 参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67347160/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com