Sha256: adc0282eab4d7cef69fbfc72741dedc67dccbb8380dbe7e6dfb9dd1d373e6c10

Contents?: true

Size: 571 Bytes

Versions: 3

Compression:

Stored size: 571 Bytes

Contents

require "meroku/infrastructure/node"

module Meroku
  module Infrastructure

    extend Meroku::Aws

    def self.despawn
      instances = ec2_client.describe_instances(filters:[{ name: "tag:Name", values: ['node'] }, { name: 'instance-state-name', values: ['running','pending'] }]).reservations.map { |xx| xx.instances.first.instance_id }
      puts "will despawn #{instances.inspect}"
      ec2_client.terminate_instances({
                                       instance_ids: instances
                                     }) if instances.size > 0
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
meroku-2.0.3 lib/meroku/infrastructure.rb
meroku-2.0.2 lib/meroku/infrastructure.rb
meroku-2.0.1 lib/meroku/infrastructure.rb