Thursday, July 15, 2021

AWS : EC2 Key Pairs : How to connect if I lose my Private Key : Replace Your SSH Keys: Login : AWS Key Lost


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


A key pair, consisting of a public key and a private key, is a set of security credentials that you use to prove your identity when connecting to an EC2 instance. Amazon EC2 stores the public key on your instance, and you store the private key. 


Create a key pair using Amazon EC2

Create a key pair using a third-party tool and import the public key to Amazon EC2

Tag a public key

Retrieve the public key from the private key

Retrieve the public key through instance metadata

Locate the public key on an instance

Identify the key pair that was specified at launch

Verify your key pair's fingerprint

Add or replace a key pair for your instance

Delete your key pair

Delete a public key from an instance


--------------------------------------------------------------------------------------------------------

::Connect to your Linux instance if you lose your private key::

Lost Private key --> Detach from orig- Attach to Temp - Modify authorized_keys - Detach from Temp - Attach Again to orig


https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/replacing-lost-key-pair.html


Step 1: Create a new key pair

Step 2: Get information about the original instance and its root volume

Step 3: Stop the original instance

Step 4: Launch a temporary instance

Step 5: Detach the root volume from the original instance and attach it to the temporary instance

Step 6: Add the new public key to authorized_keys on the original volume mounted to the temporary instance

Step 7: Unmount and detach the original volume from the temporary instance, and reattach it to the original instance

Step 8: Connect to the original instance using the new key pair

Step 9: Clean up

--------------------------------------------------------------------------------------------------------

To add or replace a key pair


Connect to Instance using old mechanism=>  Public Keys => add new Key => authorized-keys


https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html#replacing-key-pair


No comments:

Post a Comment

Azure - Pipeline - Add Approver for Stage

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass