Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to use the same keypair from one availability zone in another but I cannot import it. If I generate a new key I get the same error.

See AWS console > Newtwork and Security > Key pairs > Import key pair then choose an existing EC2 keypair and I get the following error:

Value (LS0tL...tLS0t) for parameter PublicKeyMaterial is invalid. Length exceeds maximum of 1024

Why would imported public key pairs have to be smaller than the key pairs AWS generates?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You are trying to import the private ssh key file. You should be importing the public ssh key file only.

On Linux, you can extract the public key from the private key using:

ssh-keygen -y -f KEYPAIR.pem

Amazon EC2 does not need to know your private ssh key. You should keep this secret and not share it with anyone, not even Amazon.

Here's an article I wrote which describes my recommendation that you generate and upload your own default ssh key to EC2:

Uploading Personal ssh Keys to Amazon EC2
http://alestic.com/2010/10/ec2-ssh-keys

This makes it easier to work with and access EC2 instances, no matter what region you're running them in.

share|improve this answer
    
Oh duh. Thanks! –  KCD Nov 29 '11 at 0:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.