AWS SDK for Ruby
Developer Guide

Downloading an Object from an Amazon S3 Bucket into a File

The following example gets the contents of the item my-item from the bucket my-bucket in the us-west-2 region, and saves it to the my-item.txt file in the ./my-code directory.

require 'aws-sdk-s3' # v2: require 'aws-sdk' s3 = 'us-west-2') # Create the object to retrieve obj = s3.bucket('my-bucket').object('my-item') # Get the item's content and save it to a file obj.get(response_target: './my-code/my-item.txt')