2017-05-09 26 views
1

これを解決するには?AWS CLI:キーが有効なOpenSSH公開鍵フォーマットではありません

# 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 

答えて

1

は、あなたの鍵を作成し、AWSの--public-key-material引数を呼び出すときに、あなたのキーパスの前にfile://でそれを呼び出します。

例:

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

file://プレフィックスは、通常のWindowsのために使用され、これは、奇妙な問題である、しかし、ここではAWSと、それは同様に、UNIXベースの端末に適用されます。

関連する問題