Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS S3 API - search by meta data

I use AWS s3 for storing few thousand files per hour and it works like a charm. I'm curious to see if I can filter them based on time or date or any meta data I have with these objects. I'm able to run a node process to get the objects list and play around for date and time but not meta data. Is there any other way do it or a better option ?.

like image 967
Arun Avatar asked Nov 23 '15 22:11

Arun


People also ask

Can Athena query metadata S3?

Amazon Athena automatically stores query results and metadata information for each query that runs in a query result location that you can specify in Amazon S3. If necessary, you can access the files in this location to work with them.

Is S3 searchable?

Our solution is built with Amazon S3 event notifications, AWS Lambda, AWS Glue Catalog, and Amazon Athena. These services allow you to search thousands of objects in an S3 bucket by filenames, object metadata, and object keys.

Are S3 tags metadata?

Tags are not the same thing as object metadata in S3. Metadata applies only to that object in S3 and cannot be searched on, as you can search with tags.

How do I check data on AWS S3?

Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/ . In the Buckets list, choose the name of the bucket that contains the object. In the Objects list, choose the name of the object for which you want an overview. The object overview opens.


1 Answers

No, you cannot filter on metadata with the S3 API.

To do what you're asking, you would need to List Objects (GET Bucket) on the bucket to get all the keys, then individually ask for metadata for each key (HEAD Object). Then in your own code, you can filter out objects that don't match.

Obviously, this would be very slow to run live if you have more than a few thousand objects. You'll want to either filter down to a manageable number based on prefix or keep an index yourself (elastic search, maybe?). It's common to encode some metadata in the object keys so that you can filter by prefix.

like image 196
Nathaniel Waisbrot Avatar answered Oct 11 '22 15:10

Nathaniel Waisbrot