Deploying Your HTML Website to an Amazon EC2 Instance

#ec2#html#deployment#cloudskills

Hello everyone, and welcome to my blog! In today's article, we will explore how to deploy your HTML website to an Amazon EC2 instance and ensure it is working correctly. If you find the content useful, please consider liking, sharing, and subscribing to my blog. So let's dive right in!

Prerequisites:

Before we proceed, make sure you have the following:

An Amazon Web Services (AWS) account: If you don't have one, you can sign up here: https://aws.amazon.com.
Once
your account is set up, you're ready to go!

Deploying an EC2 Instance:

Follow these steps to deploy an EC2 instance:

Log in to your AWS account and access the AWS Management Console.

Image description

Locate the EC2 (Elastic Compute Cloud) service. If you can't find it, you can search for "EC2" in the search bar.

Image description

Click on "EC2 instances" to view your instances. If you don't have any instances yet, don't worry, we'll create one now.
Click on "Launch Instance" to start the instance creation process.

Give your instance a name, such as "My Instance for my blog."
Choose the operating system (OS) for your instance. You can select from various options like Amazon Linux, Ubuntu, or Windows, I selected Amazon Linux .
Select the one that suits your requirements.
Choose the instance type based on the required resources.
Configure additional settings like storage, security groups, and network settings. For now, we'll keep the default configurations.
Create or select an existing key pair to securely access your instance, i created a new key pair.
Review your settings and click "Launch Instance."

Image description

Image description

Installing and Configuring the Web Server:

Once your EC2 instance is launched, follow these steps to install and configure the web server:

Connect to your EC2 instance using EC2 instance connect or SSH.

Image description

Update the system by running the command: sudo yum update -y.
Install the Apache HTTP Server (httpd) by running the command: sudo yum install -y httpd.
Start the Apache server by running the command: sudo service httpd start.
Check the status of the server by running the command: sudo service httpd status. It should show "active."
Create a directory to store your website files by running the command: mkdir /var/www/html.
Move your website files to the appropriate folder by running the command: sudo mv /path/to/your/files/* /var/www/html/.

Image description

Go to security groups and edit inbound rules, add HTTP and HTTPS to allow anywhere and save, this allows you to define the permissions for incoming connections based on the source IP addresses, protocols, and ports.

Image description

Checking Your Deployed Website:

To ensure your website is deployed correctly, follow these steps:

Copy the public IP address of your EC2 instance.
Open a web browser and paste the IP address in the address bar.
If everything is set up correctly, you should see your website displayed in the browser.

Image description

Conclusion:
Congratulations! You have successfully deployed your HTML website to an Amazon EC2 instance. By following the steps outlined in this article, you can easily host your website and make it accessible to the world. If you have any questions or face any issues during the deployment process, feel free to leave a comment below. Thank you for reading, and happy website deployment!