Trying to connect using CentOS7
I deployed a couple of EC2 instances using terraform and now and trying to log in.
aws2 ec2-instance-connect send-ssh-public-key --instance-id i-0788274a4861154d44 --availability-zone us-east-2 --instance-os-user ec2-user --ssh-public-key file:/aws_ssh/my_rsa_key.pub
Parameter validation failed:
Invalid length for parameter SSHPublicKey, value: 42, valid range: 256-inf
I tried this command as well
ssh-keygen -t rsa -f my_rsa_key -b 1024
Still gives the same error.
I am new to this so as much help as you can give.
Connect using this command.. You tried to connect the instance using the first command...
After authentication, the public key is made available to the instance through the instance metadata for 60 seconds. During this time, connect to the instance using the associated private key
If for some reason you don’t connect within that 60-second window, you see the following error:
send-ssh-public-key just support
see this document: https://docs.amazonaws.cn/en_us/AWSEC2/latest/UserGuide/ec2-instance-connect-methods.html
I am not sure why..? But the problem got fixed after making the following changes in the syntax..
file:/ by file:///