我使用下面的python代码在AWS中创建堆栈,我希望将值作为其中一个参数的列表/数组发送,但是Im获取错误如下:
import boto3
import time
date = time.strftime("%Y%m%d")
time = time.strftime("%H%M%S")
stackname = 'FulfillSNSELB'
client = boto3.client('cloudformation')
response = client.create_stack(
StackName= (stackname + '-' + date + '-' + time),
TemplateURL='https://s3.amazonaws.com/****/**/myapp.json',
Parameters=[
{
'ParameterKey': 'Subnets',
'ParameterValue': 'subnet-1,subnet-2',
'Type':'CommaDelimitedList',
'UsePreviousValue': False
}]
)
def lambda_handler(event, context):
return(response)module initialization error: Parameter validation failed:
Unknown parameter in Parameters[15]: "Type", must be one of: ParameterKey, ParameterValue, UsePreviousValue发布于 2016-03-22 19:16:06
正如您正确地观察到的,Type不能指定为create_stack()中的参数。
相反,您应该在模板TemplateURL='https://s3.amazonaws.com/****/**/myapp.json'中指定类型,以便接受逗号分隔值'ParameterValue': 'subnet-1,subnet-2'。
接受CommaDelimitedList作为参数的示例模板。
"Parameters" : {
"DbSubnetIpBlocks": {
"Description": "Comma-delimited list of three CIDR blocks",
"Type": "CommaDelimitedList",
"Default": "10.0.48.0/24, 10.0.112.0/24, 10.0.176.0/24"
}
}在您的例子中,堆栈应该如下所示:
"Parameters" : {
"Subnets": {
"Description": "Comma-delimited list of CIDR blocks",
"Type": "CommaDelimitedList",
"Default": "10.0.48.0/24"
}
}现在您可以创建堆栈,而无需指定Type。
https://stackoverflow.com/questions/36161891
复制相似问题