How can I list all S3 objects uploaded in a specific S3 bucket in the last hour?
I am using the below code to list objects but the problem is my_bucket is having more than a million objects:
import boto3
client = boto3.client('s3',
aws_access_key_id=s3_access_id,
aws_secret_access_key=s3_secret_access_key)
get_folder_objects = client.list_objects_v2(
Bucket='my_bucket',
Delimiter='',
EncodingType='url',
MaxKeys=1000,
Prefix='api/archive/ls.s3.',
FetchOwner=False,
StartAfter=''
)
Although it is not giving me the results in the sorted order by last modified date of the S3 object. My file names are like in the below format: "ls.s3.fa74a3f1-fc08-4955-809d-f323304f7496.2020-06-29T13.00.part107458.txt"
I have looked for this sort of question everywhere but no one was able to answer it correctly. Some said that it is not at all possible in Python.
Please help me with this, I shall be highly thankful to you.