Step 1: Launch an EC2 Instance
1.1. Log in to the AWS Management Console.
1.2. Navigate to EC2 Dashboard → Launch Instance.
1.3. Choose an Amazon Machine Image (AMI), e.g., Amazon Linux 2.
1.4. Select an instance type (e.g., t2.micro for free tier).
1.5. Configure instance details and add storage (default is fine).
1.6. Configure Security Group:
1.6.1. Allow SSH (port 22) from your IP.
1.6.2. Allow HTTP (port 80) from anywhere (0.0.0.0/0).
Step 2: Connect to Your Instance
2.1. Open terminal.
2.2. Run:
2.2.1. ssh -i your-key.pem ec2-user@
2.3. Replace with the instance’s public IP from the EC2 dashboard.
Step 3: Install a Webserver
3.1. Update packages:
sudo yum update -y
Install Apache (httpd):
sudo yum install -y httpd
3.2. Start the service:
sudo systemctl start httpd
sudo systemctl enable httpd
Step 4: Deploy a Simple Webpage
4.1. Navigate to the web root:
cd /var/www/html
4.2. Create an index.html file:
echo "
Hello from EC2 Webserver!
" | sudo tee index.htmlStep 5: Access from Outside
5.1. Copy the Public IPv4 address of your EC2 instance.
5.2. Open a browser and enter:
http://
5.3. You should see your custom webpage.
Top comments (0)