Step 1: Connect via ssh using Key pair
Process:
- Create a key pair in the .ppk format (or .pem format if you need an alternative to using an SSH tool) and download the private key to your local desktop or laptop.
- Attach the Key pair during the creation of the AWS virtual machine.
- Copy the Public IP of the virtual machine.
- Follow these steps to connect to a Linux instance:
- Launch PuTTY or another compatible tool.
- Expand Connection > SSH > Auth and select credentials.
- Click Browse and locate your private key file.
- The Linux terminal will open and ask for a username. Enter the appropriate username based on the Linux distribution (e.g., "ec2-user" for Amazon Linux or "ubuntu" for Ubuntu).
Step 2: Connect via ssh using own SSH Key defined in the Key pair
Process:
- On your local machine, generate an SSH key pair.
- Save public key and private key, on your local machine.
- Navigate to the Key pair page and choose "Actions"
- Click on "Import Key Pair" and add your public key
- Attach the Key pair during the creation of the AWS virtual machine.
- Copy the Public IP of the virtual machine.
- Follow these steps to connect to a Linux instance:
- Launch PuTTY or another compatible tool.
- Expand Connection > SSH > Auth and select credentials.
- Click Browse and locate your private key file.
- The Linux terminal will open and ask for a username. Enter the appropriate username based on the Linux distribution (e.g., "ec2-user" for Amazon Linux or "ubuntu" for Ubuntu).
Step 3: Connect via AWS Console
Process:
- Create the AWS virtual machine.
- Go to the EC2 page and select "Instances."
- Find your Linux virtual machine and click "Connect."
- Choose "EC2 Instance Connect" and then "Connect using EC2 Instance Connect."
- Finally, click "Connect".
- A browser-based terminal will launch, providing direct access to the instance.
Step 4: Connect via AWS System manager
Process:
- Create an IAM role and attach the "AmazonSSMManagedInstanceCore" policy.
- Attach the IAM role while creating the AWS virtual machine.
- Navigate to the System Manager page and choose "Session Manager"
- Click on "Start Session."
- Wait until the Linux instance appears, then select it and click "Start Session."
- A browser-based terminal will launch, providing direct access to the instance.
Step 5: Connect via ssh using password
Process:
- While creating the Linux virtual machine.
- In the Advanced details section:
- Copy the script below (adjust it according to your Linux distribution) under user data.
#!/bin/bash
echo 'lab-password' | passwd ec2-user --stdin
sed -i 's|[#]*PasswordAuthentication no|PasswordAuthentication yes|g' /etc/ssh/sshd_config
systemctl restart sshd.service
- Copy the Public IP of the virtual machine.
- Follow these steps to connect to a Linux instance:
- Launch PuTTY or another compatible tool.
- The Linux terminal will open and ask for a username and password. Enter the appropriate username based on the Linux distribution (e.g., "ec2-user" for Amazon Linux or "ubuntu" for Ubuntu) and password.
Top comments (0)