Skip to content

Instantly share code, notes, and snippets.

@mostlyinvisible
Last active January 28, 2016 15:00
Show Gist options
  • Select an option

  • Save mostlyinvisible/7243168979f69b58f20f to your computer and use it in GitHub Desktop.

Select an option

Save mostlyinvisible/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)
@mostlyinvisible

Copy link
Copy Markdown
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