Connect to AWS EC2 linux instance

can some give me the process of connecting AWS Linux instance from my own computer.

1 Like

There are 2 ways through which you can do the same.

  • Amazon EC2 console
  • SSH client

If you want to connect to your instance using the browser-based client from the Amazon EC2 console, follow these steps:

  • Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
  • Choose Instances In the navigation pane
  • Select the instance and choose Connect.
  • Choose EC2 Instance Connect.
  • Verify the user name and choose Connect to open a terminal window.

To connect to your instance using your own key and any SSH client

Generate new SSH private and public keys using the following command.

ssh-keygen -t rsa -f my_key

Push your SSH public key to the instance using the following command.

aws ec2-instance-connect send-ssh-public-key \

--region us-west-2 \

--availability-zone us-west-2b \

--instance-id i-001234a4bf70dec41EXAMPLE \

--instance-os-user ec2-user \

--ssh-public-key file://my_key.pub

Execute the command to connect to the instance using your private key.

ssh -o "IdentitiesOnly=yes" -i my_key [ec2-user@ec2-198-51-100-1.compute-1.amazonaws.com](mailto:ec2-user@ec2-198-51-100-1.compute-1.amazonaws.com)

2 Likes

thanks for this information

Connect to AWS instance in personally use PuTTY SSH client for this purpose. It stand out very well for me.

this command generate private key is in pem format which is not supported by PuTTY. There i use PuTTY key Generator to convert the private key pem format to .ppk format which is compatible with PuTTY.