Create an Amazon Linux Server and go to the advanced setting.
Paste the below code in User Data while creating the Linux Server
===============================================================

It will install Apache server and an index.html will be created.
Put the server IP address in the browser, you will find the server is up and running and the index.html file will be accessible.

#!/bin/bash
sudo su
yum update -y
yum install -y httpd.x86_64
systemctl start httpd.service
systemctl enable httpd.service
echo “Hello World from anshul $(hostname -f)” > /var/www/html/index.html

Optionally: You can use this Code to create index.html at this location /var/www/html/index.html
—————————————————————————————————————

<!DOCTYPE html>
<html>
<head>
<style>
.a{
background-color: #2471A3;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
float: center;
}
.bg {
/* The image used */
background-image: url(“https://bit.ly/2OEVTYp”);
/* Full height */
height: 100%;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.label {
color: white;
padding: 8px;
font-family: Arial; }
}
</style>
</head>
<body class=”bg” style=”padding: 210px 0; background-color: #dbfcf9;”>
<center>
<h3><font size=”24″> <font color=”white”> Apache Server Demo By Pushpjeet Cholkar </font></h3></body>
</html>