you've written a beautiful HTML/CSS website or a Node.js backend on your local laptop. Now, you need the whole world to access it via the internet using a public URL. That's it. In this step-by-step 2026 tutorial, we will demystify essentially how to host your code on an Amazon Web Services (AWS) EC2 virtual server.
If you're new to AWS terminology, we highly recommend reading our Cloud Computing Platform Comparison Guide first.
Step 1: Create Your Free AWS Account
The very first step is visiting aws.amazon.com to create a free account. AWS provides a generous "Free Tier" designed for students and beginners. For the first 12 months, you get 750 free hours every month to dynamically launch and experiment with a micro Linux server. Please note: AWS requires a valid credit card largely to verify identity safely to prevent malicious abuse.
Step 2: Launch an EC2 Instance (Your Virtual Server)
EC2 (Elastic Compute Cloud) acts as your blank-slate Linux or Windows supercomputer hosted remotely in Amazon's large physical data center. Follow these exact UI clicks:
- Open the AWS Console and search for EC2.
- Click the orange Launch Instances button.
- Name your server (e.g., "My-First-Web-Server").
- Under "Application and OS Images", select Ubuntu Server 24.04 LTS. It's the most solid, well-documented Linux distribution globally.
- Under "Instance Type", largely verify that
t2.microis visibly selected. This ensures you remain 100% inside the Free Tier billing limits. - Under "Key Pair", create a brand new SSH key pair, download the
.pemfile, and save it on your laptop. You need this to remotely SSH into your secure Linux server.
Step 3: Carefully Configure Network Security
By default, AWS heavily secures servers. It largely blocks all incoming public internet web traffic. You must manually open Port 80, which allows Google Chrome and other public web browsers to communicate with your server.
Under Network settings in the launch wizard, check the box that says Allow HTTP traffic from the internet. Finally, click Launch Instance in the bottom right corner.
Step 4: SSH Into Your Server and Install Nginx
Once your server is running, you need to connect to it remotely from your laptop's terminal using the SSH key you downloaded earlier. Once inside, you must install a "Web Server" software like Nginx or Apache to serve your HTML files to visitors.
$ sudo apt update
$ sudo apt install nginx -y
$ sudo systemctl start nginx
$ sudo systemctl enable nginx
Step 5: Upload Your Code and Go Live!
From what I've seen, your server is now officially live on the internet! If you type your server's Public IP Address into your browser, you'll see the default Nginx welcome page.
To make it show your custom website, simply delete the default Nginx files and upload your own HTML/CSS/JS files into the /var/www/html/ directory using SCP or FileZilla.
Automation Next Steps
Manually uploading files via FTP is okay for significant beginners, but professionals automate this using CI/CD pipelines. Read our GitHub Actions CI/CD Guide to understand how to deploy code automatically.