noscript

In Amazon EC2, require key pair to access it. Key pair consists of a public key and private key. The public key is stored on AWS, while the private key is kept securely on your computer. This pair is used to securely connect to your EC2 instances. We can login to Linux instance using the private key remotely and using private key we can decrypt password for windows ec2 instance. Ensure you keep your private key safe and backed up, as losing it means you can’t access your instances.

To install Git Bash on Windows:

  1. Download: Download Git Bash from gitforwindows.org to get started
  2. Run Installer: Open the downloaded file.
  3. Setup Steps:
    • Click “Next” on the welcome screen.
    • Select where you want to install it, then click “Next”.
    • Opt for “Git using command line and third-party tools,” then proceed with “Next.”
    • Pick “Utilize the OpenSSL library” and proceed with “Next.”
    • Opt for “Check out with Windows-style, commit with Unix-style line endings” and proceed with “Next.”
    • Select “Use MinTTY (default MSYS2 terminal)” and proceed with “Next.”
    • Complete the setup with default settings and click “Install.”
  4. Finish: Click “Finish” when done.
  5. Launch: Open Git Bash from the Start menu.

 

To generate an SSH key pair using Git Bash on Windows:

  1. Open Git Bash.
  2. Run ssh-keygen -t rsa -b 4096 -C your_email@example.com
  3. Press Enter to accept the default file location or specify a different one.
  4. Enter a passphrase (optional) and press Enter.
  5. Find your keys in C:\Users\your_username\.ssh\:
    1. id_rsa (private key)
    2. pub (public key)

Use the private key to connect to EC2, and copy the public key for setup in AWS.

To add a private key to a Linux EC2 instance:

  1. Connect to EC2: Use your current private key to SSH into the instance:

ssh -i /path/to/current-key.pem ec2-user@your-ec2-public-dns

  1. Edit authorized_keys: Open the authorized_keys file:

nano ~/.ssh/authorized_keys

3.Paste Public Key: Copy your public key (not the private key) from your local machine and paste it into the authorized_keys file.

4.Save and Exit: In nano, press Ctrl+X, then Y, and Enter.

Now try to access EC2 with new key.

 

                                                                               For Information & classes Call02048553009
                                                                                       Registration Link: Click Here!

Author:-
Amol Shende
AWS Trainer

IT Education Centre Placement & Training Institute

© Copyright 2024 | IT Education Centre.