AWS WAF
Last updated
Last updated
#!/bin/bash
# Update the package repository and install Apache2
apt-get update -y
apt-get install apache2 -y
# Start Apache2 service and enable it on boot
systemctl start apache2
systemctl enable apache2
# Create a custom HTML page with hostname and IP address
echo "<html><body><h1>Hostname: $(hostname)</h1><h1>IP Address: $(curl -s http://169.254.169.254/latest/meta-data/public-ipv4)</h1></body></html>" > /var/www/html/index.html
# Set permissions to ensure Apache can serve the file
chmod 644 /var/www/html/index.html