Deploying application to AWS EC2.
Hello! I'm a student passionate about becoming a Cloud and DevOps Engineer. I have a solid foundation in AWS Cloud, Linux, Docker, and Kubernetes.
Deploying a Static Website on Apache Web Server.
Launch an EC2 instance: Amazon EC2 is a compute service that aws provides.
Create an account with aws, and sign in into your console.
go into EC2 Dashboard and Click launch instance.

Give a name to your instance, for example, "Apache-Web-Server," and select Amazon Linux AMI (Amazon Machine Image). An AMI contains information to launch an instance, such as the OS, software, configuration files, etc.
Key pair (login): Select "Create new key pair," and give a name to your key. A key pair is a credential used to log into a remote server. Give it a name like "web-server-key," select the applicable file format, and create the key pair.

Network settings: Let all be default, but in the security group, select Create security group. Tick "Allow SSH traffic from" and select Anywhere 0.0.0.0/0 and "Allow HTTP traffic from the internet".
SSH traffic: This rule will allow you to access your instance remotely.
HTTP traffic: This rule will allow incoming HTTP requests.

click on "Launch instance".
Log in to your Server: Once the server is launched and ready, log in to your server using any SSH client.
Or open your terminal and typessh -i "web-server-key.pem" ec2-user@Public_IPUse the public IP of your instance.
Now you are logged in to your server.
Install Apache Web Server: After launching the instance, install and configure the web server.
Type the command
sudo yum updateand thensudo yum install httpd -y. This will install the Apache web server on your server.Start Web Server: The web server is installed, but if you type the public IP address of your instance, you will see an error: "This site can’t be reached." This happens because the web server is not active or running.
Check the status of the web server with:
sudo systemctl status httpdStart and enable the web server with:
sudo systemctl start httpd sudo systemctl enable httpd
Add Index.html file: Add the index.html page of your website.
Go to thecd /var/www/htmldirectory, create an index.html file, and add your content there.- Access your website by typing the public IP or Public IPv4 DNS of your EC2 instance in the URL.

Things to Consider: By default, HTTP requests listen on port 80. However, if your web server is listening on a different port, such as port 3000, you need to allow port 3000 in the security group attached to your instance. To access the website from the internet, type public_IP:3000.
Thank you for reading. Feel free to leave comments or questions if you encounter any issues or need further clarification.



