如何解决CloudFormation create_stack 需要参数
我正在尝试创建一个用于制作 DynamoDB 表的 Cloud Formation 堆栈。我只是使用 AWS 提供的示例模板。
response = cf.create_stack(
StackName = stack_name,TemplateURL = 'https://s3.us-west-2.amazonaws.com/cloudformation-templates-us-west-2/DynamoDB_Table.template',Parameters=[
{
'ParameterKey': 'AudioFiles','ParameterValue': 'string',},],TimeoutInMinutes=123,ResourceTypes=[
'AWS::DynamoDB::Table',OnFailure='DO_nothing',EnableTerminationProtection=True
)
它返回此错误:
调用 CreateStack 操作时发生错误(ValidationError):参数:[HashKeyElementName] must have values
我已尝试在参数部分中为此参数提供值,但这不起作用。
解决方法
我这样做很傻
Parameters=[
{
'HashKeyElementName': 'AudioFiles','ParameterValue': String',},],
代替这个
Parameters=[
{
'ParameterKey': 'HashKeyElementName','ParameterValue': 'AudioFiles',
,
您似乎没有提供 HashKeyElementName
参数的值。
response = cf.create_stack(
StackName = stack_name,TemplateURL = 'https://s3.us-west-2.amazonaws.com/cloudformation-templates-us-west-2/DynamoDB_Table.template',Parameters=[
{
'ParameterKey': 'AudioFiles','ParameterValue': 'string','ParameterKey': 'HashKeyElementName','ParameterValue' : 'value'
},TimeoutInMinutes=123,ResourceTypes=[
'AWS::DynamoDB::Table',OnFailure='DO_NOTHING',EnableTerminationProtection=True
)
在模板中,除HashKeyElementName
外,所有参数均已默认
模板摘录
"Parameters" : {
"HashKeyElementName" : {
"Description" : "HashType PrimaryKey Name","Type" : "String","AllowedPattern" : "[a-zA-Z0-9]*","MinLength": "1","MaxLength": "2048","ConstraintDescription" : "must contain only alphanumberic characters"
},"HashKeyElementType" : {
"Description" : "HashType PrimaryKey Type","Default" : "S","AllowedPattern" : "[S|N]","MaxLength": "1","ConstraintDescription" : "must be either S or N"
},"ReadCapacityUnits" : {
"Description" : "Provisioned read throughput","Type" : "Number","Default" : "5","MinValue": "5","MaxValue": "10000","ConstraintDescription" : "must be between 5 and 10000"
},"WriteCapacityUnits" : {
"Description" : "Provisioned write throughput","Default" : "10","ConstraintDescription" : "must be between 5 and 10000"
}
},
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。