Introduction
In this blog, we will create a simple EC2 instance using Linux, set up a basic web server, and access it from outside using a public IP. This is a fundamental hands-on exercise to understand how cloud servers work.
Prerequisites
- AWS account
- Basic Linux command knowledge
- SSH client (Terminal or Git Bash)
Step 1: Launch an EC2 Instance
- Log in to AWS Management Console
- Go to EC2 Dashboard
- Click Launch Instance
Configuration:
- Name: simple-linux-server
- AMI: Amazon Linux
- Instance Type: t2.micro
- Key Pair: Create and download
Network settings:
- Allow SSH (port 22)
- Allow HTTP (port 80)
Click Launch Instance
Step 2: Connect to the Instance (Linux Terminal)
Navigate to the folder where your key is downloaded and run:
chmod 400 your-key.pem
ssh -i your-key.pem ec2-user@your-public-ip
Step 3: Install Apache Web Server
Update packages and install Apache:
sudo yum update -y
sudo yum install httpd -y
Step 4: Start and Enable Apache
sudo systemctl start httpd
sudo systemctl enable httpd
Check status:
sudo systemctl status httpd
Step 5: Create a Simple Web Page
Replace the default page:
echo "Hello from EC2 Linux Web Server" | sudo tee /var/www/html/index.html
Step 6: Access from Browser
Open your browser and enter:
http://your-public-ip
You should see:
Hello from EC2 Linux Web Server
Step 7: Security Group Check
If the page does not load, verify:
Type: HTTP
Port: 80
Source: 0.0.0.0/0
Conclusion
You have successfully:
- Launched a Linux EC2 instance
- Installed Apache web server
- Deployed a basic web page
- Accessed it from the internet
This is the base for deploying real applications on cloud infrastructure


Top comments (0)