Class: KeyPair
- Inherits:
-
Object
- Object
- KeyPair
- Defined in:
- lib/eops/key_pair.rb
Instance Method Summary collapse
- #create(name) ⇒ Object
- #delete(name) ⇒ Object
-
#initialize ⇒ KeyPair
constructor
A new instance of KeyPair.
Constructor Details
#initialize ⇒ KeyPair
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 |