Patching
- we need patch 50 server –> login , terraminal euning scrpit
- to avoid manaual process cloud provides automatic patching
Aws SSM Run Command
- we can same scrpit at once for all servers
#!/bin/bash
# ==========================================
# Install Nginx and Deploy Sample Website
# Operating System: Ubuntu
# ==========================================
set -e
echo "Starting Nginx installation..."
# Check root privileges
if [ "$EUID" -ne 0 ]; then
echo "Please execute using sudo"
exit 1
fi
# Update Ubuntu packages
apt-get update -y
# Install Nginx
apt-get install nginx -y
# Create website directory
WEB_ROOT="/var/www/html"
mkdir -p "$WEB_ROOT"
# Deploy sample HTML website
cat > "$WEB_ROOT/index.html" <<'EOF'
<!DOCTYPE html>
<html>
<head>
<title>DevOps Nginx Website</title>
<style>
body {
background-color: #f0f8ff;
font-family: Arial, sans-serif;
text-align: center;
padding: 100px;
}
h1 {
color: green;
}
</style>
</head>
<body>
<h1>Welcome to Nginx Web Server!</h1>
<h2>Ubuntu Linux - DevOps Website</h2>
<p>Nginx installed successfully.</p>
<p>Website deployed using Shell Script.</p>
</body>
</html>
EOF
# Set permissions
chown -R www-data:www-data "$WEB_ROOT"
chmod -R 755 "$WEB_ROOT"
# Enable and start Nginx
systemctl enable nginx
systemctl restart nginx
# Verify Nginx service
echo "Checking Nginx status..."
systemctl status nginx --no-pager
# Test website
echo "Testing website..."
curl -I http://localhost
echo "=========================================="
echo " Nginx Installation Completed!"
echo " Website Deployment Completed!"
echo "=========================================="
echo "Website Directory: $WEB_ROOT"
echo "Access URL: http://SERVER-PUBLIC-IP"
Aws SSM Patch Manager
follow below steps to perform
Choose "Create" to create a patch policy with the following configuration:
Patch policy name: Ubuntu-Patch-Policy-2026
Scan for missing patches daily at 1:00 AM UTC
Install missing patches weekly at 2:00 AM UTC on Sunday
Update nodes based on default patch baselines
Store patch operation logs in s3://qt-demo-s3-497650754350-us-east-1-an
Target: Current account
Regions: us-east-1
Nodes: i-05e87bc763d9339a7
The number or percentage of nodes to run the patch policy on at the same time: 10%
The number or percentage of nodes to permit errors on before the patch policy fails: 2%
Deploy IAM roles required for instance management and patching using Systems Manager
Task
- create 2 ec2 instance and attach IAM ssm role
- Try run above script using RUN command
- create policy to do auto patching linux vm
- create policy for windows patching
Next
- fix windows install apache2
- azure update manager