DEPLOYING A
WEB SERVER
ON AWS EC2
Nandhakumar P
HANDS-ON LAB EXERCISE 01
Business Scenario
Company: TechStart Solutions
Requirement:
The development team needs a quick-deploy web server environment for testing their
latest web application. They need a solution that can be easily replicated across
different environments and teams
Lab Overview
Launch an Amazon EC2 instance
Configure security groups for web traffic
Connect to the instance using EC2 Instance Connect
Install and configure Apache web server
Verify the web application deployment
DEPLOYING A WEB SERVER ON AWS EC2
Access AWS Management Console
Navigate to https://console.aws.amazon.com
Sign in with your AWS credentials
Select your desired AWS region (e.g., us-east-1)
Navigate to EC2 Dashboard
Click on "Services" at the top
Select "EC2" under Compute section
Click "Launch Instance" button
DEPLOYING A WEB SERVER ON AWS EC2
Configure Instance Details
Name: webserver-dev
Application and OS Images:
Select "Amazon Linux 2023"
AMI: Amazon Linux 2023 AMI (HVM)
Architecture: 64-bit (x86)
Instance Type Selection
Choose "t2.micro" (Free tier eligible)
This is suitable for development/testing web servers
DEPLOYING A WEB SERVER ON AWS EC2
Key Pair Configuration
Select "Create new key pair"
Name: webserver-key
Key pair type: RSA
Format: .pem
Click "Create key pair"
The key will automatically download - store it securely
Network Settings
VPC: Default VPC
Auto-assign Public IP: Enable
Create security group with following rules:
Name: webserver-sg
Description: Security group for web server
Inbound Rules:
HTTP (Port 80) from Anywhere (0.0.0.0/0)
SSH (Port 22) from Anywhere (0.0.0.0/0) [Note: In production, restrict to specific IPs]
DEPLOYING A WEB SERVER ON AWS EC2
Configure Storage
volume Size: 8 GB gp3
Delete on Termination: Yes
Launch Instance
Review all configurations
Click "Launch Instance"
Wait for instance to reach "Running" state (2-3 minutes)
DEPLOYING A WEB SERVER ON AWS EC2
Access Instance Connect
Select your instance from EC2 dashboard
Click "Connect" button
Choose "EC2 Instance Connect" tab
Click "Connect"
Verify Connection
# Check system status by executing command in CLI
whoami
pwd
DEPLOYING A WEB SERVER ON AWS EC2
Installing and Configuring Web Server (Execute this commands in WEB CLI)
Update System Packages
sudo yum update -y
Install Apache Web Server
sudo yum install -y httpd
Start and Enable Apache Service
sudo systemctl start httpd
sudo systemctl enable httpd
Verify Apache Status
sudo systemctl status httpd
Create Sample Web Page
sudo bash -c 'echo "<html><body><h1>Welcome to TechStart Solutions Development
Server</h1><p>Server successfully deployed!</p></body></html>" >
/var/www/html/index.html'
DEPLOYING A WEB SERVER ON AWS EC2
Testing the Web Server
Get Public IP
Return to EC2 Console
Select your instance
Copy the Public IPv4 address
Access Web Server
Open a new browser tab
Paste the Public IPv4 address
You should see the welcome message
DEPLOYING A WEB SERVER ON AWS EC2
Verification Checklist
□ Instance is running
□ Security group has HTTP and SSH rules
□ Can connect via Instance Connect
□ Apache service is running
□ Web page is accessible via public IP
Clean Up Instructions to avoid unnecessary charges:
Select the instance
Click "Instance state"
Choose "Terminate instance"
Confirm termination
THANK YOU