Class: Meroku::Infrastructure::Server

Inherits:
Object
  • Object
show all
Includes:
Aws::Ec2
Defined in:
lib/meroku/infrastructure/server.rb

Overview

A server hosts the api (called during signup, login, etc) and atm also hosts end users applications

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Aws::Ec2

associate_address, #ec2_client, ec2_client, #make_instance, #tag

Constructor Details

#initialize(instance_id) ⇒ Server

Returns a new instance of Server



10
11
12
# File 'lib/meroku/infrastructure/server.rb', line 10

def initialize(instance_id)
  @instance_id = instance_id
end

Instance Attribute Details

#instance_idObject (readonly)

Returns the value of attribute instance_id



8
9
10
# File 'lib/meroku/infrastructure/server.rb', line 8

def instance_id
  @instance_id
end

Instance Method Details

#shutdownObject



14
15
16
17
# File 'lib/meroku/infrastructure/server.rb', line 14

def shutdown
  puts "Will terminate #{@instance_id}"
  ec2_client.terminate_instances(instance_ids: [@instance_id])
end