AWS SDK for Ruby
Developer Guide

Getting Information about Amazon S3 Bucket Items

A presigned URL gives you access to the object identified in the URL, if the creator of the presigned URL has permissions to access that object. You can use a presigned URL to allow a user to click a link and see an item without having to make the item public.

The following example lists the names and presigned URLs of the first 50 items of the bucket my-bucket in the us-west-2 region. If a limit is not specified, Amazon S3 lists up to 1,000 items.

require 'aws-sdk-s3' # v2: require 'aws-sdk' s3 = 'us-west-2') bucket = s3.bucket('my-bucket') # Show only the first 50 items bucket.objects.limit(50).each do |item| puts "Name: #{item.key}" puts "URL: #{item.presigned_url(:get)}" end