Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages
VM::EC2::REST::keys(3) User Contributed Perl Documentation VM::EC2::REST::keys(3)

 use VM::EC2 ':standard';

These methods let you manipulate ssh key pairs.

Searches for ssh key pairs matching the provided filters and return a series of VM::EC2::KeyPair objects.
Optional arguments:
 -key_name      A single key name or an arrayref containing a list
                   of names
 -filter          Filter on tags and other attributes.
The full list of key filters can be found at:

Create a new key pair with the specified name (required). If the key pair already exists, returns undef. The contents of the new keypair, including the PEM-encoded private key, is contained in the returned VM::EC2::KeyPair object:
  my $key = $ec2->create_key_pair('My Keypair');
  if ($key) {
    print $key->fingerprint,"\n";
    print $key->privateKey,"\n";

Imports a preexisting public key into AWS under the specified name. If successful, returns a VM::EC2::KeyPair. The public key must be an RSA key of length 1024, 2048 or 4096. The method can be called with two unnamed arguments consisting of the key name and the public key material, or in a named argument form with the following argument names:
  -key_name     -- desired name for the imported key pair (required)
  -name         -- shorter version of -key_name
  -public_key_material -- public key data (required)
  -public_key   -- shorter version of the above
This example uses Net::SSH::Perl::Key to generate a new keypair, and then uploads the public key to Amazon.
  use Net::SSH::Perl::Key;
  my $newkey = Net::SSH::Perl::Key->keygen('RSA',1024);
  $newkey->write_private('.ssh/MyKeypair.rsa');  # save private parts
  my $key = $ec2->import_key_pair('My Keypair' => $newkey->dump_public)
      or die $ec2->error;
  print "My Keypair added with fingerprint ",$key->fingerprint,"\n";
Several different formats are accepted for the key, including SSH "authorized_keys" format (generated by ssh-keygen and Net::SSH::Perl::Key), the SSH public keys format, and DER format. You do not need to base64-encode the key or perform any other pre-processing.
Note that the algorithm used by Amazon to calculate its key fingerprints differs from the one used by the ssh library, so don't try to compare the key fingerprints returned by Amazon to the ones produced by ssh-keygen or Net::SSH::Perl::Key.

Deletes the key pair with the specified name (required). Returns true if successful.


Lincoln Stein <>.
Copyright (c) 2011 Ontario Institute for Cancer Research
This package and its accompanying libraries is free software; you can redistribute it and/or modify it under the terms of the GPL (either version 1, or at your option, any later version) or the Artistic License 2.0. Refer to LICENSE for the full license text. In addition, please see DISCLAIMER.txt for disclaimers of warranty.
2019-01-01 perl v5.28.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.