To connect to an Amazon Elastic Compute Cloud (EC2) instance using PuTTY, you will need to follow these steps:
Prepare your EC2 instance:
Launch an EC2 instance in your AWS account if you haven't already done so.
Ensure that you have the private key (.pem) file associated with the EC2 instance. You'll need this key to authenticate.
Download and Install PuTTY:
If you don't have PuTTY installed on your local machine, you can download it from the official website: https://www.putty.org/
Convert the .pem key to a .ppk key:
PuTTY uses a different key format (.ppk) compared to AWS's .pem key. You need to convert the .pem key to a .ppk key using PuTTYgen, a utility that comes with PuTTY:
Open PuTTYgen.
Click "Load" and select your .pem key file.
Click "Save private key" to save the private key in .ppk format.
Launch PuTTY:
Open PuTTY (the main PuTTY application).
Configure the PuTTY Session:
In the PuTTY Configuration window:
Under "Host Name (or IP address)," enter the public IP address or DNS name of your EC2 instance.
In the "Port" field, enter "22" (the default SSH port).
In the "Connection type" section, make sure "SSH" is selected.
Configure SSH Authentication:
In the left sidebar of the PuTTY Configuration window, click on "SSH" to expand the options.
Click on "Auth."
In the "Private key file for authentication" field, browse and select the .ppk key you generated earlier.
Save the PuTTY Session Configuration:
Go back to the "Session" category in the left sidebar.
Enter a name for your session under "Saved Sessions" (e.g., "MyEC2Instance").
Click the "Save" button to save your configuration.
Connect to Your EC2 Instance:
In the PuTTY Configuration window, select the saved session (e.g., "MyEC2Instance").
Click the "Open" button to start the SSH connection.
Authenticate:
If everything is set up correctly, PuTTY will open a terminal window and connect to your EC2 instance.
You may be prompted for the username. The default username for most Amazon Linux instances is "ec2-user," but it may vary depending on the instance's operating system. Check the AWS documentation or the information provided when launching the instance for the correct username.
You're now connected:
You can use the PuTTY terminal to interact with your EC2 instance as if you were using a local terminal.
That's it! You should now be able to connect to your EC2 instance using PuTTY. Make sure your security groups and network settings are correctly configured to allow SSH traffic to your instance.