Change key pair for ec2 instance

2 solution to change key

  • run this command after your download aws pem
$ ssh-keygen -f YOURKEY.pem -y
...
ssh-rsa xxxxx

then dump output into authorized_key


  • copy pem file to AWS instance and execute this command
$ chmod 600 YOURKEY.pem

then

$ ssh-keygen -f YOURKEY.pem -y >> ~/.ssh/authorized_keys

https://stackoverflow.com/questions/7881469/change-key-pair-for-ec2-instance https://jaedsada.me/blogs/ubuntu/gen-public