0
0
DynamoDBquery~20 mins

Table creation with AWS SDK in DynamoDB - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
DynamoDB Table Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Configuration
intermediate
2:00remaining
Creating a DynamoDB table with correct key schema
Which option correctly creates a DynamoDB table named Users with a primary key UserId of type string using AWS SDK for JavaScript v3?
Aconst params = { TableName: 'Users', KeySchema: [{ AttributeName: 'UserId', KeyType: 'HASH' }], AttributeDefinitions: [{ AttributeName: 'UserId', AttributeType: 'B' }], BillingMode: 'PROVISIONED' };
Bconst params = { TableName: 'Users', KeySchema: [{ AttributeName: 'UserId', KeyType: 'RANGE' }], AttributeDefinitions: [{ AttributeName: 'UserId', AttributeType: 'S' }], BillingMode: 'PAY_PER_REQUEST' };
Cconst params = { TableName: 'Users', KeySchema: [{ AttributeName: 'UserId', KeyType: 'HASH' }], AttributeDefinitions: [{ AttributeName: 'UserId', AttributeType: 'N' }], BillingMode: 'PAY_PER_REQUEST' };
Dconst params = { TableName: 'Users', KeySchema: [{ AttributeName: 'UserId', KeyType: 'HASH' }], AttributeDefinitions: [{ AttributeName: 'UserId', AttributeType: 'S' }], BillingMode: 'PAY_PER_REQUEST' };
Attempts:
2 left
💡 Hint
Remember the primary key must be of type string and use 'HASH' as KeyType for partition key.
service_behavior
intermediate
2:00remaining
Understanding billing mode impact on DynamoDB table
What is the main difference in behavior between PAY_PER_REQUEST and PROVISIONED billing modes when creating a DynamoDB table?
APAY_PER_REQUEST charges based on actual read/write requests; PROVISIONED requires specifying capacity units upfront.
BPAY_PER_REQUEST requires specifying capacity units upfront; PROVISIONED charges based on actual usage.
CBoth modes require specifying capacity units but differ in cost per unit.
DPROVISIONED mode automatically scales capacity based on traffic; PAY_PER_REQUEST does not.
Attempts:
2 left
💡 Hint
Think about how you pay for the table usage in each mode.
Architecture
advanced
2:30remaining
Designing a DynamoDB table with composite primary key
You want to create a DynamoDB table named Orders where each order is uniquely identified by OrderId and CustomerId. Which option correctly defines the key schema for this composite primary key?
AKeySchema: [{ AttributeName: 'OrderId', KeyType: 'HASH' }, { AttributeName: 'CustomerId', KeyType: 'RANGE' }], AttributeDefinitions: [{ AttributeName: 'OrderId', AttributeType: 'S' }, { AttributeName: 'CustomerId', AttributeType: 'S' }]
BKeySchema: [{ AttributeName: 'CustomerId', KeyType: 'HASH' }, { AttributeName: 'OrderId', KeyType: 'RANGE' }], AttributeDefinitions: [{ AttributeName: 'OrderId', AttributeType: 'S' }, { AttributeName: 'CustomerId', AttributeType: 'S' }]
CKeySchema: [{ AttributeName: 'OrderId', KeyType: 'RANGE' }, { AttributeName: 'CustomerId', KeyType: 'HASH' }], AttributeDefinitions: [{ AttributeName: 'OrderId', AttributeType: 'S' }, { AttributeName: 'CustomerId', AttributeType: 'S' }]
DKeySchema: [{ AttributeName: 'OrderId', KeyType: 'HASH' }, { AttributeName: 'CustomerId', KeyType: 'HASH' }], AttributeDefinitions: [{ AttributeName: 'OrderId', AttributeType: 'S' }, { AttributeName: 'CustomerId', AttributeType: 'S' }]
Attempts:
2 left
💡 Hint
The partition key is HASH and the sort key is RANGE in a composite key.
security
advanced
2:00remaining
IAM policy for creating DynamoDB tables
Which IAM policy statement correctly allows a user to create DynamoDB tables but restricts deleting tables?
A{"Effect": "Deny", "Action": ["dynamodb:DeleteTable"], "Resource": "*"}
B{"Effect": "Allow", "Action": ["dynamodb:CreateTable"], "Resource": "*"}
C{"Effect": "Allow", "Action": ["dynamodb:CreateTable", "dynamodb:DeleteTable"], "Resource": "*"}
D{"Effect": "Allow", "Action": ["dynamodb:*"], "Resource": "*"}
Attempts:
2 left
💡 Hint
Allow only the create action and do not include delete.
Best Practice
expert
3:00remaining
Choosing partition key for high throughput DynamoDB table
You expect a DynamoDB table to receive thousands of requests per second. Which partition key design best supports even data distribution and avoids hot partitions?
AUse a single attribute with low cardinality, like a boolean flag, as the partition key.
BUse a monotonically increasing number as the partition key.
CUse a composite key combining a high-cardinality attribute and a timestamp prefix as partition key.
DUse a fixed string value as the partition key for all items.
Attempts:
2 left
💡 Hint
Think about how to spread requests evenly across partitions.