EC2 LAUNCHING
EC2
Step 1: Launch EC2 Instance
Go to: AWS Console --> EC2 --> Launch Instance
Configure:
-
Name:
my-web-server - AMI: Amazon Linux 2 (easy for beginners)
-
Instance Type:
t2.micro(free tier)
Step 2: Key Pair
- Create or select a key pair.
Step 3: Network Settings
Allow these:
- SSH (port 22) --> for login
- HTTP (port 80) --> for web access
Step 4: Launch Instance
Click Launch Instance
Step 5: Connect to Instance
Use:
- EC2 --> Connect --> EC2 Instance Connect (easiest)
OR via terminal:
with this command.
for this you have to download the pem files while selecting the key pair.
ssh -i your-key.pem ec2-user@<public-ip>
Step 6: Install Web Server
For Amazon Linux:
sudo yum update -y
sudo yum install httpd -y
Step 7: Start Web Server
sudo systemctl start httpd
sudo systemctl enable httpd
Step 8: Add a Web Page
echo "Hello from EC2" | sudo tee /var/www/html/index.html
Step 9: Get Public IP
Go to EC2 dashboard --> copy:
Step 10: Access from Browser
Open:
http://<your-public-ip>
You should see:
Hello from EC2
Comments
Post a Comment