Skip to content

Instantly share code, notes, and snippets.

@flah00
Last active August 29, 2015 14:17
Show Gist options
  • Save flah00/3763acba46fb9a834868 to your computer and use it in GitHub Desktop.
Save flah00/3763acba46fb9a834868 to your computer and use it in GitHub Desktop.
Killing Cabin, with Aws
#!/bin/bash
echo Logging info level us-east-1 region
AWS_PROFILE=A_PROFILE ruby killer.rb info us-east-1
echo Logging debug level us-east-1 region
AWS_PROFILE=A_PROFILE ruby killer.rb debug us-east-1
source "https://rubygems.org"
gem "aws-sdk", "~> 2.0.0"
gem "cabin", "~> 0.7.0", git: "https://github.com/jordansissel/ruby-cabin.git"
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
require 'cabin'
require 'aws-sdk'
level = ARGV[0].nil? ? :info : ARGV[0].to_sym
region = ARGV[1].nil? ? 'us-east-1' : ARGV[1]
logger = Cabin::Channel.new
logger.level = level
logger.subscribe(STDOUT)
Aws.config[:logger] = logger
Aws.config[:http_wire_trace] = level == :debug
ec2 = Aws::EC2::Client.new(region: region)
ec2.describe_instances
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
require 'cabin'
require 'aws-sdk'
level = ARGV[0].nil? ? :info : ARGV[0].to_sym
region = ARGV[1].nil? ? 'us-east-1' : ARGV[1]
logger = Cabin::Channel.new
logger.level = level
logger.subscribe(STDOUT)
rubylogger = Logger.new(STDOUT)
logger.subscribe(rubylogger)
Aws.config[:logger] = rubylogger
Aws.config[:http_wire_trace] = level == :debug
ec2 = Aws::EC2::Client.new(region: region)
ec2.describe_instances
Logging info level us-east-1 region
{:timestamp=>"2015-03-17T22:10:44.658092-0400", :message=>"[Aws::EC2::Client 200 1.800722 0 retries] describe_instances() \n", :level=>:info}
Logging debug level us-east-1 region
/Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:1535:in `D': undefined method `<<' for #<Cabin::Channel:0x007fbbb4daf440> (NoMethodError)
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:877:in `connect'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:863:in `do_start'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:858:in `start'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/seahorse/client/net_http/connection_pool.rb:292:in `start_session'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/seahorse/client/net_http/connection_pool.rb:104:in `session_for'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/seahorse/client/net_http/handler.rb:75:in `session'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/seahorse/client/net_http/handler.rb:51:in `transmit'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/seahorse/client/net_http/handler.rb:25:in `call'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/seahorse/client/plugins/content_length.rb:12:in `call'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/aws-sdk-core/xml/error_handler.rb:8:in `call'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/aws-sdk-core/plugins/request_signer.rb:78:in `call'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/aws-sdk-core/plugins/retry_errors.rb:88:in `call'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/aws-sdk-core/plugins/retry_errors.rb:119:in `retry_request'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/aws-sdk-core/plugins/retry_errors.rb:102:in `retry_if_possible'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/aws-sdk-core/plugins/retry_errors.rb:90:in `call'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/aws-sdk-core/plugins/retry_errors.rb:119:in `retry_request'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/aws-sdk-core/plugins/retry_errors.rb:102:in `retry_if_possible'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/aws-sdk-core/plugins/retry_errors.rb:90:in `call'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/aws-sdk-core/plugins/retry_errors.rb:119:in `retry_request'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/aws-sdk-core/plugins/retry_errors.rb:102:in `retry_if_possible'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/aws-sdk-core/plugins/retry_errors.rb:90:in `call'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/aws-sdk-core/query/handler.rb:11:in `call'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/aws-sdk-core/plugins/user_agent.rb:12:in `call'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/seahorse/client/plugins/restful_bindings.rb:13:in `call'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/seahorse/client/plugins/endpoint.rb:35:in `call'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/seahorse/client/logging/handler.rb:10:in `call'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/seahorse/client/plugins/param_validation.rb:22:in `call'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/seahorse/client/plugins/raise_response_errors.rb:14:in `call'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/seahorse/client/plugins/param_conversion.rb:22:in `call'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/aws-sdk-core/plugins/response_paging.rb:10:in `call'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/seahorse/client/plugins/response_target.rb:18:in `call'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/seahorse/client/request.rb:70:in `send_request'
from /Users/pchampon/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.30/lib/seahorse/client/base.rb:216:in `block (2 levels) in define_operation_methods'
from ./killer.rb:18:in `<main>'
{:timestamp=>"2015-03-17T22:10:47.648557-0400", :message=>"[Aws::EC2::Client 0 2.122278 3 retries] describe_instances() NoMethodError undefined method `<<' for #<Cabin::Channel:0x007fbbb4daf440>\n", :level=>:info, :file=>"seahorse/client/logging/handler.rb", :line=>"22", :method=>"log"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment