📝Launch Your Own WordPress on AWS EC2 – No Cost, No Coding


Are you a student, beginner, or curious techie who wants to host your blog or site using WordPress — but without spending a dime?
In this guide, I’ll walk you through how I successfully deployed WordPress on AWS Free Tier using Amazon EC2 and manual installation — no fancy pre-built images, just full hands-on experience.
🎯 What You’ll Be Doing
We’ll:
Use Amazon EC2 (Free Tier) as the server
Manually install and configure Apache, PHP, and MariaDB
Deploy WordPress to serve your site
Set up your database and WordPress configuration
đź§± Requirements
An AWS account (Free Tier enabled)
Basic familiarity with web browsing and copy-pasting commands
No previous Linux or cloud experience required — I’ve got you covered
🚀 Step-by-Step WordPress Deployment
âś… Step 1: Set Up Your AWS EC2 Instance
Click on this link, “WordPress stack deployment”.
Log in to the AWS Console.
Click on “I Acknowledge AWS CloudFormation,” then click on “Create Stack.”
In the top search bar, type “EC2” and select the EC2 service.
On the left sidebar, click Instances.
Under Instance state, confirm it says
Running
.Click Connect, then select the EC2 Instance Connect tab.
Click the “Connect” button to open the terminal.
You’ll land in a terminal running Amazon Linux 2023, and now the real work begins!
âś… Step 2: Set Up WordPress Environment Variables
In the terminal, copy and paste these lines:
DBName='a4lwordpress'
DBUser='a4lwordpress'
DBPassword='4n1m4l$4L1f3'
DBRootPassword='4n1m4l$4L1f3'
These are the credentials your WordPress will use to talk to the database. You can change them to your names and passwords.
To confirm they're saved, type:
echo $DBName
echo $DBPassword
âś… Step 3: Install Apache, MariaDB, and PHP
Let’s install the packages needed to run a WordPress server:
sudo dnf install wget php-mysqlnd httpd php-fpm php-mysqli mariadb105-server php-json php php-devel -y
This installs:
Apache (web server)
MariaDB (MySQL-compatible database)
PHP and modules WordPress needs
âś… Step 4: Start Apache and MariaDB, and Enable Them at Boot
sudo systemctl enable httpd
sudo systemctl enable mariadb
sudo systemctl start httpd
sudo systemctl start mariadb
Your web server and database are now running and will auto-start next time.
N.B. It is advisable to copy this code one line at a time.
âś… Step 5: Secure MariaDB with a Root Password
sudo mysqladmin -u root password $DBRootPassword
This sets a password for the root
database user, which is important for security.
âś… Step 6: Download and Set Up WordPress
Now we install WordPress manually in the web server directory:
sudo wget http://wordpress.org/latest.tar.gz -P /var/www/html
cd /var/www/html
sudo tar -zxvf latest.tar.gz
sudo cp -rvf wordpress/* .
sudo rm -R wordpress
sudo rm latest.tar.gz
This puts WordPress in the /var/www/html
folder, which is the root of your website.
N.B. It is advisable to copy this code one line at a time.
âś… Step 7: Configure WordPress Connection to Database
sudo cp wp-config-sample.php wp-config.php
sudo nano wp-config.php
# Replace placeholders with your variables
sudo sed -i "s/'database_name_here'/'$DBName'/g" wp-config.php
sudo sed -i "s/'username_here'/'$DBUser'/g" wp-config.php
sudo sed -i "s/'password_here'/'$DBPassword'/g" wp-config.php
# Fix file permissions so Apache can read/write
sudo chown apache:apache * -R
This file tells WordPress how to connect to your database.
Note: To exit the nano editor (sudo nano wp-config.php), press Ctrl + X.
âś… Step 8: Create the Database and WordPress User in MariaDB
Create a temporary script to set up your database:
echo "CREATE DATABASE $DBName;" >> /tmp/db.setup
echo "CREATE USER '$DBUser'@'localhost' IDENTIFIED BY '$DBPassword';" >> /tmp/db.setup
echo "GRANT ALL ON $DBName.* TO '$DBUser'@'localhost';" >> /tmp/db.setup
echo "FLUSH PRIVILEGES;" >> /tmp/db.setup
Now run the script:
mysql -u root --password=$DBRootPassword < /tmp/db.setup
sudo rm /tmp/db.setup
Done! You now have a database and user ready for WordPress.
âś… Step 9: Complete the WordPress Installation via Browser
Go back to your EC2 dashboard.
Find the Public IPv4 address of your EC2 instance.
In your browser, go to:
http://<your-ec2-public-ip>
You should see the WordPress setup screen. Choose your language and follow the prompts:
Site title
Admin username/password
Email
And that’s it! 🎉
âś… Conclusion
Deploying WordPress manually on AWS Free Tier may seem intimidating at first, but as you've seen, it's very doable — even for beginners. By using Amazon EC2 with Apache, PHP, and MariaDB, you’ve not only launched your blog or website for free, but you’ve also gained real hands-on experience with cloud infrastructure and Linux.
This kind of manual setup gives you full control and a deeper understanding of how WordPress runs under the hood — something that tools like Bitnami or managed hosting don’t always teach you.
Whether you're a student, hobbyist, or aspiring cloud engineer, this is a solid first step into both cloud computing and web development. Your WordPress site is now live and ready to grow.
Subscribe to my newsletter
Read articles from Oluwagbayi Adewakun directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
