High availability for EC2 instances (AWS)
This article has not been completed yet. However, it may already contain helpful information and therefore it has been published at this stage.
https://it-infrastructure.solutions/spinning-up-your-first-ec2-instance-aws/
Add the following "User data" commands ....
#!/bin/bash
yum install httpd -y
rm /var/www/html/index.html
touch /var/www/html/index.html
echo "<!DOCTYPE html>" > /var/www/html/index.html
echo "<html>" >> /var/www/html/index.html
echo "<title>" >> /var/www/html/index.html
echo "Page 1" >> /var/www/html/index.html
echo "</title>" >> /var/www/html/index.html
echo "Hello World!" >> /var/www/html/index.html
echo "</html>" >> /var/www/html/index.html
service httpd start
#!/bin/bash
yum install httpd -y
rm /var/www/html/index.html
touch /var/www/html/index.html
echo "<!DOCTYPE html>" > /var/www/html/index.html
echo "<html>" >> /var/www/html/index.html
echo "<title>" >> /var/www/html/index.html
echo "Page 2" >> /var/www/html/index.html
echo "</title>" >> /var/www/html/index.html
echo "Hello World!" >> /var/www/html/index.html
echo "</html>" >> /var/www/html/index.html
service httpd start
#!/bin/bash
yum install httpd -y
rm /var/www/html/index.html
touch /var/www/html/index.html
echo "<!DOCTYPE html>" > /var/www/html/index.html
echo "<html>" >> /var/www/html/index.html
echo "<title>" >> /var/www/html/index.html
echo "Page 3" >> /var/www/html/index.html
echo "</title>" >> /var/www/html/index.html
echo "Hello World!" >> /var/www/html/index.html
echo "</html>" >> /var/www/html/index.html
service httpd start
Result:
Refresh the page to see the result from the beginning...