import_key_pair ( $key_name, $public_key_material, $opt )

Imports the public key from an RSA key pair created with a third-party tool. This operation differs from CreateKeyPair as the private key is never transferred between the caller and AWS servers.

RSA key pairs are easily created on Microsoft Windows and Linux OS systems using the ssh-keygen command line tool provided with the standard OpenSSH installation. Standard library support for RSA key pair creation is also available for Java, Ruby, Python, and many other programming languages.

The following formats are supported:

  • OpenSSH public key format.
  • Base64 encoded DER format.
  • SSH public key file format as specified in RFC 4716.

Access

public

Parameters

Parameter

Type

Required

Description

$key_name

string

Required

The unique name for the key pair.

$public_key_material

string

Required

The public key portion of the key pair being imported.

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This is useful for manually-managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Related Methods

Source

Method defined in services/ec2.class.php | Toggle source view (8 lines) | View on GitHub

public function import_key_pair($key_name, $public_key_material, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['KeyName'] = $key_name;
    $opt['PublicKeyMaterial'] = $this->util->is_base64($public_key_material) ? $public_key_material : base64_encode($public_key_material);

    return $this->authenticate('ImportKeyPair', $opt, $this->hostname);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback