Class: KeyPair

Inherits:
Object
  • Object
show all
Defined in:
lib/eops/key_pair.rb

Instance Method Summary collapse

Constructor Details

#initializeKeyPair

Returns a new instance of KeyPair.



2
3
4
# File 'lib/eops/key_pair.rb', line 2

def initialize
  @ec2 = AWS::EC2.new
end

Instance Method Details

#create(name) ⇒ Object



6
7
8
9
10
11
# File 'lib/eops/key_pair.rb', line 6

def create(name)
  key_pair = @ec2.key_pairs.create(name)
  File.open("/tmp/#{name}", "w") do |f|
    f.write(key_pair.private_key)
  end
end

#delete(name) ⇒ Object



13
14
15
# File 'lib/eops/key_pair.rb', line 13

def delete(name)
  @ec2.key_pairs[name].delete
end