Complete the code to create a DynamoDB table with a primary key named 'UserId'.
aws dynamodb create-table --table-name Users --attribute-definitions AttributeName=UserId,AttributeType=S --key-schema AttributeName=[1],KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
The primary key must match the attribute name defined in the attribute definitions. Here, 'UserId' is the correct primary key.
Complete the code to add a Global Secondary Index named 'EmailIndex' with 'Email' as the partition key.
aws dynamodb update-table --table-name Users --attribute-definitions AttributeName=Email,AttributeType=S --global-secondary-index-updates '[{"Create":{"IndexName":"EmailIndex","KeySchema":[{"AttributeName":"[1]","KeyType":"HASH"}],"Projection":{"ProjectionType":"ALL"},"ProvisionedThroughput":{"ReadCapacityUnits":5,"WriteCapacityUnits":5}}}]'
The Global Secondary Index uses 'Email' as the partition key, so the KeySchema must specify 'Email'.
Fix the error in the command to delete the DynamoDB table named 'Users'.
aws dynamodb [1] --table-name UsersThe correct AWS CLI command to delete a DynamoDB table is 'delete-table'.
Fill both blanks to create a DynamoDB table with a composite primary key: 'UserId' as partition key and 'Timestamp' as sort key.
aws dynamodb create-table --table-name UserActivity --attribute-definitions AttributeName=[1],AttributeType=S AttributeName=[2],AttributeType=N --key-schema AttributeName=UserId,KeyType=HASH AttributeName=Timestamp,KeyType=RANGE --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
The attribute definitions must include both keys used in the key schema: 'UserId' (partition key) and 'Timestamp' (sort key).
Fill all three blanks to write a command that puts an item with 'UserId', 'Timestamp', and 'Activity' attributes into the 'UserActivity' table.
aws dynamodb put-item --table-name UserActivity --item '{"UserId": {"S": "[1]"}, "Timestamp": {"N": "[2]"}, "Activity": {"S": "[3]"}}'
The item must include a string 'UserId', a number 'Timestamp', and a string 'Activity'. Here, 'user123', '1680000000', and 'Login' are valid example values.