AWS Builder Center
Hands-on AWS: Launching Amazon Linux and RHEL EC2 Instances and Connecting via Git Bash

Hands-on AWS: Launching Amazon Linux and RHEL EC2 Instances and Connecting via Git Bash

A step-by-step practical guide on launching Amazon Linux and Red Hat Enterprise Linux EC2 instances, configuring key pairs, and connecting via SSH using Git Bash on Windows.

Connecting to cloud servers using the command line is an essential milestone when starting with Amazon Web Services (AWS).
In this walkthrough, I cover how to launch two popular distributions—Amazon Linux and Red Hat Enterprise Linux (RHEL)—and connect to them securely using Git Bash on Windows.



Prerequisites

Before starting, ensure you have:
  • An active AWS account.
  • Git for Windows installed (which includes Git Bash).
  • A downloaded  .pem  private key pair generated during the instance setup.



Step 1: Launching the EC2 Instances

  1. Open the AWS Management Console and navigate to the EC2 Dashboard.
  1. Click Launch instance.
  1. Configure the instance settings:
  • Name: Assign a clear tag (such as  Linux-Lab-Host  or  RHEL-Node ).
  • AMI: Choose either Amazon Linux 2023 or Red Hat Enterprise Linux (RHEL) (both have Free Tier eligible options).
  • Instance Type: Select  t2.micro  (or  t3.micro ).
  • Key Pair: Select an existing key pair or create a new one using RSA and  .pem  format. Download and save it to a known directory (e.g.,  Downloads  or  ~/.ssh ).
  • Network Settings: Ensure Auto-assign Public IP is enabled and keep SSH traffic (port 22) open for your connection.
  1. Click Launch instance. Repeat these steps if creating a second instance for the other OS.



Step 2: Preparing Git Bash and Setting Key Permissions

Open Git Bash and change directory to the folder containing your  .pem  file:
cd ~/Downloads

STEP 3 :- Connecting the amazon Linux to gitbash
  • 1.In the EC2 Console, select your running Amazon Linux instance and copy its Public IPv4 address.
  • 2.The default remote username for Amazon Linux is  ec2-user .
  • 3.In Git Bash, run this code :-
ssh -i your-key-name.pem ec2-user@\<YOUR\_AMAZON\_LINUX\_PUBLIC\_IP>

STEP 4 :- Connecting to Red Hat Enterprise Linux (RHEL)
  • 1.Select your running RHEL instance in the EC2 Console and copy its Public IPv4 address.
  • 2.For official RHEL AMIs, the default remote username is also  ec2-user .
  • 3.Run the SSH command in Git Bash:
ssh -i your-key-name.pem ec2-user@\<YOUR\_RHEL\_PUBLIC\_IP>










Tags

 aws-certification ,  ec2 ,  beginner-projects ,  linux ,  cloud-fundamentals 
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article