Launch Your Own Server on the Internet with AWS EC2

saumya singhsaumya singh
3 min read

In today’s digital world, being able to launch your own server on the internet is an essential skill for developers, cloud enthusiasts, and IT professionals. Thanks to AWS EC2 (Elastic Compute Cloud), it’s easier than ever to spin up a server in minutes and make it publicly accessible to anyone across the globe.

In this guide, we’ll go step-by-step on how to:

  1. Set up an EC2 instance.

  2. Install a basic web server.

  3. Access it using the public IP address.

By the end, you’ll have your own mini-server live on the internet—ready to host websites, applications, or testing environments.


Step 1: Understanding EC2

Amazon EC2 is a cloud-based virtual server that you can configure as per your requirements. Instead of buying physical hardware, you rent virtual computing power from AWS, which you can scale up or down as needed.

Some key benefits of EC2:

  • On-demand resources—pay only for what you use.

  • Flexibility to choose OS, storage, CPU, and memory.

  • Accessibility from anywhere via the internet.


Step 2: Launching an EC2 Instance

  1. Sign in to AWS Management Console
    Go to AWS Console and search for EC2 in the services menu.

  2. Click on “Launch Instance”
    Give your instance a name (e.g., My-Web-Server).

  3. Choose an Amazon Machine Image (AMI)
    Select Amazon Linux 2 or Ubuntu for a lightweight and reliable OS.

  4. Choose an Instance Type
    For testing or small projects, choose t2.micro (free tier eligible).

  5. Configure Key Pair
    Create a new key pair (or use an existing one). This .pem file is your password to access the server.

  6. Security Group (Firewall Settings)

    • Add HTTP (port 80) to allow web traffic.

    • Add SSH (port 22) for remote login.

  7. Launch the Instance
    AWS will take a few seconds to provision your virtual server.


Step 3: Connecting to Your EC2 Server

Once the instance is running, click on it to see details like Public IPv4 address.

  • Open your terminal (or use PuTTY on Windows) and connect:

      ssh -i your-key.pem ec2-user@your-public-ip
    

    (Replace your-key.pem with your actual key file and your-public-ip with the IP from the EC2 console.)


Step 4: Installing a Web Server

Let’s make this server display a basic webpage.

For Amazon Linux:

sudo yum update -y
sudo yum install httpd -y
sudo systemctl start httpd
sudo systemctl enable httpd

For Ubuntu:

sudo apt update
sudo apt install apache2 -y
sudo systemctl start apache2
sudo systemctl enable apache2

Step 5: Creating Your Homepage

Create a basic HTML page:

echo "<h1>Hello from My EC2 Server!</h1>" | sudo tee /var/www/html/index.html

Step 6: Accessing Your Server on the Internet

  • Go back to the EC2 console and copy the Public IPv4 address.

  • Paste it into your browser:

      http://<your-public-ip>
    
  • If you’ve configured everything correctly, you’ll see your "Hello from My EC2 Server!" message live.


Step 7: Keeping Your Server Secure

While it’s exciting to have your server live, you should also:

  • Keep software updated (sudo yum update -y or sudo apt update && sudo apt upgrade -y).

  • Use strong SSH keys and disable password logins.

  • Only open necessary ports in the Security Group.


Conclusion

You’ve just set up your own internet-accessible server using AWS EC2! 🎉
With this knowledge, you can host websites, test applications, run APIs, or even build full-stack environments. The best part? AWS EC2 is pay-as-you-go, so you can start small and scale as needed.

So, what’s next? Try installing Nginx, deploying a Node.js app, or setting up a WordPress blog—all from your very own cloud server.



10
Subscribe to my newsletter

Read articles from saumya singh directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

saumya singh
saumya singh

Welcome to my corner of the cloud, where ideas scale faster than servers and downtime is not an option! Here, I write about everything from spinning up VPCs to tearing down myths about the cloud. Whether you’re an engineer, a curious learner, or someone who just likes seeing words like 'serverless' and 'auto-scaling,' you’re in the right place. Consider this blog your high-availability zone for tips, tutorials, and tech thoughts—delivered with 99.99% uptime .