DEV Community

Samson Yekini
Samson Yekini

Posted on

Deploying a Linux EC2 Instance

Log into AWS Console

Navigate to EC2 → Instances → Launch Instance

Configure:

Name: ApacheServer

AMI: Amazon Linux 2 or Ubuntu

Instance Type: t2.micro (Free Tier eligible)

Key Pair: Create or select an existing key pair

Image description

go to network setting
Security Group:

Allow SSH (port 22) from your IP.

Allow HTTP (port 80) from anywhere (0.0.0.0/0)
Image description

Connect to the Instance
Using SSH:
chmod 400 your-key.pem
ssh -i "your-key.pem" ec2-user@
ssh -i your-key.pem ec2-user@your-instance-public-ip

Install Apache Web Serve

For Amazon Linux 2:

sudo yum update -y
sudo yum install -y httpd

For Ubuntu:

sudo apt update
sudo apt install -y apache2

Start and Enable Apache

sudo systemctl start httpd
sudo systemctl enable httpd

Create a Custom index.html
Image description

Test Your Website
In your browser, go to:
http://your-ec2-public-ip
Image description

write a custom message in html
Image description

Edit with any words
Image description

Testing my Url i.e my ip address http://...
Image description

Top comments (0)