You have written a beautiful HTML/CSS website or a Node.js backend on your local laptop. Now, you need the entire world to securely access it via the internet using a public URL. In this step-by-step 2026 tutorial, we will completely demystify exactly how to host your code seamlessly on an Amazon Web Services (AWS) EC2 virtual server.
If you are entirely 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 completely free account. AWS provides a generous "Free Tier" perfectly 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 strictly to verify identity safely to prevent malicious abuse.
Step 2: Launch an EC2 Instance (Your Virtual Server)
EC2 (Elastic Compute Cloud) securely acts as your blank-slate Linux or Windows supercomputer hosted entirely remotely in Amazon's massive 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 is the most robust, well-documented Linux distribution globally.
- Under "Instance Type", strictly verify that
t2.microis visibly selected. This guarantees you remain 100% inside the Free Tier billing limits. - Under "Key Pair", actively create a brand new SSH key pair, download the
.pemfile, and securely save it on your laptop. You need this explicitly to remotely SSH into your secure Linux server.
Step 3: Carefully Configure Network Security
By default, AWS heavily secures servers. It strictly blocks absolutely 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!
Your server is now officially live on the internet! If you type your server's Public IP Address into your browser, you will see the default Nginx welcome page.
To make it show your custom website, simply delete the default Nginx files and securely 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 absolute beginners, but professionals automate this using CI/CD pipelines. Read our GitHub Actions CI/CD Guide to understand how to deploy code automatically.