【发布时间】:2021-11-22 13:33:42
【问题描述】:
谁能解释为什么我无法连接到我的 ec2?我试图自己解决这个问题,但没有成功。
首先,创建密钥:
aws ec2 create-key-pair --key-name mykeys --region eu-central-1 --output text > mykeys.pem
然后创建ec2实例:
aws ec2 run-instances --image-id ami-06ec8443c2a35b0ba --count 1 --instance-type t2.micro --key-name mykeys --security-group-ids sg-xxx --subnet-id subnet-xxx
在尝试连接到 ec2 时,我时常会收到权限拒绝;
The authenticity of host 'ec2-18-185-248-81.eu-central-1.compute.amazonaws.com (18.185.248.81)' can't be established.
ED25519 key fingerprint is SHA256:SbRamk5HTetJT6ysgqq3MLdsUU6Ehi/kYRWXtgwS3q4.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'ec2-18-185-248-82.eu-central-1.compute.amazonaws.com' (ED25519) to the list of known hosts.
Load key "mykeys.pem": invalid format
ec2-user@ec2-18-185-248-81.eu-central-1.compute.amazonaws.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
也无法从 AWS 内部通过 EC2 Instant Connect 进行连接
ec2-user@ec2-3-67-176-40.eu-central-1.compute.amazonaws.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
是否可能是密钥创建错误?
Load key "mykeys.pem": invalid format
【问题讨论】:
标签: amazon-web-services amazon-ec2 aws-cli