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' | |
require 'openssl' | |
bucket_name = 'bucket-name' | |
object_key = 'object-key' | |
# patch for `aws-sdk` v2 gem (needed for versions <= v2.0.33, patch will be applied shortly to master) | |
class Aws::Signers::V4 | |
def presigned_url(request, options = {}) | |
now = Time.now.utc.strftime("%Y%m%dT%H%M%SZ") |
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
import com.amazonaws.services.s3.transfer.TransferManager; | |
import com.amazonaws.services.s3.transfer.TransferManagerBuilder; | |
import java.nio.file.Paths; | |
public class TransferManagerUploadExample { | |
private static final String BUCKET = <bucket>; | |
private static final String KEY = <key>; | |
private static final String FILE_PATH = <path>; | |
public static void main(String[] args) throws InterruptedException { |
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 'net/http' | |
require 'logger' | |
req = Net::HTTP::Put.new('/', { 'expect' => '100-continue' }) | |
req.body = 'data' | |
http = Net::HTTP.new('localhost', 3000) | |
http.continue_timeout = 1 | |
http.set_debug_output(Logger.new($stdout)) | |
http.request(req) |
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
#!/usr/bin/env ruby | |
require 'aws-sdk' | |
# This example produces empty http responses, but gives some general structure and guiance. | |
class DummyHttpHandler < Seahorse::Client::Handler | |
def call(context) | |
context.http_request.endpoint # HTTP or HTTPS URI |
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
sudo yum install -y gcc make \ | |
libxml2 libxml2-devel libxslt libxslt-devel \ | |
rubygems ruby-devel | |
sudo gem install nokogiri -- --with-xml2-lib=/usr/local/lib \ | |
--with-xml2-include=/usr/local/include/libxml2 \ | |
--with-xslt-lib=/usr/local/lib \ | |
--with-xslt-include=/usr/local/include | |
sudo gem install aws-sdk --no-ri --no-rdoc |
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
class Tree | |
def initialize(name = nil, path = '') | |
@name = name | |
@path = path | |
@folders = {} | |
@files = [] | |
end | |
attr_reader :name, :path, :folders, :files |
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
namespace :benchmarks do | |
namespace :dynamodb do | |
task :get_item do | |
require 'benchmark' | |
require 'aws-sdk' | |
table_name = 'aws-sdk-core-benchmarks' | |
params = { |
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' | |
require 'openssl' | |
class DotStream | |
def initialize(size) | |
@size = size | |
@bytes_left = size | |
end |
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' | |
require 'openssl' | |
class DotStream | |
def initialize(size) | |
@size = size | |
@bytes_left = size | |
end |
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
# using EC2 client | |
ec2 = Aws::EC2::Client.new | |
ec2.describe_instances.each_page do |resp| | |
resp.reservations.each do |reservation| | |
reservation.instances.each do |intsance| | |
puts instance.instance_id | |
end | |
end | |
end |
NewerOlder