DEV Community

PETER Samuel
PETER Samuel

Posted on

How to Launch an EC2 Instance and Deploy a Custom NGINX Web Server on AWS Free Tier Using Git Bash

Introduction
Amazon EC2 (Elastic Compute Cloud) is a widely used service that allows you to create and manage virtual servers in the cloud. In this article, I will walk you through how to manually launch an EC2 instance using the AWS Management Console (no CLI required), connect to it via Git Bash using SSH, install NGINX web server, and customize the default web page to display your own message.

As part of this tutorial, I will also show detailed screenshots annotated using Screenpresso at each step to make the process clear and easy to follow.

This guide is perfect for beginners using AWS Free Tier who want to deploy a simple web server manually.

Prerequisites
Before we begin, make sure you have:

✅ A valid AWS Free Tier account.

✅ Git Bash installed on your local machine (Windows).

✅ Basic understanding of web servers and SSH.

Step 1: Log In to the AWS Management Console

First, we need to log in to our AWS account.

Open your web browser and go to https://console.aws.amazon.com/.

Enter your login credentials and sign in.

Why this is important:The AWS Console is the web interface that allows you to manage all AWS services

Image description

Image description

Step 2: Launch a New EC2 Instance

2.1 Go to the EC2 Dashboard

In the AWS search bar, type EC2 and select it to open the EC2 service dashboard.

2.2 Launch Instance

Click “Launch instance” to start creating your virtual server.

Image description

2.3 Configure the Instance

Name: Choose a simple name like nginx-demo for easy identification.

Amazon Machine Image (AMI): Select Amazon Linux 2 AMI (x86_64) – this is free-tier eligible and suitable for this tutorial.

Instance Type: Select t2.micro (Free Tier eligible).

Image description

Image description

2.4 Create a Key Pair

Click “Create new key pair”.

Choose RSA and select .pem format (for Git Bash).

Download and securely save the key file (example: MyKeyPairin.pem).This file is the only way to SSH into your instance. Don’t lose it!

Image description

Image description

2.5 Configure Security Group

Ensure that SSH (port 22) is open so you can connect.

Also, allow HTTP (port 80) so your web server can be accessed publicly.

Image description

2.6 Review and Launch

Confirm the settings and click “Launch instance”.

Why this is important:These configurations allow your virtual server to be accessible and manageable remotely.

Image description

Step 3: Find Your EC2 Instance’s Public IP

Once your instance is running:

Go to the EC2 Dashboard > Instances.

Find your instance and copy its Public IPv4 address.

Why this is important:You will use this public IP to connect to your server via Git Bash and to access the NGINX web page.

Image description

Image description

Image description

Step 4: Connect to the EC2 Instance Using Git Bash

4.1 Open Git Bash

Git Bash allows Windows users to use Linux commands and connect via SSH.

4.2 Navigate to Your Key Pair File

cd /c/Users/YourUsername/Downloads

Replace YourUsername with your actual Windows username.

4.3 Set Correct File Permissions

chmod 400 MyKeyPairin.pem

This step is required to ensure your SSH key is secure. Without this, Git Bash will not allow the connection.

4.4 Connect via SSH

ssh -i MyKeyPairin.pem ec2-user@

Replace with the IP address of your EC2 instance.

What to expect:You will see a security prompt the first time. Type yes to continue. You should now be inside your EC2 server terminal.

Image description

Step 5: Update the System and Install NGINX

5.1 Update System Packages

sudo yum update -y

This ensures your system is up to date.

5.2 Install NGINX Web Server

sudo amazon-linux-extras install nginx1 -y

This installs NGINX from the Amazon Linux repositories.

5.3 Start the NGINX Service

sudo systemctl start nginx

Starts the web server so it can serve web pages.

5.4 Enable NGINX on Boot

sudo systemctl enable nginx

This ensures NGINX starts automatically when the server restarts.

Image description

Step 6: Test NGINX Web Server in Browser

Open your browser and visit:

http://

You should see the default NGINX welcome page.

Why this is important:This confirms that your NGINX web server is correctly installed and reachable.

Image description

Conclusion

In this tutorial, you have learned how to:

Launch an EC2 instance on AWS Free Tier using the web console.

Connect to the instance securely using Git Bash.

Install and configure the NGINX web server.

Top comments (1)

Collapse
 
nevodavid profile image
Nevo David

nice one, i remember how wild it felt first time setting all this up myself - you think putting in the effort to get hands-on like this really changes how fast you learn or nah?