Created
November 19, 2020 13:40
-
-
Save jaydorsey/e025891193a72a9737123dd6d906f22d to your computer and use it in GitHub Desktop.
Upload file to S3 using the aws-sdk-s3 v3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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