Skip to content

Instantly share code, notes, and snippets.

@trevorrowe
Last active August 29, 2015 14:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trevorrowe/7a36332bed24791a1196 to your computer and use it in GitHub Desktop.
Save trevorrowe/7a36332bed24791a1196 to your computer and use it in GitHub Desktop.
Uploading files to Amazon S3 using the AWS SDK for Ruby v2
# You can pass client options directly to the Resource constructor,
# no need to construct a client yourself
s3 = Aws::S3::Resource.new(
credentials: Aws::Credentials.new('akid', 'secret'),
region: 'eu-west-1'
)
s3.bucket('backup').object('dir/subdir/filename.txt').upload_file(local_file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment