RayJoe
RayJoe

Reputation: 3

Get records after a certain record in S3

We publish files to S3. We store the files in the following folder format:

year/month/day/hour/minute/second/fileName

When reading from this bucket, consumers can use prefix and query on daily or hourly frequency.

Is there a way in S3 to get objects that were published AFTER a particular object?

Upvotes: 0

Views: 1518

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 270134

The Amazon S3 GET BUCKET API call has a marker parameter:

Specifies the key to start with when listing objects in a bucket. Amazon S3 returns object keys in UTF-8 binary order, starting with key after the marker in order.

Combined with the prefix parameter, this should be able to list the 'next object' in a particular path.

The equivalent from the AWS Command-Line Interface (CLI) would be list-objects, eg:

aws s3api list-objects --bucket MY-BUCKET --prefix MY-PATH
  --starting-token KEY-TO-START-AFTER

(I tried it -- it works!)

Upvotes: 1

Related Questions