0
0
DynamoDBquery~10 mins

AWS Console and DynamoDB setup - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a DynamoDB table with a primary key named 'UserId'.

DynamoDB
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
Drag options to blanks, or click blank then click option'
AUsername
BUserId
CEmail
DId
Attempts:
3 left
💡 Hint
Common Mistakes
Using a key name not defined in attribute definitions
Mismatching attribute names
2fill in blank
medium

Complete the code to add a Global Secondary Index named 'EmailIndex' with 'Email' as the partition key.

DynamoDB
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}}}]'
Drag options to blanks, or click blank then click option'
AUserId
BId
CEmail
DUsername
Attempts:
3 left
💡 Hint
Common Mistakes
Using the table's primary key instead of the index key
Mismatching attribute names in KeySchema
3fill in blank
hard

Fix the error in the command to delete the DynamoDB table named 'Users'.

DynamoDB
aws dynamodb [1] --table-name Users
Drag options to blanks, or click blank then click option'
Adelete-table
Bremove-table
Cdrop-table
Ddestroy-table
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent commands like 'remove-table' or 'drop-table'
4fill in blank
hard

Fill both blanks to create a DynamoDB table with a composite primary key: 'UserId' as partition key and 'Timestamp' as sort key.

DynamoDB
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
Drag options to blanks, or click blank then click option'
AUserId
BTimestamp
CActivity
DDate
Attempts:
3 left
💡 Hint
Common Mistakes
Missing attribute definitions for sort key
Using wrong attribute names
5fill in blank
hard

Fill all three blanks to write a command that puts an item with 'UserId', 'Timestamp', and 'Activity' attributes into the 'UserActivity' table.

DynamoDB
aws dynamodb put-item --table-name UserActivity --item '{"UserId": {"S": "[1]"}, "Timestamp": {"N": "[2]"}, "Activity": {"S": "[3]"}}'
Drag options to blanks, or click blank then click option'
Auser123
B1680000000
CLogin
DLogout
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong data types for attributes
Mismatching attribute names