DEV Community

Udoh Deborah
Udoh Deborah

Posted on

Day 45: Deploy WordPress Website on AWS

Day 45 is an exciting hands-on milestone because we’ll actually deploy a working WordPress website on AWS.
Here’s a clear step-by-step plan to follow, tying it back to what we did on Day 44 (RDS setup)

Step-by-Step: Deploy WordPress on AWS

Step 1 — Prepare the RDS Database (from Day 44)
• Go to Amazon RDS Console → Create database.
• Choose MySQL (Free tier).
• DB instance: wordpress-db
• Username: admin (or something memorable).
• Save password (you’ll use it in WordPress setup).
• Security group: allow inbound MySQL traffic only from your EC2 security group.
• Copy endpoint and port once DB is created (you’ll need it in WordPress config).

Step 2 — Launch EC2 Instance

• Launch a new Amazon Linux 2 or Ubuntu EC2 instance (t2.micro free tier).
• Attach an IAM role if needed for easier management.
• Security group:
• Allow HTTP (80) from anywhere (to serve your site).
• Allow SSH (22) from your IP (for admin access).
• Outbound should allow all (default).
Enter fullscreen mode Exit fullscreen mode

Step 3 — Install LAMP stack on EC2

SSH into your EC2 instance:

ssh -i your-key.pem ec2-user@<EC2-Public-IP>
Enter fullscreen mode Exit fullscreen mode

For Amazon Linux 2:

# Update system
sudo yum update -y

# Install Apache
sudo yum install -y httpd

# Install PHP and extensions
sudo amazon-linux-extras enable php7.4
sudo yum install -y php php-mysqlnd

# Start Apache
sudo systemctl start httpd
sudo systemctl enable httpd

Enter fullscreen mode Exit fullscreen mode

For Ubuntu:

sudo apt update && sudo apt upgrade -y
sudo apt install -y apache2 php php-mysql libapache2-mod-php
sudo systemctl enable apache2
sudo systemctl start apache2

Enter fullscreen mode Exit fullscreen mode

Step 4 — Download and Configure WordPress

cd /var/www/html

# Download WordPress
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
sudo cp -r wordpress/* /var/www/html/

# Set correct permissions
sudo chown -R apache:apache /var/www/html    # Amazon Linux
# or
sudo chown -R www-data:www-data /var/www/html  # Ubuntu

Enter fullscreen mode Exit fullscreen mode

Step 5 — Connect WordPress to RDS

• In /var/www/html, copy the sample config:
Enter fullscreen mode Exit fullscreen mode
> cp wp-config-sample.php wp-config.php
Enter fullscreen mode Exit fullscreen mode
• Edit wp-config.php:
Enter fullscreen mode Exit fullscreen mode
define('DB_NAME', 'your_db_name');
define('DB_USER', 'admin');
define('DB_PASSWORD', 'your_db_password');
define('DB_HOST', 'your-rds-endpoint:3306');
Enter fullscreen mode Exit fullscreen mode

Step 6 — Restart Web Server

sudo systemctl restart httpd   # Amazon Linux
# or
sudo systemctl restart apache2  # Ubuntu

Enter fullscreen mode Exit fullscreen mode

Step 7 — Complete WordPress Setup

• Open browser → http://<EC2-Public-IP>/
• You’ll see the WordPress installation wizard.
• Enter:
• Site Title
• Admin Username & Password
• Email
• Finish setup → you now have a live WordPress blog on AWS 
Enter fullscreen mode Exit fullscreen mode

Tips
• Use Elastic IP so your EC2 public IP doesn’t change.
• For production, secure with SSL/TLS (Let’s Encrypt) and consider scaling via Elastic Beanstalk or ECS later.
• Always keep RDS security group tight (only EC2 should connect).

Over 30% of websites worldwide run on WordPress — from blogs to e-commerce. Today I deployed a WordPress blog on AWS using:
• Amazon EC2 to host the WordPress application
• Amazon RDS (MySQL) to store WordPress data
• Apache + PHP on EC2 to serve the application

This exercise tied together networking, database management, and application hosting in the cloud. Seeing the WordPress setup screen load from my EC2 instance was a huge milestone.

Top comments (0)