How to change the security key of AWS EC2 instance

Please share it on

Changing server passwords in a certain time period is a good security practice. In case of security key, you need to update it in some use cases. Here I’m talking about updating aws ec2 security key to the existing ec2 instance. Create a new EC2 security key from amazon ec2 console.

create_secutiy_key

# ssh-keygen -y -f server.pem >> server.pub

Here “server.pem” is the newly generated private key and you can generate public key from the private key by using above command.

# ssh-copy-id -i server.pub sathish@server1901.w3boostrap.com

Where “server.pub” is the public key, “sathish” is the username of server which you want to update the credentials/keys and “server1901.w3boostrap.com” is the server name.

After updating it, you can login with new credentials

# ssh -i server.pem sathish@server1901.w3boostrap.com

Please share it on

Leave a Reply

Your email address will not be published. Required fields are marked *