Most of the time it happens that we load files in a common S3 bucket due to which it becomes hard to figure out data in it.
How can I view objects uploaded on a part
This isn't a general solution, but can be helpful where your objects are named based on date - such as CloudTrail logs. For example, I wanted a list of objects created in June 2019.
aws s3api list-objects-v2 --bucket bucketname --prefix path/2019-06
This does the filtering on the server side. The downside of using the "query" parameter is it downloads a lot of data to filter on the client side. This means potentially a lot of API calls, which cost money, and additional data egress from AWS that you pay for.
Source: https://github.com/aws/aws-sdk-js/issues/2543
Search on a given date
aws s3api list-objects-v2 --bucket BUCKET_NAME --query 'Contents[?contains(LastModified, `YYYY-MM-DD`)].Key'
Search from a certain date to today
aws s3api list-objects-v2 --bucket BUCKET_NAME --query 'Contents[?LastModified>=`YYYY-MM-DD`].Key'
You can optionally remove the .Key
from the end of the query to grab all metadata fields from the s3 objects