0
0
AWScloud~10 mins

Why DynamoDB for NoSQL in AWS - Test Your Understanding

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.

AWS
aws dynamodb create-table --table-name Users --attribute-definitions AttributeName=UserId,AttributeType=S --key-schema AttributeName=UserId,KeyType=[1] --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
Drag options to blanks, or click blank then click option'
AINDEX
BHASH
CPRIMARY
DRANGE
Attempts:
3 left
💡 Hint
Common Mistakes
Using RANGE instead of HASH for the primary key.
Confusing key types with index types.
2fill in blank
medium

Complete the code to add a Global Secondary Index (GSI) to the DynamoDB table.

AWS
aws dynamodb update-table --table-name Users --attribute-definitions AttributeName=Email,AttributeType=S --global-secondary-index-updates '[{"Create":{"IndexName":"EmailIndex","KeySchema":[{"AttributeName":"Email","KeyType":"[1]"}],"Projection":{"ProjectionType":"ALL"},"ProvisionedThroughput":{"ReadCapacityUnits":5,"WriteCapacityUnits":5}}}]'
Drag options to blanks, or click blank then click option'
AHASH
BRANGE
CPRIMARY
DSORT
Attempts:
3 left
💡 Hint
Common Mistakes
Using RANGE instead of HASH for the GSI partition key.
Confusing primary key with index key.
3fill in blank
hard

Fix the error in the DynamoDB query to get an item by its primary key.

AWS
aws dynamodb get-item --table-name Users --key '{"UserId": {"[1]": "12345"}}'
Drag options to blanks, or click blank then click option'
ASS
BN
CBOOL
DS
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'N' which is for numbers.
Using 'BOOL' which is for boolean values.
4fill in blank
hard

Fill both blanks to write a DynamoDB update expression that sets a new attribute and increments a counter.

AWS
aws dynamodb update-item --table-name Users --key '{"UserId": {"S": "12345"}}' --update-expression "SET [1] = :val, [2] = [2] + :inc" --expression-attribute-values '{":val": {"S": "active"}, ":inc": {"N": "1"}}'
Drag options to blanks, or click blank then click option'
AStatus
BCounter
CAge
DScore
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same attribute for both set and increment.
Using attributes that do not exist in the table.
5fill in blank
hard

Fill all three blanks to write a DynamoDB query that filters items with Age greater than 25 and projects only Name and Age.

AWS
aws dynamodb scan --table-name Users --filter-expression "[1] > :age" --expression-attribute-names '{"#N": "[2]", "#A": "[3]"}' --expression-attribute-values '{":age": {"N": "25"}}' --projection-expression "#N, #A"
Drag options to blanks, or click blank then click option'
AAge
BName
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing attribute names in filter and projection expressions.
Not using expression attribute names for reserved words.