How to Launch a Simple Website on AWS EC2: A Step-by-Step Guide

I recently took the plunge into cloud computing and decided to host a simple website on an AWS EC2 instance. I wanted to share the step-by-step process I followed, along with some insights and learnings. Whether you’re new to AWS or looking to solidify…


This content originally appeared on DEV Community and was authored by Usama Bhatti

I recently took the plunge into cloud computing and decided to host a simple website on an AWS EC2 instance. I wanted to share the step-by-step process I followed, along with some insights and learnings. Whether you're new to AWS or looking to solidify your cloud skills, this guide will help you get started with EC2.

Also, I’m excited to announce that this is the first of many posts to come! I’ll be regularly sharing my tech journey and projects, so stay tuned!

Step 1: Launching an EC2 Instance

Image description

  1. Log in to AWS Management Console: Head over to AWS Management Console.
  2. Navigate to EC2: Find EC2 under the Compute category in the Services menu.
  3. Launch Instance: Click the "Launch Instance" button.
  4. Choose an Amazon Machine Image (AMI): Select the Amazon Linux 2 AMI (free tier eligible).
  5. Choose an Instance Type: Go with t2.micro (free tier eligible).
  6. Configure Instance: Proceed with the default settings.
  7. Add Storage: Use default storage settings.
  8. Add Tags: Optionally, add tags for easier identification.
  9. Configure Security Group:
    • Create a new security group.
    • Add a rule to allow HTTP traffic: Type: HTTP, Protocol: TCP, Port Range: 80, Source: Anywhere (0.0.0.0/0).
    • Add a rule to allow SSH traffic: Type: SSH, Protocol: TCP, Port Range: 22, Source: My IP.
  10. Review and Launch: Review the settings and click "Launch".
  11. Key Pair: Create a new key pair, download it, and store it securely.
  12. Launch: Click "Launch Instances".

Image description

Step 2: Connecting to Your EC2 Instance

  • Open Terminal/Command Prompt on your local machine.
  • Change Permissions: Ensure your key pair file has the correct permissions

command: chmod 400 /path/to/your-key-pair.pem

-Connect to Instance:

command: ssh -i /path/to/your-key-pair.pem ec2-user@your-ec2-public-ip

Or you can either use Putty Tool to securely SSH into your instance with using the key pair that you download while creating the Ec2 Instance.

Image description

Step 3: Setting Up a Web Server

Image description

Update Packages:
sudo yum update -y
Install Apache Web Server:
sudo yum install -y httpd
Start Apache:
sudo systemctl start httpd
sudo systemctl enable httpd

Verify Apache: Open your browser and navigate to your EC2 instance's public IP address to see the Apache test page.

Step 4: Hosting Your Website

Create a Simple HTML File:
echo "

This is a Static Website hosted on EC2 Instance!!!

" > /var/www/html/index.html

Image description

Conclusion

This project was a fantastic introduction to AWS EC2. Here are some key takeaways:

  • Instance Management: Learned how to launch and manage an EC2 instance.
  • Security Groups: Gained insights into configuring security groups for HTTP and SSH access.
  • Web Server Setup: Successfully installed and configured an Apache web server on a Linux instance.

I'm excited to continue sharing my tech journey and projects with you all. Stay tuned for more posts coming soon!

Feel free to reach out if you have any questions or need further clarification. Happy cloud computing! 🌥️


This content originally appeared on DEV Community and was authored by Usama Bhatti


Print Share Comment Cite Upload Translate Updates
APA

Usama Bhatti | Sciencx (2024-07-24T16:48:40+00:00) How to Launch a Simple Website on AWS EC2: A Step-by-Step Guide. Retrieved from https://www.scien.cx/2024/07/24/how-to-launch-a-simple-website-on-aws-ec2-a-step-by-step-guide/

MLA
" » How to Launch a Simple Website on AWS EC2: A Step-by-Step Guide." Usama Bhatti | Sciencx - Wednesday July 24, 2024, https://www.scien.cx/2024/07/24/how-to-launch-a-simple-website-on-aws-ec2-a-step-by-step-guide/
HARVARD
Usama Bhatti | Sciencx Wednesday July 24, 2024 » How to Launch a Simple Website on AWS EC2: A Step-by-Step Guide., viewed ,<https://www.scien.cx/2024/07/24/how-to-launch-a-simple-website-on-aws-ec2-a-step-by-step-guide/>
VANCOUVER
Usama Bhatti | Sciencx - » How to Launch a Simple Website on AWS EC2: A Step-by-Step Guide. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/07/24/how-to-launch-a-simple-website-on-aws-ec2-a-step-by-step-guide/
CHICAGO
" » How to Launch a Simple Website on AWS EC2: A Step-by-Step Guide." Usama Bhatti | Sciencx - Accessed . https://www.scien.cx/2024/07/24/how-to-launch-a-simple-website-on-aws-ec2-a-step-by-step-guide/
IEEE
" » How to Launch a Simple Website on AWS EC2: A Step-by-Step Guide." Usama Bhatti | Sciencx [Online]. Available: https://www.scien.cx/2024/07/24/how-to-launch-a-simple-website-on-aws-ec2-a-step-by-step-guide/. [Accessed: ]
rf:citation
» How to Launch a Simple Website on AWS EC2: A Step-by-Step Guide | Usama Bhatti | Sciencx | https://www.scien.cx/2024/07/24/how-to-launch-a-simple-website-on-aws-ec2-a-step-by-step-guide/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.