我正在尝试为我想要创建的发电机数据库表创建云形成模板。我想要表中的以下字段:guid,uniqueid,service。
如何将guid和service作为数组的主键。
这就是我所拥有的
{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"UsersUniqueIdsTableName": {
"Description": "Table name to use",
"Type": "String",
"Default": "test-db-user-unique-ids"
},
"UniqueIdsReadCapacityUnits": {
"Description": "Provisioned read throughput",
"Type": "Number",
"Default": "1",
"MinValue": "1",
"MaxValue": "10000",
"ConstraintDescription": "must be between 1 and 10000"
},
"UniqueIdsWriteCapacityUnits": {
"Description": "Provisioned write throughput",
"Type": "Number",
"Default": "1",
"MinValue": "1",
"MaxValue": "10000",
"ConstraintDescription": "must be between 1 and 10000"
}
},
"Resources": {
"marvelUsers": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"TableName": {
"Ref": "UsersUniqueIdsTableName"
},
"AttributeDefinitions": [
{
"AttributeName": "guid",
"AttributeType": "S"
},
{
"AttributeName": "service",
"AttributeType": "S"
},
{
"AttributeName": "uniqueid",
"AttributeType": "S"
}
],
"KeySchema": [
{
"AttributeName": "guid",
"KeyType": "HASH"
}
],
"GlobalSecondaryIndexes": [
{
"IndexName": "unique",
"KeySchema": [
{
"AttributeName": "reminder_day",
"KeyType": "HASH"
}
],
"Projection": {
"ProjectionType": "ALL"
},
"ProvisionedThroughput": {
"ReadCapacityUnits": {
"Ref": "UniqueIdsReadCapacityUnits"
},
"WriteCapacityUnits": {
"Ref": "UniqueIdsWriteCapacityUnits"
}
}
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": {
"Ref": "UniqueIdsReadCapacityUnits"
},
"WriteCapacityUnits": {
"Ref": "UniqueIdsUsersWriteCapacityUnits"
}
}
}
}
}
}
答案 0 :(得分:0)
Dynamodb分区或排序键应该是标量数据类型(即字符串,数字,布尔值等)。地图,列表,集等文档数据类型不能是关键属性的一部分。