Advertisement
Guest User

Untitled

a guest
Aug 7th, 2019
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. def s3_downloader(bucketName, key, localPath)
  2. # (1) Create S3 object
  3. s3 = Aws::S3::Resource.new(region: 'ap-southeast-2')
  4. # (2) Create the source object
  5. sourceObj = s3.bucket(bucketName).object(key)
  6. # (3) Download the file
  7. sourceObj.get(response_target: localPath)
  8. puts "s3://#{bucketName}/#{key} has been downloaded to #{localPath}"
  9. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement