Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def s3_downloader(bucketName, key, localPath)
- # (1) Create S3 object
- s3 = Aws::S3::Resource.new(region: 'ap-southeast-2')
- # (2) Create the source object
- sourceObj = s3.bucket(bucketName).object(key)
- # (3) Download the file
- sourceObj.get(response_target: localPath)
- puts "s3://#{bucketName}/#{key} has been downloaded to #{localPath}"
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement