If you’re preparing for the RHCSA exam or just getting started with Linux in the cloud, AWS EC2 is a great place to spin up a Red Hat Enterprise Linux 9 (RHEL 9) VM for hands-on practice.
In this guide, we’ll walk through:
- Creating a RHEL 9 instance in AWS EC2
- Choosing the right instance type (and free tier tips)
- Converting your AWS key to a PuTTY-compatible format
- Connecting with PuTTY
- Setting up security groups for SSH access
- Troubleshooting common connection issues
📑 Table of Contents
- 1. Launch a RHEL 9 Instance
- 2. Choose the Right Instance Type
- 3. Configure Security Group for SSH
- 4. Download and Convert the AWS Key
- 5. Connect with PuTTY
- 6. Gain Root Access
- 7. Troubleshooting PuTTY SSH Issues
1️⃣ Launch a RHEL 9 Instance
- Log in to the AWS Management Console and go to EC2 → Launch Instances.
-
Name your instance (e.g.,
rhel9-lab
). - Under Amazon Machine Image (AMI), search for:
Red Hat Enterprise Linux 9
- Select the latest version.
- Choose your instance type (see below).
2️⃣ Choose the Right Instance Type
For free tier eligibility:
-
t2.micro
ort3.micro
are free tier–eligible. - Important: RHEL still has a license cost, even on free tier.
- If you want completely free practice but still RHCSA-compatible, choose Rocky Linux 9 or AlmaLinux 9, they’re free and similar to RHEL.
3️⃣ Configure Security Group for SSH
Security groups control inbound/outbound traffic to your VM.
- Add an Inbound Rule:
- Type: SSH
- Port Range: 22
- Source: My IP (most secure) or Anywhere (0.0.0.0/0) if you need flexibility during testing.
💡 For my RHCSA lab, I had to temporarily set Anywhere to connect from multiple networks. Remember to restrict this in a real-world environment for security best practice.
4️⃣ Download and Convert the AWS Key
When launching your instance, AWS will prompt you to create or use an existing Key Pair.
-
Download the
.pem
file — keep it safe! - Install PuTTYgen (comes with PuTTY).
- Open PuTTYgen → Load your
.pem
file (set file filter to All Files). - Click Save Private Key → Save as
.ppk
.
📝 Why convert? PuTTY only works with
.ppk
(private key) format. The public key is already on your AWS instance.
5️⃣ Connect with PuTTY
- Open PuTTY.
- In Host Name, enter:
ec2-user@<Your Public IPv4 DNS or IP>
- Go to Connection → SSH → Auth → Credentials → Browse and select your
.ppk
file. - Click Open → Accept the SSH security alert.
You should now be connected as ec2-user
.
6️⃣ Gain Root Access
AWS disables direct root SSH login by default for security.
To run commands as root use:
sudo
You now have a root shell for RHCSA practice.
7️⃣ Troubleshooting PuTTY SSH Issues
Error: Connection timed out
→ Check security group rules for inbound SSH on port 22.Error: Server refused our key
→ Ensure you loaded the correct.ppk
file in PuTTY.Only works from one location
→ Your security group might be set to “My IP.” Change to “Anywhere” during testing.
💰 Cost-Saving Tip: Stop Your Instance When Not in Use
AWS charges for your EC2 instance while it’s running — even if you’re not connected.If you’re using your VM for RHCSA practice or occasional testing, stop the instance when you’re done:
- In the AWS EC2 Console, select your instance.
- Click Instance State → Stop Instance.
- Your instance will shut down, but all data on the attached EBS volume will be preserved.
🔹 You can start it again anytime, but remember: if you have a public IP, it may change unless you use an Elastic IP.
This simple step can save you money while keeping your lab ready for next time.
✅ Final Tip: For RHCSA exam prep, using AWS with RHEL 9 is convenient, but if you want to avoid costs while learning Linux, Rocky Linux 9 or AlmaLinux 9 on t2.micro is free tier–eligible.
Top comments (0)