The DescribeKeyPairs operation returns information about key pairs available to you. If you specify key pairs, information about those key pairs is returned. Otherwise, information for all registered key pairs is returned.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
A |
Examples
Describe the key pairs in your account.
$ec2 = new AmazonEC2(); $response = $ec2->describe_key_pairs(); var_dump($response->isOK());Result:
bool(true)
Describe specific key pairs in your account.
$ec2 = new AmazonEC2(); $response = $ec2->describe_key_pairs(array( 'KeyName' => 'my-keypair' )); var_dump($response->isOK());Result:
bool(true)
Describe multiple key pairs in your account.
$ec2 = new AmazonEC2(); $response = $ec2->describe_key_pairs(array( 'KeyName' => array( 'my-keypair', 'my-keypair2' ) )); var_dump($response->isOK());Result:
bool(true)
Filter key pairs.
$ec2 = new AmazonEC2(); $response = $ec2->describe_key_pairs(array( 'Filter' => array( array('Name' => 'key-name'), ) )); var_dump($response->isOK());Result:
bool(true)
Related Methods
Source
Method defined in services/ec2.class.php | Toggle source view (24 lines) | View on GitHub