Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Wolwer1nE/3f2bd6a06ec401e61427a6bde9425e2b to your computer and use it in GitHub Desktop.
Save Wolwer1nE/3f2bd6a06ec401e61427a6bde9425e2b to your computer and use it in GitHub Desktop.
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