Skip to content

Instantly share code, notes, and snippets.

@huytv593
huytv593 / all_s3_objects.rb
Created June 28, 2017 09:49 — forked from brianhempel/all_s3_objects.rb
List/fetch all objects in a bucket with AWS::S3 Ruby gem
# by default you only get 1000 objects at a time
# so you have to roll your own cursor
S3.connect!
objects = []
last_key = nil
begin
new_objects = AWS::S3::Bucket.objects(bucket_name, :marker => last_key)
objects += new_objects