Complete the code to specify the primary key attribute name for the DynamoDB table.
{
"TableName": "MyTable",
"KeySchema": [
{
"AttributeName": "[1]",
"KeyType": "HASH"
}
],
"AttributeDefinitions": [
{
"AttributeName": "Id",
"AttributeType": "S"
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": 5,
"WriteCapacityUnits": 5
}
}The primary key attribute name must match the attribute defined in AttributeDefinitions. Here, it is Id.
Complete the code to specify the attribute type for the primary key in DynamoDB.
{
"TableName": "MyTable",
"KeySchema": [
{
"AttributeName": "Id",
"KeyType": "HASH"
}
],
"AttributeDefinitions": [
{
"AttributeName": "Id",
"AttributeType": "[1]"
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": 5,
"WriteCapacityUnits": 5
}
}The attribute type S stands for string, which is commonly used for primary keys in DynamoDB.
Fix the error in the ProvisionedThroughput configuration by completing the missing value.
{
"TableName": "MyTable",
"KeySchema": [
{
"AttributeName": "Id",
"KeyType": "HASH"
}
],
"AttributeDefinitions": [
{
"AttributeName": "Id",
"AttributeType": "S"
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": [1],
"WriteCapacityUnits": 5
}
}Provisioned throughput values must be positive integers. 5 is a valid and common value.
Fill both blanks to add a sort key attribute named 'Timestamp' of type number.
{
"TableName": "MyTable",
"KeySchema": [
{
"AttributeName": "Id",
"KeyType": "HASH"
},
{
"AttributeName": "[1]",
"KeyType": "RANGE"
}
],
"AttributeDefinitions": [
{
"AttributeName": "Id",
"AttributeType": "S"
},
{
"AttributeName": "Timestamp",
"AttributeType": "[2]"
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": 5,
"WriteCapacityUnits": 5
}
}The sort key attribute name is 'Timestamp' and its type is 'N' for number.
Fill all three blanks to create a global secondary index named 'GSI1' with a partition key 'Category' of type string and provisioned throughput of 10 read and 5 write units.
{
"TableName": "MyTable",
"AttributeDefinitions": [
{
"AttributeName": "Id",
"AttributeType": "S"
},
{
"AttributeName": "Category",
"AttributeType": "S"
}
],
"KeySchema": [
{
"AttributeName": "Id",
"KeyType": "HASH"
}
],
"GlobalSecondaryIndexes": [
{
"IndexName": "[1]",
"KeySchema": [
{
"AttributeName": "[2]",
"KeyType": "HASH"
}
],
"Projection": {
"ProjectionType": "ALL"
},
"ProvisionedThroughput": {
"ReadCapacityUnits": [3],
"WriteCapacityUnits": 5
}
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": 5,
"WriteCapacityUnits": 5
}
}The global secondary index is named 'GSI1', uses 'Category' as the partition key, and has 10 read capacity units.