Skip to content

Instantly share code, notes, and snippets.

@brianknight10
Last active January 28, 2016 15:00
Show Gist options
  • Save brianknight10/7243168979f69b58f20f to your computer and use it in GitHub Desktop.
Save brianknight10/7243168979f69b58f20f to your computer and use it in GitHub Desktop.
Upload a file to S3 from a URL
require 'open-uri'
require 'aws-sdk'
s3 = Aws::S3::Client.new
data = open('http://url.com/file')
s3.put_object(bucket: 'bucket_name', key: 'path/to/key', body: data)
@brianknight10
Copy link
Author

This gist provides a method for uploading files or images from a remote URL to an AWS S3 bucket. It assumes the AWS Ruby SDK and OpenURI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment