Refer to this guide to learn how to create an EC2 instance\ <https://scribehow.com/shared/AWS__Creating_your_first_EC2_Instance__Xcu7ZVCdRfWx56YVktKgbQ> Refer to this guide to learn how to connect to an EC2 instance<https://scribehow.com/shared/How_to_Connect_to_an_AWS_EC2_Instance__czXjLrH1R1yAIXika6fGbA>
Log in to the **EC2 Linux instance** by connecting through AWS default **EC2 instance connect**
Use **sudo** to switch from **ec2-user** to root for administrative tasks on EC2 Instance to mitigate the risk of unintended alterations affecting system stability or security.
Type [[sudo su]] to switch from **ec2-user** to root; followed by pressing Enter \ After sudo-ing to the root user trigger the **[[yum update]]** command to install any pending updates
Execute the [[yum install httpd]] command to install the httpd web server on the **Linux Instance**
After executing [[yum install httpd]]; the system will ask for the installation confirmation. Press "**y**" followed by an Enter to confirm the web server installation **Note:** To avoid asking for user confirmation you can execute the alternative command -[[ yum install httpd -y]]
Use this command [[echo "It works" > /var/www/html/index.html ]]to create the HTML file
Start the web server by executing [[systemctl start httpd]]and then enable it to start automatically on every boot by executing[[systemctl enable httpd]]
Return to the Instances page in the Console Select the instance named - **First EC2 Instance** to view its details.
Scroll to the Instance overview section and click on the **Security** tab to access the EC2 instance security settings
**What is a security group?** A security group acts as a virtual firewall controlling inbound and outbound traffic for an AWS EC2 instance.
Update the security groups by clicking on the security groups **launch-wizard-1** link
On the security group page scroll to the **Inbound rules** section and click on the "**Edit inbound rules**" button
Click on the "**Add rule**" button and add a new rule by selecting "**HTTP**" in the Type dropdown
Select "**Anywhere-IPv4**" from the Source dropdown to allow incoming traffic from any ipv4 address
Click on the **Save rules** button
The Inbound rules in the Security group are successfully modified to allow incoming **HTTP** traffic
On the same page click on the **Instances** in the left bar to view the created instance
Select the instance named - **First EC2 Instance** to view its details
Scroll to the Instance overview section and copy the Public IPv4 address