problems connecting to an instance using EC2 Instance Connect Endpoint

0

I followed the guide [https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Connect-using-EC2-Instance-Connect-Endpoint.html ](Connect to your instances without requiring a public IPv4 address using EC2 Instance Connect Endpoint) and this one [https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-connect-methods.html#ec2-instance-connect-connecting-aws-cli](Connect using EC2 Instance Connect) to connect to my instance using "EC2 Instance Connect Endpoint" it works using the console but when trying to use my console and entering the command

aws ec2-instance-connect send-ssh-public-key --region us-east-1   \
--availability-zone us-east-1a  \
--instance-id i-001234a4bf70dec41EXAMPLE \
--instance-os-user ec2-user \
--ssh-public-key ./my_key.pub

I get the error

Parameter validation failed:
Invalid length for parameter SSHPublicKey, value: 12, valid min length: 80

to generate my key I did ssh-keygen -t rsa -f my_key

I am bit lost on what to do next

2개 답변
2

Try specifying files as follows.
You need to add "file://" to read the file.

aws ec2-instance-connect send-ssh-public-key --region us-east-1   \
--availability-zone us-east-1a  \
--instance-id i-001234a4bf70dec41EXAMPLE \
--instance-os-user ec2-user \
--ssh-public-key file://my_key.pub
profile picture
전문가
답변함 일 년 전
profile picture
전문가
검토됨 일 년 전
0

Hi, you need to generate the first pair of key for an EC2 instance via EC2 key generation procedure because EC2 instance needs to be loaded with the public key in order to allow you to connect.

More details at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html

To create such a key pair, follow https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-key-pairs.html#having-ec2-create-your-key-pair

profile pictureAWS
전문가
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠