How to Host a WordPress Website on AWS Free Tier: A Step-by-Step Guide

Introduction

Hosting a WordPress website on AWS (Amazon Web Services) is a cost-effective way to get your site online, especially with the AWS Free Tier, which offers 12 months of free services. In this guide, we’ll walk you through the entire process—from setting up an AWS account to launching your WordPress site—without any technical hiccups.

Why Host WordPress on AWS Free Tier?

✅ Free Tier Available – Get 12 months of free hosting (with limits).
✅ Scalable & Reliable – AWS ensures high uptime and performance.
✅ Full Control – Manage server settings as per your needs.

Step 1: Sign Up for AWS Free Tier

  1. Go to AWS Free Tier and click “Create a Free Account.”

  2. Fill in your details and verify your email/phone.

  3. Enter payment info (AWS won’t charge you unless you exceed free limits).

Step 2: Launch an EC2 Instance for WordPress (Free Tier Eligible)

  1. Log in to your AWS Management Console.

  2. Search for EC2 in the services menu and open it.

  3. Click “Launch Instance” to create a virtual server.

Configure Your EC2 Instance

  • Name: Give your instance a name (e.g., MyWordPressSite).

  • AMI (Amazon Machine Image): Select Ubuntu Server (Free Tier Eligible).

  • Instance Type: Choose t2.micro (Free Tier Eligible).

  • Key Pair: Create a new key pair (download the .pem file securely).

  • Network Settings:

    • Allow HTTP (Port 80) and HTTPS (Port 443) traffic.

    • Enable SSH (Port 22) if you need manual access.

  • Click “Launch Instance.”

Step 3: Connect to Your EC2 Instance via SSH

  1. Open Terminal (Mac/Linux) or PuTTY (Windows).

  2. Navigate to the folder containing your .pem key file.

  3. Run:

     
    your-key-file.pem  
    ssh -i "your-key-file.pem" ubuntu@your-ec2-public-ip  

    (Replace your-ec2-public-ip with your instance’s public IP from AWS EC2 dashboard.)

Step 3: Install LAMP Stack for WordPress (Linux, Apache, MySQL, PHP)

Run these commands one by one:

1. Update Ubuntu Packages

sudo apt update && sudo apt upgrade -y  

2. Install Apache Web Server

sudo apt install apache2 -y  

Check if Apache is running by visiting your EC2 Public IP in a browser.

3. Install MySQL Database

sudo apt install mysql-server -y  

Secure MySQL:

sudo mysql_secure_installation  

(Set a root password and follow security prompts.)

4. Install PHP

sudo apt install php libapache2-mod-php php-mysql -y  

Verify PHP:

php -v  

Step 4: Install & Configure WordPress on AWS

1. Download WordPress

cd /tmp && wget https://wordpress.org/latest.tar.gz  
tar -xzvf latest.tar.gz  
sudo mv wordpress /var/www/html/  

2. Configure WordPress Database

Log in to MySQL:

sudo mysql -u root -p  

Run these SQL commands:

sql
CREATE DATABASE wordpress;  
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'yourpassword';  
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';  
FLUSH PRIVILEGES;  
EXIT;  

3. Set Up WordPress Config

cd /var/www/html/wordpress  
sudo cp wp-config-sample.php wp-config.php  
sudo nano wp-config.php  

Update these lines with your database details:

php
define('DB_NAME', 'wordpress');  
define('DB_USER', 'wpuser');  
define('DB_PASSWORD', 'yourpassword');  

Save (Ctrl+X, then Y, then Enter).

4. Set Permissions

sudo chown -R www-data:www-data /var/www/html/wordpress  
sudo systemctl restart apache2

Step 6: Complete WordPress Installation

  1. Open your browser and go to:

     
     
    http://your-ec2-public-ip/wordpress  
  2. Follow the WordPress setup wizard (choose language, admin credentials, etc.).

Step 7: Assign a Domain (Optional)

  1. Buy a domain from Route 53 or any registrar.

  2. Point your domain to the EC2 instance’s Public IP.

  3. Update Apache config to recognize the domain.

Final Tips for AWS Free Tier Users

🔹 Monitor Usage – Stay within Free Tier limits to avoid charges.
🔹 Enable Backups – Use AWS Snapshots for data safety.
🔹 Optimize Performance – Install caching plugins like WP Rocket.

Conclusion

Hosting WordPress on AWS Free Tier is a powerful, budget-friendly solution. By following this guide, you’ve successfully deployed a WordPress site on AWS without errors.

🚀 Next Steps:

  • Secure your site with an SSL certificate (Let’s Encrypt).

  • Optimize WordPress for speed and SEO.

Got questions? Drop them in the comments!

Scroll to Top