Skip to content

Instantly share code, notes, and snippets.

@jaydorsey
Created November 19, 2020 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaydorsey/e025891193a72a9737123dd6d906f22d to your computer and use it in GitHub Desktop.
Save jaydorsey/e025891193a72a9737123dd6d906f22d to your computer and use it in GitHub Desktop.
Upload file to S3 using the aws-sdk-s3 v3
require 'aws-sdk-s3'
# Creds get picked up from ENV vars per AWS docs
resource = Aws::S3::Resource.new(region: 'us-east-1')
bucket = resource.bucket('my-bucket')
bucket.put_object(
key: 'foo.gif',
body: File.read('foo.gif'),
acl: 'public-read'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment