Table of contents
Problem Statement
Host A Static Website on EC2
Create an EC2 Machine with OS as Linux Amazon Linux 2
After Creating the instance Install the Apache Server and start the Apache service also make it a startup service so it can automatically start at the startup
Now change the Content of
index.html
in directoryvar/www/html/
toHello World
Solutions
Launch an EC2 instance by login into your AWS Account we are using Amazon Linux 2
Create a new key pair to connect to your instance.
Allow HTTP Traffic for your instance by enabling the checkbox.
Note: - Without HTTP Access your website is not accessible globally.
Now Connect to your Instance.
Now the most important steps.
Install the Apache Server By using Below Command
yum install –y httpd
Now start the Apache service by using below command
systemctl start httpd
Now to run Apache Service automatically at startup use the below command
systemctl enable httpd
Now to put your html code to the file use below command
echo “<h1>Hello World</h1>” /var/www/html/index.html
Now Access your website with the public IPV4 address.