How to Connect to EC2 Instance Easily Without Password

First, you need to Create an EC2 instance and connect it to the local terminal

- Now, open a new terminal on local and run the command:
ssh-keygen -t rsa

- Open the ".ssh" folder and copy the content from the "id_rsa.pub" file.
cat .ssh/id_rsa.pub

- Open the EC2 instance you want to connect to and access the .ssh folder there.

- Now, open the authorized_keys file and paste the content you copied from your local terminal inside the authorized_keys at the end, then save the file.
vim authorized_keys

- You can now SSH to the EC2 instance without a password from your local terminal. Just use the private IP address of your EC2 instance.

- copy your EC2 instance private IPv4 address and paste it in your local terminal using the command
ssh <your-private-ip>
Congrats! You can now connect to your instance without using a password



