Module: Meroku::Infrastructure

Extended by:
Aws::Ec2
Defined in:
lib/meroku/infrastructure.rb,
lib/meroku/infrastructure/server.rb

Overview

Logic related to the infratructure that powers meroku

Defined Under Namespace

Classes: Server

Class Method Summary collapse

Methods included from Aws::Ec2

associate_address, ec2_client, ec2_client, make_instance, tag

Class Method Details

.each_serverObject



19
20
21
# File 'lib/meroku/infrastructure.rb', line 19

def self.each_server
  servers.each { |s| yield s }
end

.serversObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/meroku/infrastructure.rb', line 8

def self.servers
  ec2_client.describe_instances(
    filters: [
      { name: 'tag:Name', values: ['node'] },
      { name: 'instance-state-name', values: %w[running pending] }
    ]
  ).reservations.map do |xx|
    Meroku::Infrastructure::Server.new(xx.instances.first.instance_id)
  end
end