In DynamoDB, when you add a Global Secondary Index (GSI) to a table, how does it impact the write capacity units (WCUs) consumed?
Think about how data is duplicated in GSIs.
When you write to a table with a GSI, DynamoDB writes the data to both the base table and the GSI, so write capacity is consumed for both.
You have a DynamoDB table with 4 KB items. You query a Local Secondary Index (LSI) and retrieve 3 items. How many read capacity units (RCUs) are consumed if you use eventually consistent reads?
Each 4 KB item read with eventually consistent reads consumes 0.5 RCU.
Each 4 KB item read with eventually consistent reads consumes 0.5 RCU. For 3 items, total is 3 * 0.5 = 1.5, rounded up to 2 RCUs.
Which of the following AWS CLI commands correctly creates a Global Secondary Index (GSI) with provisioned read and write capacity?
aws dynamodb update-table --table-name Music --attribute-definitions AttributeName=Artist,AttributeType=S AttributeName=AlbumTitle,AttributeType=S --global-secondary-index-updates '[{"Create":{"IndexName":"ArtistAlbumIndex","KeySchema":[{"AttributeName":"Artist","KeyType":"HASH"},{"AttributeName":"AlbumTitle","KeyType":"RANGE"}],"Projection":{"ProjectionType":"ALL"},"ProvisionedThroughput":{"ReadCapacityUnits":5,"WriteCapacityUnits":5}}}]'Check the JSON structure inside the --global-secondary-index-updates parameter.
The command correctly specifies the GSI creation with KeySchema, Projection, and ProvisionedThroughput inside the Create object.
You have a DynamoDB table with a large number of items. You frequently query by a non-key attribute. Which approach optimizes read capacity usage?
Think about how indexes reduce the amount of data scanned.
Creating a GSI on the attribute allows efficient queries using indexed keys, reducing read capacity usage compared to scanning.
A DynamoDB table has two GSIs. Suddenly, write capacity usage spikes unexpectedly. Which is the most likely cause?
Consider how projected attributes affect write costs.
Large projected attributes in GSIs increase the amount of data written to the index, raising write capacity consumption.