How do I find my AWS keypair public key?

So, a developer on our team deleted the public key for our key App-Production.pem

in ours .ssh/authorized_keys

, so by default, the AWS key pair no longer works, breaking our deployment pipeline.

Where can I find the public key to add to authorized_keys

? Is it possible to do this without loading a new instance?

+3


source to share


1 answer


If you have the private key, you can get the public key.

If you are using Linux, use the following command:

ssh-keygen -y

      

Then, when prompted, provide the path to the private key file. After that, you will be provided with a public key. Save it.



Then use the following steps to regain access to this instance.

  • Stop your instance
  • Detach root volume
  • Mount the volume to another instance as a data volume
  • Modify the file with the authorized_keys

    public key
  • Detach the data volume
  • Reattach the volume to the infected instance

Follow this document for more information .

+3


source







All Articles