awsm 0.0.1 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +35 -16
 - data/awsm.gemspec +7 -6
 - data/bin/awsm +1 -1
 - data/lib/awsm/{cli.rb → cli/main.rb} +63 -30
 - data/lib/awsm/cli/spin.rb +153 -0
 - data/lib/awsm/cli/unused.rb +88 -0
 - data/lib/awsm/clibase.rb +15 -0
 - data/lib/awsm/config.rb +13 -0
 - data/lib/awsm/dns.rb +11 -3
 - data/lib/awsm/instances.rb +8 -2
 - data/lib/awsm/version.rb +1 -1
 - data/lib/awsm.rb +19 -9
 - metadata +32 -25
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: abfb98b976f8940d34a6cea53ed10ec196a25d9b
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 01446fea54dc664592c5b3af40115cb5f737a5d1
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: f411dac4b99cd4d8d5df477d984f8031edc41975096c8cd2f0605d9fc86b9909d427cc55d067b81eb79faeb4f8fcd80cf6e8020ebd99844e74729f0a0e367584
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 9e66e090cde43ce40a47d8647b04c6087686989e8f3b360cc674caab0cc4de552d83d41fa32e6be937eecfa5caf4be80ef1cf7d51b1d625aa4ae2b7e7114a16e
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -2,12 +2,28 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            Awsm is an awesome AWS querying tool. Pun most certainly intended.
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
            ##  
     | 
| 
      
 5 
     | 
    
         
            +
            ## Install from RubyGems
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Awsm is available on RubyGems, to install it, all you need to do is:
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ```
         
     | 
| 
      
 10 
     | 
    
         
            +
            gem install awsm
         
     | 
| 
      
 11 
     | 
    
         
            +
            ```
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            ## Install from Source
         
     | 
| 
       6 
14 
     | 
    
         | 
| 
       7 
15 
     | 
    
         
             
            Awsm is written in Ruby 2.1, so you'll need that to start with, you'll also need the `bundler` gem.
         
     | 
| 
       8 
16 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
      
 17 
     | 
    
         
            +
            ```
         
     | 
| 
      
 18 
     | 
    
         
            +
            [you@host:~]$ git clone https://github.com/mduk/awsm
         
     | 
| 
      
 19 
     | 
    
         
            +
            [you@host:~]$ cd awsm
         
     | 
| 
      
 20 
     | 
    
         
            +
            [you@host:~/awsm]$ bundle install
         
     | 
| 
      
 21 
     | 
    
         
            +
            [you@host:~/awsm]$ gem build awsm.gemspec
         
     | 
| 
      
 22 
     | 
    
         
            +
            [you@host:~/awsm]$ gem install awsm-x.x.x.gem
         
     | 
| 
      
 23 
     | 
    
         
            +
            [you@host:~/awsm]$ awsm
         
     | 
| 
      
 24 
     | 
    
         
            +
            ```
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            ## Running Awsm
         
     | 
| 
       11 
27 
     | 
    
         | 
| 
       12 
28 
     | 
    
         
             
            Awsm requires four enviornment variables to be set in order to work. I use something like this:
         
     | 
| 
       13 
29 
     | 
    
         | 
| 
         @@ -20,19 +36,22 @@ Awsm requires four enviornment variables to be set in order to work. I use somet 
     | 
|
| 
       20 
36 
     | 
    
         | 
| 
       21 
37 
     | 
    
         
             
            	echo -e "\033[1m\033[92mAWS Environment Set.\033[0m"
         
     | 
| 
       22 
38 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
      
 39 
     | 
    
         
            +
            ## Configuring Awsm
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            Awsm will read configuration from `~/.awsm`. This is just used for the `spin` subcommand for now.
         
     | 
| 
      
 42 
     | 
    
         
            +
            An example `~/.awsm` file is shown below:
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            ```
         
     | 
| 
      
 45 
     | 
    
         
            +
            Spin:
         
     | 
| 
      
 46 
     | 
    
         
            +
              InstanceType: t2.micro
         
     | 
| 
      
 47 
     | 
    
         
            +
              KeyName: my-aws-keypair
         
     | 
| 
      
 48 
     | 
    
         
            +
              Subnet: subnet-a0b1c2d3
         
     | 
| 
      
 49 
     | 
    
         
            +
              SecurityGroups:
         
     | 
| 
      
 50 
     | 
    
         
            +
                - sg-a0b1c2d3
         
     | 
| 
      
 51 
     | 
    
         
            +
              Tags:
         
     | 
| 
      
 52 
     | 
    
         
            +
                "h2g2:contact": "ford.prefect@megadodo.h2g2"
         
     | 
| 
      
 53 
     | 
    
         
            +
                "h2g2:planet": kakrafoon
         
     | 
| 
      
 54 
     | 
    
         
            +
            ```
         
     | 
| 
       36 
55 
     | 
    
         | 
| 
       37 
56 
     | 
    
         
             
            # Licence
         
     | 
| 
       38 
57 
     | 
    
         | 
    
        data/awsm.gemspec
    CHANGED
    
    | 
         @@ -9,8 +9,8 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       9 
9 
     | 
    
         
             
              spec.authors       = ["Daniel Kendell"]
         
     | 
| 
       10 
10 
     | 
    
         
             
              spec.email         = ["daniel@kendell.org"]
         
     | 
| 
       11 
11 
     | 
    
         
             
              spec.summary       = %q{Awsm AWS queryer}
         
     | 
| 
       12 
     | 
    
         
            -
              spec.description   =  
     | 
| 
       13 
     | 
    
         
            -
              spec.homepage      = " 
     | 
| 
      
 12 
     | 
    
         
            +
              spec.description   = %q{Awsm AWS queryer}
         
     | 
| 
      
 13 
     | 
    
         
            +
              spec.homepage      = ""
         
     | 
| 
       14 
14 
     | 
    
         
             
              spec.license       = "MIT"
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
              spec.files         = `git ls-files -z`.split("\x0")
         
     | 
| 
         @@ -18,10 +18,11 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       18 
18 
     | 
    
         
             
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
       19 
19 
     | 
    
         
             
              spec.require_paths = ["lib"]
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
              spec. 
     | 
| 
       22 
     | 
    
         
            -
              spec. 
     | 
| 
      
 21 
     | 
    
         
            +
              spec.add_dependency 'thor'
         
     | 
| 
      
 22 
     | 
    
         
            +
              spec.add_dependency 'aws-sdk', '~> 2'
         
     | 
| 
      
 23 
     | 
    
         
            +
              spec.add_dependency 'terminal-table', '~> 1.4.5'
         
     | 
| 
       23 
24 
     | 
    
         | 
| 
       24 
25 
     | 
    
         
             
              spec.add_development_dependency "bundler", "~> 1.6"
         
     | 
| 
       25 
     | 
    
         
            -
              spec.add_development_dependency "rake" 
     | 
| 
       26 
     | 
    
         
            -
              spec.add_development_dependency "pry" 
     | 
| 
      
 26 
     | 
    
         
            +
              spec.add_development_dependency "rake"
         
     | 
| 
      
 27 
     | 
    
         
            +
              spec.add_development_dependency "pry"
         
     | 
| 
       27 
28 
     | 
    
         
             
            end
         
     | 
    
        data/bin/awsm
    CHANGED
    
    
| 
         @@ -1,29 +1,57 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'thor'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
1 
     | 
    
         
             
            module Awsm 
         
     | 
| 
       4 
     | 
    
         
            -
               
     | 
| 
       5 
     | 
    
         
            -
                 
     | 
| 
       6 
     | 
    
         
            -
                  : 
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
                  :desc => "Check if there are any Route53 records pointing at this Load Balancer"
         
     | 
| 
       9 
     | 
    
         
            -
                class_option :asg, :type => :boolean, :default => false, :aliases => "-a",
         
     | 
| 
       10 
     | 
    
         
            -
                  :desc => "Show Auto Scaling Groups that are receiving traffic from this Load Balancer"
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
                desc "specific <comma-separated-elb-names>",
         
     | 
| 
       13 
     | 
    
         
            -
                  "Only find specific ELBs named in a comma-separated list."
         
     | 
| 
       14 
     | 
    
         
            -
                def specific( elb_names )
         
     | 
| 
       15 
     | 
    
         
            -
                  results = load_balancers.get(elb_names)
         
     | 
| 
       16 
     | 
    
         
            -
                  results = do_options( results )
         
     | 
| 
       17 
     | 
    
         
            -
                  results.each { |elb| print_result(elb) }
         
     | 
| 
       18 
     | 
    
         
            -
                end
         
     | 
| 
      
 2 
     | 
    
         
            +
              module CLI
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Main < Clibase
         
     | 
| 
      
 4 
     | 
    
         
            +
                  class_option :instances, :type => :boolean, :default => false, :aliases => "-i",
         
     | 
| 
      
 5 
     | 
    
         
            +
                    :desc => "Also show instance information. Including ID, Private IP, and current health."
         
     | 
| 
       19 
6 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
                   
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
      
 7 
     | 
    
         
            +
                  class_option :dns, :type => :boolean, :default => false, :aliases => "-d",
         
     | 
| 
      
 8 
     | 
    
         
            +
                    :desc => "Check if there are any Route53 records pointing at this Load Balancer"
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  class_option :asg, :type => :boolean, :default => false, :aliases => "-a",
         
     | 
| 
      
 11 
     | 
    
         
            +
                    :desc => "Show Auto Scaling Groups that are receiving traffic from this Load Balancer"
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  desc 'spin', 'Ad-hoc instances'
         
     | 
| 
      
 14 
     | 
    
         
            +
                  subcommand 'spin', Awsm::CLI::Spin
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  desc 'unused', 'Find unused resources'
         
     | 
| 
      
 17 
     | 
    
         
            +
                  subcommand 'unused', Awsm::CLI::Unused
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  desc "specific <comma-separated-elb-names>",
         
     | 
| 
      
 20 
     | 
    
         
            +
                    "Only find specific ELBs named in a comma-separated list."
         
     | 
| 
      
 21 
     | 
    
         
            +
                  def specific( elb_names )
         
     | 
| 
      
 22 
     | 
    
         
            +
                    results = load_balancers.get(elb_names)
         
     | 
| 
      
 23 
     | 
    
         
            +
                    results = do_options( results )
         
     | 
| 
      
 24 
     | 
    
         
            +
                    results.each { |elb| print_result(elb) }
         
     | 
| 
      
 25 
     | 
    
         
            +
                  end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                  desc "search <search-terms>",
         
     | 
| 
      
 28 
     | 
    
         
            +
                    "Show ELBs where the name matches the search terms."
         
     | 
| 
      
 29 
     | 
    
         
            +
                  def search( search_terms )
         
     | 
| 
      
 30 
     | 
    
         
            +
                    results = load_balancers.getAll.select do |combined|
         
     | 
| 
      
 31 
     | 
    
         
            +
                      combined[:elb][:name] =~ /#{search_terms}/
         
     | 
| 
      
 32 
     | 
    
         
            +
                    end
         
     | 
| 
      
 33 
     | 
    
         
            +
                    results = do_options( results )
         
     | 
| 
      
 34 
     | 
    
         
            +
                    results.each { |elb| print_result(elb) }
         
     | 
| 
      
 35 
     | 
    
         
            +
                  end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                  desc "r53 [dns-name]",
         
     | 
| 
      
 38 
     | 
    
         
            +
                    "Show me what <dns-name> points at."
         
     | 
| 
      
 39 
     | 
    
         
            +
                  def r53( dns_name )
         
     | 
| 
      
 40 
     | 
    
         
            +
                    dns_len = dns_name.length
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                    say "#{dns_name} ", :yellow
         
     | 
| 
      
 43 
     | 
    
         
            +
                    say "=> ", :bold
         
     | 
| 
      
 44 
     | 
    
         
            +
                    dns.get_by_record( dns_name ).each_with_index do |r, i|
         
     | 
| 
      
 45 
     | 
    
         
            +
                    if i > 0
         
     | 
| 
      
 46 
     | 
    
         
            +
                      say " " * ( dns_len + 4 )
         
     | 
| 
      
 47 
     | 
    
         
            +
                    end
         
     | 
| 
      
 48 
     | 
    
         
            +
                    say "(#{r.type}) ", :green
         
     | 
| 
      
 49 
     | 
    
         
            +
                    case r.type
         
     | 
| 
      
 50 
     | 
    
         
            +
                      when "A"
         
     | 
| 
      
 51 
     | 
    
         
            +
                        say "#{r.alias_target.dns_name}", :cyan
         
     | 
| 
      
 52 
     | 
    
         
            +
                      end
         
     | 
| 
      
 53 
     | 
    
         
            +
                    end
         
     | 
| 
      
 54 
     | 
    
         
            +
                  end
         
     | 
| 
       27 
55 
     | 
    
         | 
| 
       28 
56 
     | 
    
         
             
                no_commands do
         
     | 
| 
       29 
57 
     | 
    
         
             
                  def load_balancers
         
     | 
| 
         @@ -75,7 +103,7 @@ module Awsm 
     | 
|
| 
       75 
103 
     | 
    
         
             
                    say result[:elb][:name], :green, false
         
     | 
| 
       76 
104 
     | 
    
         
             
                    print ' <= '
         
     | 
| 
       77 
105 
     | 
    
         | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
      
 106 
     | 
    
         
            +
                    # DNS
         
     | 
| 
       79 
107 
     | 
    
         
             
                    if result[:r53_dns].nil?
         
     | 
| 
       80 
108 
     | 
    
         
             
                      say result[:elb][:dns], :white, false
         
     | 
| 
       81 
109 
     | 
    
         
             
                    else
         
     | 
| 
         @@ -84,7 +112,7 @@ module Awsm 
     | 
|
| 
       84 
112 
     | 
    
         | 
| 
       85 
113 
     | 
    
         
             
                    puts
         
     | 
| 
       86 
114 
     | 
    
         | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
      
 115 
     | 
    
         
            +
                    # Load Balancer Tags
         
     | 
| 
       88 
116 
     | 
    
         
             
                    say "  NO TAGS!", :red  unless result[:elb][:tags].length > 0
         
     | 
| 
       89 
117 
     | 
    
         
             
                    say "  Tags:" if result[:elb][:tags].length > 0
         
     | 
| 
       90 
118 
     | 
    
         
             
                    result[:elb][:tags].each do |k, v|
         
     | 
| 
         @@ -95,10 +123,14 @@ module Awsm 
     | 
|
| 
       95 
123 
     | 
    
         
             
                    end
         
     | 
| 
       96 
124 
     | 
    
         | 
| 
       97 
125 
     | 
    
         
             
                    if options[:instances]
         
     | 
| 
       98 
     | 
    
         
            -
                       
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
                         
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
      
 126 
     | 
    
         
            +
                      if result[:instances] != []
         
     | 
| 
      
 127 
     | 
    
         
            +
                        say "  Instances:"
         
     | 
| 
      
 128 
     | 
    
         
            +
                        result[:instances].each do |instance_and_id|
         
     | 
| 
      
 129 
     | 
    
         
            +
                          instance = instance_and_id[1]
         
     | 
| 
      
 130 
     | 
    
         
            +
                          print_instance( 12, instance )
         
     | 
| 
      
 131 
     | 
    
         
            +
                        end
         
     | 
| 
      
 132 
     | 
    
         
            +
                      else
         
     | 
| 
      
 133 
     | 
    
         
            +
                        say "  No Instances!", :red
         
     | 
| 
       102 
134 
     | 
    
         
             
                      end
         
     | 
| 
       103 
135 
     | 
    
         
             
                    end
         
     | 
| 
       104 
136 
     | 
    
         | 
| 
         @@ -145,3 +177,4 @@ module Awsm 
     | 
|
| 
       145 
177 
     | 
    
         
             
                end
         
     | 
| 
       146 
178 
     | 
    
         
             
              end
         
     | 
| 
       147 
179 
     | 
    
         
             
            end
         
     | 
| 
      
 180 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,153 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Awsm
         
     | 
| 
      
 2 
     | 
    
         
            +
              module CLI
         
     | 
| 
      
 3 
     | 
    
         
            +
              class Spin < Clibase
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                class_option :tables, :type => :boolean, :lazy_default => true, :default => true,
         
     | 
| 
      
 6 
     | 
    
         
            +
                  :desc => "Whether or not to draw ASCII tables."
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                desc 'up [AMI_ID]',
         
     | 
| 
      
 9 
     | 
    
         
            +
                  "Spin up an instance of the specified AMI"
         
     | 
| 
      
 10 
     | 
    
         
            +
                def up( ami_id )
         
     | 
| 
      
 11 
     | 
    
         
            +
                  say "Spinning up #{ami_id}..."
         
     | 
| 
      
 12 
     | 
    
         
            +
                  response = ec2.run_instances(
         
     | 
| 
      
 13 
     | 
    
         
            +
                    image_id: ami_id,
         
     | 
| 
      
 14 
     | 
    
         
            +
                    min_count: 1,
         
     | 
| 
      
 15 
     | 
    
         
            +
                    max_count: 1,
         
     | 
| 
      
 16 
     | 
    
         
            +
                    key_name: configured_key_name,
         
     | 
| 
      
 17 
     | 
    
         
            +
                    instance_type: configured_instance_type,
         
     | 
| 
      
 18 
     | 
    
         
            +
                    security_group_ids: configured_security_groups,
         
     | 
| 
      
 19 
     | 
    
         
            +
                    subnet_id: configured_subnet
         
     | 
| 
      
 20 
     | 
    
         
            +
                  )
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  instance_id = response.instances.first.instance_id
         
     | 
| 
      
 23 
     | 
    
         
            +
                  say "Instance #{instance_id} is spinning up...", :green
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                  while instance_extant?( instance_id ) == false
         
     | 
| 
      
 26 
     | 
    
         
            +
                    say '.', :green, false
         
     | 
| 
      
 27 
     | 
    
         
            +
                    sleep(3)
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  tags = [
         
     | 
| 
      
 31 
     | 
    
         
            +
                    { key: 'Name', value: "Temporary instance of #{ami_id} for #{whoami}" },
         
     | 
| 
      
 32 
     | 
    
         
            +
                    { key: 'awsm:owner', value: whoami }
         
     | 
| 
      
 33 
     | 
    
         
            +
                  ]
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                  configured_tags.each do |k, v|
         
     | 
| 
      
 36 
     | 
    
         
            +
                    tags << { key: k, value: v }
         
     | 
| 
      
 37 
     | 
    
         
            +
                  end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                  ec2.create_tags(
         
     | 
| 
      
 40 
     | 
    
         
            +
                    resources: [ instance_id ],
         
     | 
| 
      
 41 
     | 
    
         
            +
                    tags: tags
         
     | 
| 
      
 42 
     | 
    
         
            +
                  )
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                  say "Tagged #{instance_id}:"
         
     | 
| 
      
 45 
     | 
    
         
            +
                  tags.each do |tag|
         
     | 
| 
      
 46 
     | 
    
         
            +
                    say "    #{tag[:key]} ", :cyan
         
     | 
| 
      
 47 
     | 
    
         
            +
                    say '=> '
         
     | 
| 
      
 48 
     | 
    
         
            +
                    say "#{tag[:value]}", :yellow
         
     | 
| 
      
 49 
     | 
    
         
            +
                  end
         
     | 
| 
      
 50 
     | 
    
         
            +
                end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                desc 'down [INSTANCE_ID]',
         
     | 
| 
      
 53 
     | 
    
         
            +
                  "Spin down the specified instance"
         
     | 
| 
      
 54 
     | 
    
         
            +
                def down( instance_id )
         
     | 
| 
      
 55 
     | 
    
         
            +
                  say "Spinning down (terminating) #{instance_id}...", :red
         
     | 
| 
      
 56 
     | 
    
         
            +
                  ec2.terminate_instances(
         
     | 
| 
      
 57 
     | 
    
         
            +
                    instance_ids: [ instance_id ]
         
     | 
| 
      
 58 
     | 
    
         
            +
                  )
         
     | 
| 
      
 59 
     | 
    
         
            +
                end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                desc 'list',
         
     | 
| 
      
 62 
     | 
    
         
            +
                  "List all spinning instances"
         
     | 
| 
      
 63 
     | 
    
         
            +
                option :simple, :type => :boolean, :default => false, :aliases => '-s',
         
     | 
| 
      
 64 
     | 
    
         
            +
                  :desc => "Display list without prettiness - good for sedding"
         
     | 
| 
      
 65 
     | 
    
         
            +
                def list
         
     | 
| 
      
 66 
     | 
    
         
            +
                  response = ec2.describe_instances(
         
     | 
| 
      
 67 
     | 
    
         
            +
                    filters: [
         
     | 
| 
      
 68 
     | 
    
         
            +
                      { name: 'tag-key', values: [ "awsm:owner" ] }
         
     | 
| 
      
 69 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 70 
     | 
    
         
            +
                  )
         
     | 
| 
      
 71 
     | 
    
         
            +
                  spinning = []
         
     | 
| 
      
 72 
     | 
    
         
            +
                  response.reservations.each do |r|
         
     | 
| 
      
 73 
     | 
    
         
            +
                    r.instances.each do |i|
         
     | 
| 
      
 74 
     | 
    
         
            +
                      owner = i.tags.select { |t| t.key == 'awsm:owner' }.first.value
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                      if owner == whoami
         
     | 
| 
      
 77 
     | 
    
         
            +
                        fields = [ i.instance_id, i.state.name, i.image_id, owner, i.launch_time ]
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
                        if i.state.name == 'running'
         
     | 
| 
      
 80 
     | 
    
         
            +
                          fields << i.private_ip_address
         
     | 
| 
      
 81 
     | 
    
         
            +
                        else
         
     | 
| 
      
 82 
     | 
    
         
            +
                          fields << 'N/A'
         
     | 
| 
      
 83 
     | 
    
         
            +
                        end
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
                        spinning << fields
         
     | 
| 
      
 86 
     | 
    
         
            +
                      end
         
     | 
| 
      
 87 
     | 
    
         
            +
                    end
         
     | 
| 
      
 88 
     | 
    
         
            +
                  end
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
                  if options[:simple]
         
     | 
| 
      
 91 
     | 
    
         
            +
                    spinning.each do |row|
         
     | 
| 
      
 92 
     | 
    
         
            +
                      say row.join(' ')
         
     | 
| 
      
 93 
     | 
    
         
            +
                    end
         
     | 
| 
      
 94 
     | 
    
         
            +
                  else
         
     | 
| 
      
 95 
     | 
    
         
            +
                    puts_table(
         
     | 
| 
      
 96 
     | 
    
         
            +
                      headings: [ 'Instance ID', 'State', 'AMI ID', 'Owner', 'Launched Time', 'Private IP' ],
         
     | 
| 
      
 97 
     | 
    
         
            +
                      rows: spinning
         
     | 
| 
      
 98 
     | 
    
         
            +
                    )
         
     | 
| 
      
 99 
     | 
    
         
            +
                  end
         
     | 
| 
      
 100 
     | 
    
         
            +
                end
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
                no_commands do
         
     | 
| 
      
 103 
     | 
    
         
            +
                  def ec2
         
     | 
| 
      
 104 
     | 
    
         
            +
                    Aws::EC2::Client.new
         
     | 
| 
      
 105 
     | 
    
         
            +
                  end
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
                  def whoami
         
     | 
| 
      
 108 
     | 
    
         
            +
                    me_host = `hostname -f`.strip
         
     | 
| 
      
 109 
     | 
    
         
            +
                    me_user = `whoami`.strip
         
     | 
| 
      
 110 
     | 
    
         
            +
                    "#{me_user}@#{me_host}"
         
     | 
| 
      
 111 
     | 
    
         
            +
                  end
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
                  def instance_extant?( instance_id )
         
     | 
| 
      
 114 
     | 
    
         
            +
                    description = ec2.describe_instances(
         
     | 
| 
      
 115 
     | 
    
         
            +
                      instance_ids: [ instance_id ]
         
     | 
| 
      
 116 
     | 
    
         
            +
                    )
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
      
 118 
     | 
    
         
            +
                    num_found = description.reservations.first.instances.length
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
                    if num_found == 0
         
     | 
| 
      
 121 
     | 
    
         
            +
                      return false
         
     | 
| 
      
 122 
     | 
    
         
            +
                    end
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
                    true
         
     | 
| 
      
 125 
     | 
    
         
            +
                  end
         
     | 
| 
      
 126 
     | 
    
         
            +
             
     | 
| 
      
 127 
     | 
    
         
            +
                  def config
         
     | 
| 
      
 128 
     | 
    
         
            +
                    Config.new.get('Spin')
         
     | 
| 
      
 129 
     | 
    
         
            +
                  end
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
      
 131 
     | 
    
         
            +
                  def configured_security_groups
         
     | 
| 
      
 132 
     | 
    
         
            +
                    config['SecurityGroups']
         
     | 
| 
      
 133 
     | 
    
         
            +
                  end
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
                  def configured_subnet
         
     | 
| 
      
 136 
     | 
    
         
            +
                    config['Subnet']
         
     | 
| 
      
 137 
     | 
    
         
            +
                  end
         
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
      
 139 
     | 
    
         
            +
                  def configured_instance_type
         
     | 
| 
      
 140 
     | 
    
         
            +
                    config['InstanceType']
         
     | 
| 
      
 141 
     | 
    
         
            +
                  end
         
     | 
| 
      
 142 
     | 
    
         
            +
             
     | 
| 
      
 143 
     | 
    
         
            +
                  def configured_key_name
         
     | 
| 
      
 144 
     | 
    
         
            +
                    config['KeyName']
         
     | 
| 
      
 145 
     | 
    
         
            +
                  end
         
     | 
| 
      
 146 
     | 
    
         
            +
             
     | 
| 
      
 147 
     | 
    
         
            +
                  def configured_tags
         
     | 
| 
      
 148 
     | 
    
         
            +
                    config['Tags']
         
     | 
| 
      
 149 
     | 
    
         
            +
                  end
         
     | 
| 
      
 150 
     | 
    
         
            +
                end
         
     | 
| 
      
 151 
     | 
    
         
            +
              end
         
     | 
| 
      
 152 
     | 
    
         
            +
            end
         
     | 
| 
      
 153 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,88 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Awsm
         
     | 
| 
      
 2 
     | 
    
         
            +
              module CLI
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
                class Unused < Clibase
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  class_option :tables, :type => :boolean, :lazy_default => true, :default => true,
         
     | 
| 
      
 7 
     | 
    
         
            +
                    :desc => "Whether or not to draw ASCII tables."
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                  desc "elasticloadbalancers",
         
     | 
| 
      
 10 
     | 
    
         
            +
                    "Find and prune elastic load balancers that aren't connected to anything"
         
     | 
| 
      
 11 
     | 
    
         
            +
                  def elasticloadbalancers
         
     | 
| 
      
 12 
     | 
    
         
            +
                    puts_table(
         
     | 
| 
      
 13 
     | 
    
         
            +
                      headings: [ "ELB Name", "DNS", "Created Time" ],
         
     | 
| 
      
 14 
     | 
    
         
            +
                      rows: find_instanceless_elbs.map do |elb|
         
     | 
| 
      
 15 
     | 
    
         
            +
                        [ elb.load_balancer_name, elb.dns_name, elb.created_time ]
         
     | 
| 
      
 16 
     | 
    
         
            +
                      end
         
     | 
| 
      
 17 
     | 
    
         
            +
                    )
         
     | 
| 
      
 18 
     | 
    
         
            +
                  end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                  desc 'launchconfigurations',
         
     | 
| 
      
 21 
     | 
    
         
            +
                    "Find unused launch configurations"
         
     | 
| 
      
 22 
     | 
    
         
            +
                  def launchconfigurations
         
     | 
| 
      
 23 
     | 
    
         
            +
                    puts_table(
         
     | 
| 
      
 24 
     | 
    
         
            +
                      headings: [ "Launch Configuration Name", "Created Time" ],
         
     | 
| 
      
 25 
     | 
    
         
            +
                      rows: find_unused_launchconfigurations.map do |lc|
         
     | 
| 
      
 26 
     | 
    
         
            +
                        [ lc.launch_configuration_name, lc.created_time ]
         
     | 
| 
      
 27 
     | 
    
         
            +
                      end
         
     | 
| 
      
 28 
     | 
    
         
            +
                    )
         
     | 
| 
      
 29 
     | 
    
         
            +
                  end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            			desc 'ami',
         
     | 
| 
      
 32 
     | 
    
         
            +
            				"Find unused AMIs"
         
     | 
| 
      
 33 
     | 
    
         
            +
            			def ami
         
     | 
| 
      
 34 
     | 
    
         
            +
            				puts_table(
         
     | 
| 
      
 35 
     | 
    
         
            +
            					headings: [ "AMI ID", "Created Time" ],
         
     | 
| 
      
 36 
     | 
    
         
            +
            					rows: find_unused_amis do |ami|
         
     | 
| 
      
 37 
     | 
    
         
            +
            						[  ]
         
     | 
| 
      
 38 
     | 
    
         
            +
            					end
         
     | 
| 
      
 39 
     | 
    
         
            +
            				)
         
     | 
| 
      
 40 
     | 
    
         
            +
            			end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                  no_commands do
         
     | 
| 
      
 43 
     | 
    
         
            +
                    def elb
         
     | 
| 
      
 44 
     | 
    
         
            +
                      Aws::ElasticLoadBalancing::Client.new
         
     | 
| 
      
 45 
     | 
    
         
            +
                    end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            				def ec2
         
     | 
| 
      
 48 
     | 
    
         
            +
            					Aws::EC2::Client.new
         
     | 
| 
      
 49 
     | 
    
         
            +
            				end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                    def as
         
     | 
| 
      
 52 
     | 
    
         
            +
                      Aws::AutoScaling::Client.new
         
     | 
| 
      
 53 
     | 
    
         
            +
                    end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                    def find_instanceless_elbs
         
     | 
| 
      
 56 
     | 
    
         
            +
                      elbs = []
         
     | 
| 
      
 57 
     | 
    
         
            +
                      elb.describe_load_balancers.load_balancer_descriptions.each do |elb|
         
     | 
| 
      
 58 
     | 
    
         
            +
                        if elb.instances.length == 0
         
     | 
| 
      
 59 
     | 
    
         
            +
                          elbs << elb
         
     | 
| 
      
 60 
     | 
    
         
            +
                        end
         
     | 
| 
      
 61 
     | 
    
         
            +
                      end
         
     | 
| 
      
 62 
     | 
    
         
            +
                      elbs
         
     | 
| 
      
 63 
     | 
    
         
            +
                    end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                    def find_unused_launchconfigurations
         
     | 
| 
      
 66 
     | 
    
         
            +
                      used_launchconfiguration_names = []
         
     | 
| 
      
 67 
     | 
    
         
            +
                      as.describe_auto_scaling_groups.auto_scaling_groups.each do |asg|
         
     | 
| 
      
 68 
     | 
    
         
            +
                        used_launchconfiguration_names << asg.launch_configuration_name
         
     | 
| 
      
 69 
     | 
    
         
            +
                      end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                      launchconfigurations = []
         
     | 
| 
      
 72 
     | 
    
         
            +
                      as.describe_launch_configurations.launch_configurations.each do |lc|
         
     | 
| 
      
 73 
     | 
    
         
            +
                        unless used_launchconfiguration_names.include?( lc.launch_configuration_name )
         
     | 
| 
      
 74 
     | 
    
         
            +
                          launchconfigurations << lc
         
     | 
| 
      
 75 
     | 
    
         
            +
                        end
         
     | 
| 
      
 76 
     | 
    
         
            +
                      end
         
     | 
| 
      
 77 
     | 
    
         
            +
                      launchconfigurations
         
     | 
| 
      
 78 
     | 
    
         
            +
                    end
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
            				def find_unused_amis
         
     | 
| 
      
 81 
     | 
    
         
            +
            binding.pry
         
     | 
| 
      
 82 
     | 
    
         
            +
            				end
         
     | 
| 
      
 83 
     | 
    
         
            +
                  end
         
     | 
| 
      
 84 
     | 
    
         
            +
                
         
     | 
| 
      
 85 
     | 
    
         
            +
                end
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
              end
         
     | 
| 
      
 88 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/awsm/clibase.rb
    ADDED
    
    
    
        data/lib/awsm/config.rb
    ADDED
    
    
    
        data/lib/awsm/dns.rb
    CHANGED
    
    | 
         @@ -4,12 +4,19 @@ module Awsm 
     | 
|
| 
       4 
4 
     | 
    
         
             
              class Dns
         
     | 
| 
       5 
5 
     | 
    
         
             
                def initialize
         
     | 
| 
       6 
6 
     | 
    
         
             
                  @client = Aws::Route53::Client.new
         
     | 
| 
       7 
     | 
    
         
            -
                  @ 
     | 
| 
      
 7 
     | 
    
         
            +
                  @dns_map_by_target = {}
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @records = []
         
     | 
| 
       8 
9 
     | 
    
         
             
                  load_dns_records
         
     | 
| 
       9 
10 
     | 
    
         
             
                end
         
     | 
| 
       10 
11 
     | 
    
         | 
| 
       11 
12 
     | 
    
         
             
                def find_for( target )
         
     | 
| 
       12 
     | 
    
         
            -
                  @ 
     | 
| 
      
 13 
     | 
    
         
            +
                  @dns_map_by_target[ target ]
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                def get_by_record( record )
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @records.select do |r|
         
     | 
| 
      
 18 
     | 
    
         
            +
                    r.name =~ /^#{record}/
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
       13 
20 
     | 
    
         
             
                end
         
     | 
| 
       14 
21 
     | 
    
         | 
| 
       15 
22 
     | 
    
         
             
                def load_dns_records
         
     | 
| 
         @@ -29,7 +36,8 @@ module Awsm 
     | 
|
| 
       29 
36 
     | 
    
         
             
                        target = r.resource_records[0].value
         
     | 
| 
       30 
37 
     | 
    
         
             
                      end
         
     | 
| 
       31 
38 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
                      @ 
     | 
| 
      
 39 
     | 
    
         
            +
                      @dns_map_by_target[target] = r.name
         
     | 
| 
      
 40 
     | 
    
         
            +
                      @records << r
         
     | 
| 
       33 
41 
     | 
    
         
             
                    end
         
     | 
| 
       34 
42 
     | 
    
         
             
                  end
         
     | 
| 
       35 
43 
     | 
    
         
             
                end
         
     | 
    
        data/lib/awsm/instances.rb
    CHANGED
    
    | 
         @@ -5,11 +5,17 @@ module Awsm 
     | 
|
| 
       5 
5 
     | 
    
         
             
                end
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                def get_instance_data( instance_ids )
         
     | 
| 
       8 
     | 
    
         
            -
                   
     | 
| 
      
 8 
     | 
    
         
            +
                  first_reservation = @client.describe_instances( {
         
     | 
| 
       9 
9 
     | 
    
         
             
                    filters: [
         
     | 
| 
       10 
10 
     | 
    
         
             
                      { name: "instance-id", values: instance_ids }
         
     | 
| 
       11 
11 
     | 
    
         
             
                    ]
         
     | 
| 
       12 
     | 
    
         
            -
                  } ).reservations.first 
     | 
| 
      
 12 
     | 
    
         
            +
                  } ).reservations.first
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  if first_reservation.nil?
         
     | 
| 
      
 15 
     | 
    
         
            +
                    return []
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            	  descriptions = first_reservation.instances
         
     | 
| 
       13 
19 
     | 
    
         | 
| 
       14 
20 
     | 
    
         
             
                  instance_hash = {}
         
     | 
| 
       15 
21 
     | 
    
         
             
                  descriptions.each do |description|
         
     | 
    
        data/lib/awsm/version.rb
    CHANGED
    
    
    
        data/lib/awsm.rb
    CHANGED
    
    | 
         @@ -1,9 +1,19 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require  
     | 
| 
       2 
     | 
    
         
            -
            require  
     | 
| 
       3 
     | 
    
         
            -
            require  
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            require  
     | 
| 
       6 
     | 
    
         
            -
            require  
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            require 'yaml'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'thor'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'terminal-table'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            require 'awsm/config'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'awsm/version'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'awsm/loadbalancers'
         
     | 
| 
      
 8 
     | 
    
         
            +
            require 'awsm/autoscalinggroups'
         
     | 
| 
      
 9 
     | 
    
         
            +
            require 'awsm/dns'
         
     | 
| 
      
 10 
     | 
    
         
            +
            require 'awsm/instances'
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            require 'awsm/clibase'
         
     | 
| 
      
 13 
     | 
    
         
            +
            require 'awsm/cli/unused'
         
     | 
| 
      
 14 
     | 
    
         
            +
            require 'awsm/cli/spin'
         
     | 
| 
      
 15 
     | 
    
         
            +
            require 'awsm/cli/main'
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            require 'pry'
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,43 +1,57 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: awsm
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.4
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Daniel Kendell
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2015- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-04-02 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: thor
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: aws-sdk
         
     | 
| 
       15 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       16 
30 
     | 
    
         
             
                requirements:
         
     | 
| 
       17 
31 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       18 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       19 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '2'
         
     | 
| 
       20 
34 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       21 
35 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       22 
36 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       23 
37 
     | 
    
         
             
                requirements:
         
     | 
| 
       24 
38 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       25 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       26 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '2'
         
     | 
| 
       27 
41 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       28 
     | 
    
         
            -
              name:  
     | 
| 
      
 42 
     | 
    
         
            +
              name: terminal-table
         
     | 
| 
       29 
43 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       30 
44 
     | 
    
         
             
                requirements:
         
     | 
| 
       31 
45 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       32 
46 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       33 
     | 
    
         
            -
                    version:  
     | 
| 
      
 47 
     | 
    
         
            +
                    version: 1.4.5
         
     | 
| 
       34 
48 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       35 
49 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       36 
50 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       37 
51 
     | 
    
         
             
                requirements:
         
     | 
| 
       38 
52 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       39 
53 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       40 
     | 
    
         
            -
                    version:  
     | 
| 
      
 54 
     | 
    
         
            +
                    version: 1.4.5
         
     | 
| 
       41 
55 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       42 
56 
     | 
    
         
             
              name: bundler
         
     | 
| 
       43 
57 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -56,42 +70,31 @@ dependencies: 
     | 
|
| 
       56 
70 
     | 
    
         
             
              name: rake
         
     | 
| 
       57 
71 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       58 
72 
     | 
    
         
             
                requirements:
         
     | 
| 
       59 
     | 
    
         
            -
                - - " 
     | 
| 
      
 73 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       60 
74 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       61 
75 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       62 
76 
     | 
    
         
             
              type: :development
         
     | 
| 
       63 
77 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       64 
78 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       65 
79 
     | 
    
         
             
                requirements:
         
     | 
| 
       66 
     | 
    
         
            -
                - - " 
     | 
| 
      
 80 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       67 
81 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       68 
82 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       69 
83 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       70 
84 
     | 
    
         
             
              name: pry
         
     | 
| 
       71 
85 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       72 
86 
     | 
    
         
             
                requirements:
         
     | 
| 
       73 
     | 
    
         
            -
                - - " 
     | 
| 
      
 87 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       74 
88 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       75 
89 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       76 
90 
     | 
    
         
             
              type: :development
         
     | 
| 
       77 
91 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       78 
92 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       79 
93 
     | 
    
         
             
                requirements:
         
     | 
| 
       80 
     | 
    
         
            -
                - - " 
     | 
| 
      
 94 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       81 
95 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       82 
96 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       83 
     | 
    
         
            -
            description:  
     | 
| 
       84 
     | 
    
         
            -
              Make it go!\n\nAwsm is written in Ruby 2.1, so you'll need that to start with, you'll
         
     | 
| 
       85 
     | 
    
         
            -
              also need the `bundler` gem.\n\n\t[you@host:~]$ git clone https://github.com/mduk/awsome\n\t[you@host:~]$
         
     | 
| 
       86 
     | 
    
         
            -
              cd awsome\n\nAwsm requires four enviornment variables to be set in order to work.
         
     | 
| 
       87 
     | 
    
         
            -
              I use something like this:\n\n\t#!/bin/bash\n\n\texport AWS_ACCESS_KEY_ID=\"You
         
     | 
| 
       88 
     | 
    
         
            -
              do not leak keys on github.\"\n\texport AWS_SECRET_ACCESS_KEY=\"You DO, NOT, LEAK,
         
     | 
| 
       89 
     | 
    
         
            -
              keys on github!\"\n\texport AWS_REGION=\"eu-west-1\"\n\texport AWSM_HOSTEDZONE=\"Don't
         
     | 
| 
       90 
     | 
    
         
            -
              leak this either.\"\n\n\techo -e \"\\033[1m\\033[92mAWS Environment Set.\\033[0m\"\n\nOnce
         
     | 
| 
       91 
     | 
    
         
            -
              you have that in place, install dependencies.\n\n\t[you@host:~/awsome]$ bundle install\n\nInitialise
         
     | 
| 
       92 
     | 
    
         
            -
              environment variables.\n\n\t[you@host:~/awsome]$ source ./setvars.sh\n\tAWS Environment
         
     | 
| 
       93 
     | 
    
         
            -
              Set.\n\nAnd off you go.\n\n\t[you@host:~/awsome]$ bundle exec awsome search -dia
         
     | 
| 
       94 
     | 
    
         
            -
              beta\n\n\n# Licence\n\nSee `LICENCE.txt` file.\n"
         
     | 
| 
      
 97 
     | 
    
         
            +
            description: Awsm AWS queryer
         
     | 
| 
       95 
98 
     | 
    
         
             
            email:
         
     | 
| 
       96 
99 
     | 
    
         
             
            - daniel@kendell.org
         
     | 
| 
       97 
100 
     | 
    
         
             
            executables:
         
     | 
| 
         @@ -108,12 +111,16 @@ files: 
     | 
|
| 
       108 
111 
     | 
    
         
             
            - bin/awsm
         
     | 
| 
       109 
112 
     | 
    
         
             
            - lib/awsm.rb
         
     | 
| 
       110 
113 
     | 
    
         
             
            - lib/awsm/autoscalinggroups.rb
         
     | 
| 
       111 
     | 
    
         
            -
            - lib/awsm/cli.rb
         
     | 
| 
      
 114 
     | 
    
         
            +
            - lib/awsm/cli/main.rb
         
     | 
| 
      
 115 
     | 
    
         
            +
            - lib/awsm/cli/spin.rb
         
     | 
| 
      
 116 
     | 
    
         
            +
            - lib/awsm/cli/unused.rb
         
     | 
| 
      
 117 
     | 
    
         
            +
            - lib/awsm/clibase.rb
         
     | 
| 
      
 118 
     | 
    
         
            +
            - lib/awsm/config.rb
         
     | 
| 
       112 
119 
     | 
    
         
             
            - lib/awsm/dns.rb
         
     | 
| 
       113 
120 
     | 
    
         
             
            - lib/awsm/instances.rb
         
     | 
| 
       114 
121 
     | 
    
         
             
            - lib/awsm/loadbalancers.rb
         
     | 
| 
       115 
122 
     | 
    
         
             
            - lib/awsm/version.rb
         
     | 
| 
       116 
     | 
    
         
            -
            homepage:  
     | 
| 
      
 123 
     | 
    
         
            +
            homepage: ''
         
     | 
| 
       117 
124 
     | 
    
         
             
            licenses:
         
     | 
| 
       118 
125 
     | 
    
         
             
            - MIT
         
     | 
| 
       119 
126 
     | 
    
         
             
            metadata: {}
         
     |