0
0
AWScloud~20 mins

Creating a DynamoDB table in AWS - Practice Exercises

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
DynamoDB Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Configuration
intermediate
2:00remaining
DynamoDB Table Partition Key Type
You want to create a DynamoDB table with a partition key named CustomerId that stores string values. Which option correctly defines the partition key attribute in the AWS CLI command?
Aaws dynamodb create-table --table-name Customers --attribute-definitions AttributeName=CustomerId,AttributeType=S --key-schema AttributeName=CustomerId,KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
Baws dynamodb create-table --table-name Customers --attribute-definitions AttributeName=CustomerId,AttributeType=BOOL --key-schema AttributeName=CustomerId,KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
Caws dynamodb create-table --table-name Customers --attribute-definitions AttributeName=CustomerId,AttributeType=B --key-schema AttributeName=CustomerId,KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
Daws dynamodb create-table --table-name Customers --attribute-definitions AttributeName=CustomerId,AttributeType=N --key-schema AttributeName=CustomerId,KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
Attempts:
2 left
💡 Hint
The partition key type must match the data type you plan to store. 'S' stands for string.
Architecture
intermediate
2:00remaining
Choosing a Sort Key for Efficient Queries
You are designing a DynamoDB table to store orders. Each order has a unique OrderId and a timestamp when it was placed. You want to efficiently query all orders for a customer sorted by time. Which key schema is best?
APartition key: OrderTimestamp (number), Sort key: CustomerId (string)
BPartition key: OrderId (string), Sort key: CustomerId (string)
CPartition key: CustomerId (string), Sort key: OrderTimestamp (number)
DPartition key: CustomerId (string) only, no sort key
Attempts:
2 left
💡 Hint
Think about how to group orders by customer and sort them by time.
security
advanced
2:30remaining
IAM Policy for DynamoDB Table Access
You want to create an IAM policy that allows read-only access to a DynamoDB table named Orders. Which policy statement correctly grants this permission?
A{"Effect": "Allow", "Action": ["dynamodb:PutItem", "dynamodb:UpdateItem"], "Resource": "arn:aws:dynamodb:*:*:table/Orders"}
B{"Effect": "Allow", "Action": ["dynamodb:DeleteItem"], "Resource": "arn:aws:dynamodb:*:*:table/Orders"}
C{"Effect": "Deny", "Action": ["dynamodb:GetItem"], "Resource": "arn:aws:dynamodb:*:*:table/Orders"}
D{"Effect": "Allow", "Action": ["dynamodb:GetItem", "dynamodb:Query", "dynamodb:Scan"], "Resource": "arn:aws:dynamodb:*:*:table/Orders"}
Attempts:
2 left
💡 Hint
Read-only actions include GetItem, Query, and Scan.
service_behavior
advanced
2:30remaining
DynamoDB Provisioned Throughput Behavior
You create a DynamoDB table with provisioned throughput of 5 read capacity units and 5 write capacity units. What happens if your application suddenly tries to perform 20 writes per second?
ADynamoDB queues the extra write requests and processes them later without errors.
BDynamoDB throttles the write requests exceeding 5 per second, causing some requests to fail with a ProvisionedThroughputExceededException.
CAll 20 write requests succeed without delay or error.
DDynamoDB automatically increases the write capacity units to 20 to handle the load.
Attempts:
2 left
💡 Hint
Provisioned throughput limits the number of reads and writes per second.
Best Practice
expert
3:00remaining
Designing a DynamoDB Table for High Write Throughput
You expect a very high number of writes per second to your DynamoDB table. Which design choice helps avoid hot partitions and ensures even write distribution?
AUse a partition key with high cardinality and add a random suffix to distribute writes evenly.
BUse a single fixed partition key value for all items to simplify queries.
CUse only a sort key without a partition key to distribute writes.
DUse a partition key with low cardinality and rely on sort key for uniqueness.
Attempts:
2 left
💡 Hint
Think about how DynamoDB partitions data and distributes load.