Which solution will meet these requirements?
Store username and label values as S3 object tags. Retrieve and index the objects based on the tag by calling the describe-tags API with the username and label value.
Store username and label values as S3 object metadata keys. Include the “x-amz-meta-” prefix for each key. Search by metadata to find all the objects that share the username and label value.
Insert an item for each S3 key, label, and user combination into an Amazon DynamoDB table. Create a global secondary index with the username as the partition key and the label as the sort key. Call the QueryItem API on the index to find all the objects that share the username and label value
Insert an item for each S3 key, label, and user combination into an Amazon DynamoDB global secondary index. Define the username as the partition key. Define the label as the sort key. Call the QueryItem API on the index to find all the objects that share the username and label value.
Explanations:
S3 object tags are useful for categorizing objects but are not ideal for querying based on multiple attributes. The describe-tags API does not support efficient searching for label combinations, and managing relationships between usernames and labels in this way would not provide quick access to related photos.
While storing username and label values as S3 object metadata can work, querying by metadata is limited and inefficient. S3 does not support direct searching capabilities by metadata, making it challenging to retrieve all objects associated with a particular username and label value effectively.
This option correctly utilizes Amazon DynamoDB to store relationships between S3 keys, labels, and users, allowing efficient querying. By creating a global secondary index with username as the partition key and label as the sort key, the QueryItem API can efficiently retrieve all objects associated with a specific username and label.
This option mentions inserting items into a DynamoDB global secondary index, which is misleading as GSI is used to provide alternate query patterns for items in a table, not to store items themselves. The correct approach is to store items in a DynamoDB table and then use a GSI for efficient querying. Hence, this option does not effectively meet the requirements.