Showing posts with label EC2. Show all posts
Showing posts with label EC2. Show all posts

Sunday, December 4, 2022

Convert a putty .ppk key to an Amazon .pem file on Mac

$ brew install putty

$ puttygen key.ppk -O private-openssh -o key.pem


$ openssl x509 -in certificatename.cer -outform PEM -out certificatename.pem

Migrate Linux server to AWS EC2

Visit: AWS Replication Agent installation

wget -O ./

sudo python3 --region us-west-2

Sunday, September 4, 2022

How to access EC2 instance if lost key Pair and root credentials


Create a new instance with same OS as previous one or create it from AIM made from old instance


Shutdown the old instance and detach the volume


Shutdown new instance Attached the detached volume to new instance and start the instance


Login new instance using ssh console

Run the following commands:


df -h

cd mnt

mkdir oldvolume

sudo mount /dev/sda1 mnt/oldvolume

cd mnt/oldvolume/root/.ssh

sudo vi authorized_keys

Now add your public key and save 

umount /dev/sda1

sudo shutdown now


Now detach the dev/sda1 volume from new instance and attach to old instance as dev/sda


Reboot old instance from AWS dashboard and login your old instance using ssh console 

 Note: Your old instance IP will be changed after doing this if no elastic IP

Thursday, August 25, 2022

How to add public key to authorized_keys ec2 instance Ubunutu Linux

 Step 1: Login into you AWS account and go to EC2 instances

Step 2: Select your instance and click connect

Step 2: Then click connect button at the bottom right corner

Step 3: Now a new tab will be opened with console as follows

Step 4: Copy your SSH public key then add the key to the following key file

Use this command in Mac/Windows powershell to copy your public key: pbcopy ~/.ssh/

nano ~/.ssh/authorized_keys

Step 5: Save and reboot then try to connect again with device from which public key generated.

How to merge a branch to main branch in Github.

In Terminal or Command Prompt:  git checkout main  [switch to main branch] git pull origin main  [grab latest updates from main branch] git ...