0
0
DynamoDBquery~10 mins

Table creation with AWS SDK in DynamoDB - Interactive Code Practice

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

Complete the code to specify the AWS SDK method to create a DynamoDB table.

DynamoDB
const params = { TableName: 'Users', KeySchema: [{ AttributeName: 'UserId', KeyType: 'HASH' }], AttributeDefinitions: [{ AttributeName: 'UserId', AttributeType: 'S' }], ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 } };
dynamodb.[1](params, function(err, data) { if (err) console.log(err); else console.log(data); });
Drag options to blanks, or click blank then click option'
AdeleteTable
BlistTables
CupdateTable
DcreateTable
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'deleteTable' instead of 'createTable'.
Using 'listTables' which only lists existing tables.
2fill in blank
medium

Complete the code to specify the primary key attribute type for the DynamoDB table.

DynamoDB
const params = { TableName: 'Orders', KeySchema: [{ AttributeName: 'OrderId', KeyType: 'HASH' }], AttributeDefinitions: [{ AttributeName: 'OrderId', AttributeType: '[1]' }], ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 } };
Drag options to blanks, or click blank then click option'
AB
BN
CS
DBOOL
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'BOOL' which is not valid for key attributes.
Using 'B' which stands for Binary but is less common.
3fill in blank
hard

Fix the error in the ProvisionedThroughput configuration by completing the missing property name.

DynamoDB
const params = { TableName: 'Products', KeySchema: [{ AttributeName: 'ProductId', KeyType: 'HASH' }], AttributeDefinitions: [{ AttributeName: 'ProductId', AttributeType: 'S' }], ProvisionedThroughput: { [1]: 10, WriteCapacityUnits: 10 } };
Drag options to blanks, or click blank then click option'
AReadCapacityUnits
BReadUnits
CReadThroughput
DReadCapacity
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ReadUnits' which is not a valid property.
Using 'ReadCapacity' missing 'Units' suffix.
4fill in blank
hard

Fill both blanks to define a global secondary index with a partition key and projection type.

DynamoDB
const params = { TableName: 'Employees', KeySchema: [{ AttributeName: 'EmployeeId', KeyType: 'HASH' }], AttributeDefinitions: [{ AttributeName: 'EmployeeId', AttributeType: 'S' }, { AttributeName: 'Department', AttributeType: 'S' }], GlobalSecondaryIndexes: [{ IndexName: 'DeptIndex', KeySchema: [{ AttributeName: '[1]', KeyType: 'HASH' }], Projection: { ProjectionType: '[2]' }, ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 } }] };
Drag options to blanks, or click blank then click option'
ADepartment
BEmployeeId
CALL
DKEYS_ONLY
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'EmployeeId' as index key which is the main table key.
Using 'KEYS_ONLY' when full attributes are needed.
5fill in blank
hard

Fill all three blanks to create a DynamoDB table with a composite primary key and set throughput.

DynamoDB
const params = { TableName: 'Sales', KeySchema: [{ AttributeName: '[1]', KeyType: 'HASH' }, { AttributeName: '[2]', KeyType: 'RANGE' }], AttributeDefinitions: [{ AttributeName: '[1]', AttributeType: 'S' }, { AttributeName: '[2]', AttributeType: 'N' }], ProvisionedThroughput: { ReadCapacityUnits: 20, WriteCapacityUnits: 10 } };
Drag options to blanks, or click blank then click option'
AOrderId
BTimestamp
CCustomerId
DProductId
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same attribute for both HASH and RANGE keys.
Mismatching attribute types in AttributeDefinitions.