EC2 is a virtual server provided by AWS
It allows you to run applications on the cloud
Steps to create EC2 instance
Step 1
Login to AWS console
Step 2
Go to EC2 dashboard
Step 3
Click Launch Instance
Step 4
Choose an OS like Amazon Linux
Step 5
Select instance type like t2 micro
Step 6
Create or select a key pair
Step 7
Allow HTTP and SSH in security group
Step 8
Launch the instance
Running a web server on an EC2 instance involves connecting to the instance using SSH and installing a web server like Apache
First update the system using sudo yum update -y
Then install the server using sudo yum install httpd -y
After installation start the service using sudo systemctl start httpd
Enable it to run on boot using sudo systemctl enable httpd
Create a simple page by adding content
If the security group allows HTTP traffic you can access the web server using the public IP of the instance in a browser
To access from outside
Copy the public IP of the instance
Open browser and enter
http://your-public-ip
You will see the web page
Make sure port 80 is open in security group
Without this the page will not load
Top comments (0)