UploadObjSingleOpRuby
Upload an Object Using the AWS SDK for Ruby
The AWS SDK for Ruby - Version 3 has two ways of uploading an object to Amazon S3. The first uses a managed file uploader, which makes it easy to upload files of any size from disk. To use the managed file uploader method:
Create an instance of the
Aws::S3::Resource
class.Reference the target object by bucket name and key. Objects live in a bucket and have unique keys that identify each object.
Call
#upload_file
on the object.
Example
The second way that AWS SDK for Ruby - Version 3 can upload an object uses the #put
method of Aws::S3::Object
. This is useful if the object is a string or an I/O object that is not a file on disk. To use this method:
Create an instance of the
Aws::S3::Resource
class.Reference the target object by bucket name and key.
Call
#put
, passing in the string or I/O object.
Example