Complete the code to specify the type of index when creating a DynamoDB table.
TableName: 'Music', KeySchema: [ { AttributeName: 'Artist', KeyType: 'HASH' }, { AttributeName: 'SongTitle', KeyType: 'RANGE' } ], GlobalSecondaryIndexes: [{ IndexName: 'GenreIndex', KeySchema: [ { AttributeName: 'Genre', KeyType: 'HASH' } ], Projection: { ProjectionType: 'ALL' }, ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 }, IndexType: '[1]' }]
The correct index type for a global secondary index is GLOBAL. Local secondary indexes use LOCAL.
Complete the code to set the read capacity units for a DynamoDB table.
ProvisionedThroughput: {
ReadCapacityUnits: [1],
WriteCapacityUnits: 10
}Read capacity units must be a positive integer. 5 is a valid value.
Fix the error in the code by choosing the correct attribute to project in the index.
Projection: {
ProjectionType: '[1]'
}The ALL projection type includes all attributes from the base table in the index.
Fill both blanks to correctly define the provisioned throughput for a global secondary index.
ProvisionedThroughput: {
ReadCapacityUnits: [1],
WriteCapacityUnits: [2]
}Read capacity units are set to 5 and write capacity units to 10 for balanced throughput.
Fill all three blanks to create a dictionary that maps index names to their read capacity units, filtering only indexes with read capacity greater than 5.
index_read_capacity = {index['IndexName']: index['ProvisionedThroughput']['ReadCapacityUnits'] for index in indexes if index['ProvisionedThroughput']['ReadCapacityUnits'] [1] [2]
filtered_index_read_capacity = {k: v for k, v in index_read_capacity.items() if v [3] 5}The first condition filters indexes with read capacity units greater than 10, and the second filters those with values greater than 5.