Challenge - 5 Problems
DynamoDB Table Creator
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
What is the output of this DynamoDB table creation command?
Consider this AWS CLI command to create a DynamoDB table named 'Books' with 'ISBN' as the partition key. What will be the result if the command runs successfully?
DynamoDB
aws dynamodb create-table --table-name Books --attribute-definitions AttributeName=ISBN,AttributeType=S --key-schema AttributeName=ISBN,KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
Attempts:
2 left
💡 Hint
Remember that DynamoDB requires at least a partition key and you can specify throughput explicitly.
✗ Incorrect
The command correctly defines a table named 'Books' with 'ISBN' as the partition key (HASH) of type string (S). Provisioned throughput is set to 5 read and 5 write units. No sort key is required.
📝 Syntax
intermediate2:00remaining
Which option contains a syntax error in DynamoDB table creation?
Identify the option that will cause a syntax error when creating a DynamoDB table with a partition key 'UserId' of type string.
Attempts:
2 left
💡 Hint
Check the attribute type values allowed by DynamoDB.
✗ Incorrect
DynamoDB attribute types are single letters like 'S' for string, not full words like 'String'. Option D uses 'String' which is invalid and causes a syntax error.
🧠 Conceptual
advanced2:00remaining
Why is a sort key optional when creating a DynamoDB table?
When creating a DynamoDB table, you can define a partition key alone or both a partition key and a sort key. Why might you choose to omit the sort key?
Attempts:
2 left
💡 Hint
Think about how DynamoDB uses keys to identify items.
✗ Incorrect
The partition key uniquely identifies each item in the table. A sort key is optional and used to organize items with the same partition key. It is not mandatory for uniqueness.
❓ query_result
advanced2:00remaining
What is the output of this DynamoDB table creation with a composite key?
This command creates a table 'Orders' with 'OrderId' as partition key and 'OrderDate' as sort key. What will be the result?
DynamoDB
aws dynamodb create-table --table-name Orders --attribute-definitions AttributeName=OrderId,AttributeType=S AttributeName=OrderDate,AttributeType=S --key-schema AttributeName=OrderId,KeyType=HASH AttributeName=OrderDate,KeyType=RANGE --provisioned-throughput ReadCapacityUnits=10,WriteCapacityUnits=10
Attempts:
2 left
💡 Hint
Check how multiple attributes and keys are defined in the command.
✗ Incorrect
The command correctly defines two attributes and a composite key with partition and sort keys. Provisioned throughput is valid. The table will be created as expected.
🔧 Debug
expert2:00remaining
Why does this DynamoDB table creation command fail?
This command attempts to create a table 'Employees' with 'EmployeeId' as partition key. Why does it fail?
DynamoDB
aws dynamodb create-table --table-name Employees --attribute-definitions AttributeName=EmployeeId,AttributeType=N --key-schema AttributeName=EmployeeId,KeyType=HASH --provisioned-throughput ReadCapacityUnits=0,WriteCapacityUnits=5
Attempts:
2 left
💡 Hint
Check the allowed values for provisioned throughput.
✗ Incorrect
DynamoDB requires ReadCapacityUnits and WriteCapacityUnits to be at least 1. Setting ReadCapacityUnits to 0 causes the command to fail.