Class: Akashi::Ec2::KeyPair

Inherits:
Base show all
Defined in:
lib/akashi/ec2/key_pair.rb

Class Method Summary collapse

Methods inherited from Base

#name, #name=, service_class

Methods inherited from Base

all, base_class, collection, find, find_by, #initialize, object_class, where

Constructor Details

This class inherits a constructor from Akashi::Base

Class Method Details

.createObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/akashi/ec2/key_pair.rb', line 9

def create
  response = Akashi::Aws.ec2.client.import_key_pair(
    key_name:            Akashi.name,
    public_key_material: Base64.encode64(Akashi.manifest.ec2.public_key)
  )

  new(response[:key_name]).tap do |instance|
    puts "Created a KeyPair (#{instance.id})."
  end
end