Created
July 4, 2019 08:44
-
-
Save Wolwer1nE/3f2bd6a06ec401e61427a6bde9425e2b to your computer and use it in GitHub Desktop.
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' | |
require 'net/http' | |
creds = Aws::Credentials.new('', '') | |
s3 = Aws::S3::Resource.new( | |
credentials: creds, | |
endpoint: 'https://storage.yandexcloud.net', | |
region: 'us-east-1' | |
) | |
obj = s3.bucket('cb15').object('test.txt') | |
url = URI.parse(obj.presigned_url(:put)) | |
body = "Hello World!" | |
puts url | |
Net::HTTP.start(url.host) do |http| | |
http.send_request("PUT", url.request_uri, body, {"content-type" => "",}) | |
end | |
puts obj.get.body.read |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment