Method: Fog::Compute::AWS::Real#import_key_pair

Defined in:
lib/fog/compute/requests/aws/import_key_pair.rb

#import_key_pair(key_name, public_key_material) ⇒ Object

Import an existing public key to create a new key pair

Parameters

  • key_name<~String> - Unique name for key pair.

  • public_key_material<~String> - RSA public key

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘keyFingerprint’<~String> - SHA-1 digest of DER encoded private key

      • ‘keyName’<~String> - Name of key

      • ‘requestId’<~String> - Id of request

Amazon API Reference



22
23
24
25
26
27
28
29
# File 'lib/fog/compute/requests/aws/import_key_pair.rb', line 22

def import_key_pair(key_name, public_key_material)
  request(
    'Action'  => 'ImportKeyPair',
    'KeyName' => key_name,
    'PublicKeyMaterial' => Base64::encode64(public_key_material),
    :parser   => Fog::Parsers::Compute::AWS::ImportKeyPair.new
  )
end