2017-05-09 3 views
1

Wie löst man das?AWS CLI: Schlüssel ist nicht in gültigem öffentlichen OpenSSH-Schlüsselformat

# I used this command to create the key with a password 
$ ssh-keygen -b 2048 -t rsa -C "awsfrankfurt" -f ~/.ssh/awsfrankfurt 

# Then when I try to import it into AWS EC2, the error appears: 
$ aws --region eu-central-1 ec2 import-key-pair \ 
    --key-name "awsfrankfurt" \ 
    --public-key-material ~/.ssh/awsfrankfurt 

An error occurred (InvalidKey.Format) when the ImportKeyPair operation: 
Key is not in valid OpenSSH public key format 

Antwort

1

Ihren Schlüssel erstellen und dann, wenn aws des --public-key-material Argument nennen, nennen Sie es mit file:// vor Ihrem Schlüsselpfad.

Beispiel:

$ aws --region eu-central-1 ec2 import-key-pair \ 
    --key-name "awsfrankfurt" \ 
    --public-key-material file://~/.ssh/awsfrankfurt # <-- this 

Dies ist eine seltsame Frage, weil file:// Präfix in der Regel für Windows verwendet wird, aber hier mit aws, gilt es für Unix-basierte Terminals als auch.

Verwandte Themen