【发布时间】:2021-05-07 04:28:46
【问题描述】:
我正在尝试为我的每个表格构建一个模板,并且我正在使用一个表格对其进行测试。但是,我收到了这个错误,我不知道如何解决它:One or more parameter values were invalid: Number of attributes in KeySchema does not exactly match number of attributes defined in AttributeDefinitions (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ValidationException; Request ID: NRTF448TGFEUGUB3H5UH37AGHBVV4KQNSO5AEMVJF66Q9ASUAAJG; Proxy: null)
我使用的模板是这个:
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Resources" : {
"myddbtable": {
"Type" : "AWS::DynamoDB::Table",
"Properties" : {
"AttributeDefinitions" : [
{
"AttributeName": "phoneNumber",
"AttributeType": "S"
},
{
"AttributeName": "fname",
"AttributeType": "S"
},
{
"AttributeName": "lname",
"AttributeType": "S"
}
],
"BillingMode" : "PAY_PER_REQUEST",
"KeySchema" : [
{
"AttributeName" : "phoneNumber",
"KeyType": "HASH"
}
],
"TableName" : "UserTable2"
}
}
}
}
我尝试将 fname 和 lname 属性放在 KeySchema 部分中,KeyType 为 Range,但它也不起作用,有什么想法吗?
【问题讨论】:
-
我们只需要定义索引中使用的那些属性。我看到您没有在任何地方使用 fname 和 lname 。您可以删除这两个并尝试!
标签: amazon-web-services amazon-cloudformation