This file contains hidden or 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 hidden or 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
# build a dummy http handler that extends the default handler | |
# that outputs the request body before making the request (via super) | |
# then check the response body | |
# req is a AWS::Core::Http::Request object | |
# resp is a AWS::Core::Http::Response object | |
default_handler = AWS.config.http_handler | |
debug_handler = AWS::Core::Http::Handler.new(default_handler) do |req,resp| | |
puts "REQUEST BODY: #{req.body}" | |
super(req,resp) |
This file contains hidden or 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 'logger' | |
# configure a logger instance that logs to standard out, | |
# this could be a file, standard error, etc. The logger only | |
# needs to respond to #log and accept a severity and a message. | |
AWS.config(:logger => Logger.new($stdout)) | |
# make a request to see the request logger | |
ec2 = AWS::EC2.new |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
cf = Aws::CloudFront::Client.new | |
resp = cf.create_distribution( | |
distribution_config: { | |
caller_reference: Time.now.to_i.to_s, | |
aliases: { | |
quantity: 0 | |
}, | |
default_root_object: '', | |
origins: { |
This file contains hidden or 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-v1' | |
queue = AWS::SQS.new.queues['queue-arn'] | |
topic = AWS::SNS.new.topics['topic-arn'] | |
# this will modify the queue policy to allow the topic to send messages | |
topic.subscribe(queue) |
This file contains hidden or 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
# A simple extraction from the V1 SDK for Ruby from AWS::SQS::Queue#poll. | |
# No effort was made to test this code. | |
# | |
# @example Basic Usage | |
# | |
# poller = QueuePoller.new(queue_url) | |
# poller.poll { |msg| puts msg.body} | |
# | |
# @example Customized API client | |
# |
OlderNewer