Application Development

Host WordPress Site on AWS: Complete Setup Guide

J
James Eriksson
··14 min read
Complete guide to hosting WordPress on AWS: Lightsail $5/mo, EC2 setup with LAMP, real costs, security hardening, common mistakes, and when managed WordPress pays off.
TL;DR
  • AWS offers three main WordPress hosting options: Lightsail ($5/month, simple), EC2 ($15-30/month, full control), and RDS for managed databases.
  • DIY AWS works best if you have DevOps capability or multiple sites; real costs include $0.09/GB for data transfer over 1GB/month, plus 5-10 hours of monthly maintenance.
  • Lightsail with Bitnami is the fastest setup path; EC2 with LAMP requires Linux, MySQL, and Apache setup but gives you maximum flexibility.
  • Common mistakes include Elastic IP changes breaking DNS, database connection failures, file permission issues blocking uploads, and mixed-content SSL errors.
  • Switch to managed WordPress when maintenance time exceeds 5 hours/month, you manage 3+ client sites, need EU data residency, or cannot handle 24/7 emergencies.

Hosting WordPress on AWS gives you full control and transparent costs. You choose between pre-configured Lightsail, managed databases via RDS, or bare EC2 instances with LAMP. The tradeoff is real: you manage updates, backups, security, and infrastructure yourself. This guide walks you through each option, actual costs, and when that overhead stops making sense.

WordPress on AWS: DIY or Managed?

When you host WordPress on AWS, you are building your own hosting platform. AWS provides the infrastructure; you provide the management. For some teams, that is the right answer. For others, it becomes a time sink that eats into what actually matters.

The appeal is clear. AWS scales on demand. You pay only for what you use. There are no surprise limits. You own your data completely. And if you need to integrate WordPress into a larger cloud architecture, AWS has the tools.

But there is a responsibility shift. When something breaks at 2 AM, you are the one debugging it. Your database runs out of connections? Your job. Your SSL certificate expires? Your job. A WordPress core update introduces a bug? You manage the rollback.

For small teams running one or two sites, this overhead is not always worth the savings. A developer spending 10 hours a month on WordPress maintenance costs more than most managed hosting plans. That is why many agencies choose managed WordPress alternatives for client projects.

DIY AWS makes sense if you are running WordPress alongside other AWS services, managing multiple sites with scale, have an ops team, or need capabilities that managed plans do not offer. The key is being honest about what "cheap" actually means. A $5-per-month instance is not cheap if it takes 100 hours a year to maintain.

AWS Options: EC2 vs Lightsail vs RDS vs CloudFormation

AWS has multiple ways to run WordPress. Each is designed for a different use case.

Lightsail is the simplest option. AWS created it specifically for small projects. You launch a pre-configured instance with WordPress already installed via Bitnami. It includes a fixed monthly fee (typically $5-$20), a certain amount of compute, storage, and data transfer. You update WordPress through the Bitnami dashboard. Lightsail is not "serverless" and you still manage the operating system and security groups, but it hides much of the AWS complexity.

EC2 is the workhorse. This is raw virtual servers. You choose the instance type, operating system, storage size, and everything else. You then SSH in and build a LAMP (Linux, Apache, MySQL, PHP) or LEMP (Nginx instead of Apache) stack from scratch. Total control. Total responsibility. Can be as cheap as $5 per month for a small instance, or $500+ per month for a large one.

RDS is a managed database service. Many teams run WordPress on EC2 but use RDS for the MySQL database instead of installing MySQL locally on the instance. This decouples the database from the web server. Scaling the database does not require rebuilding the entire instance. RDS handles automated backups and failover. It costs extra (typically $20-$100+ per month depending on instance size), but reduces operational burden.

CloudFormation is infrastructure as code. You write a template describing your entire WordPress setup: EC2 instances, RDS databases, security groups, load balancers, everything. AWS builds it for you. This is powerful if you need to replicate the exact same setup multiple times or tear it down and rebuild it programmatically. It has a learning curve.

For a first-time setup, Lightsail or EC2 is the right choice. RDS is for teams managing production databases. CloudFormation is for teams running multiple environments or who need infrastructure repeatability.

Quick Path: AWS Lightsail with Bitnami

Lightsail is the fastest way to get WordPress running on AWS. Here is the conceptual flow.

You log into the AWS Lightsail console (separate from the main EC2 console). You choose Create Instance. AWS shows you pre-configured applications. One of them is WordPress (powered by Bitnami). You select it.

You choose your instance size. The smallest costs about $5 per month and handles light traffic. You choose your availability zone (the data center region). You choose a static IP (Elastic IP; required so your domain does not break if the instance stops). You click Create.

AWS builds the instance. This takes a few minutes. When it is ready, Lightsail gives you an IP address and a temporary admin password. You SSH into the server or use Lightsail's web terminal.

The WordPress installation is already there. The database is pre-configured. All file permissions are set. You change the default admin password, then navigate to your server's IP in a browser. WordPress is live.

Next, you buy a domain and point it to the Lightsail instance's IP address via your DNS registrar (GoDaddy, Namecheap, Route 53, etc.). The Lightsail console includes a DNS section where you can manage these records directly.

Then you install an SSL certificate using Let's Encrypt (free). Lightsail includes a one-click Let's Encrypt option. You enable it, and within minutes, your WordPress site is on HTTPS.

From here, you manage WordPress normally: add plugins, upload themes, write posts. The only difference is you are on AWS infrastructure. Lightsail works well for blogs, agency sites, and projects with predictable, low-to-moderate traffic. If you outgrow it, you can migrate to EC2 or switch to a managed WordPress host.

Full Control: WordPress on EC2 with LAMP Stack

EC2 gives you raw virtual machines. You build everything yourself. It is more complex but far more flexible.

You need an AWS account, comfort with the Linux command line and SSH, understanding of security groups (AWS's firewall), and a domain name you own.

In the AWS EC2 console, you click Launch Instance. You choose an Amazon Linux 2 AMI. You select an instance type. t3.micro is free-tier-eligible for the first 12 months. For production, t3.small ($0.0208 per hour, about $15/month) is a safer bet.

You configure the network settings. You create or select a security group. This controls inbound/outbound traffic. At minimum, allow port 22 (SSH), port 80 (HTTP), and port 443 (HTTPS). You allocate storage (30 GB is usually enough for small WordPress sites) and launch.

Then you SSH into the instance and install LAMP:

sudo yum update -y
sudo yum install -y httpd mysql-server php php-mysql
sudo systemctl start httpd
sudo systemctl start mysqld
sudo systemctl enable httpd
sudo systemctl enable mysqld

Create a WordPress database:

mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'your-secure-password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Download and configure WordPress:

cd /var/www/html
sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xzf latest.tar.gz
sudo mv wordpress/*.
sudo chown -R apache:apache /var/www/html
sudo cp wp-config-sample.php wp-config.php
sudo nano wp-config.php

Edit wp-config.php to add your database name, user, and password.

Set file permissions:

sudo chmod 755 /var/www/html
sudo chmod -R 755 /var/www/html/wp-content
sudo chmod 644 /var/www/html/wp-config.php
sudo systemctl restart httpd

Assign a domain by using an Elastic IP (static IP that persists through restarts). In the EC2 console, go to Elastic IPs, click Allocate, associate it with your instance. Point your domain registrar to this IP.

Install SSL with Let's Encrypt:

sudo yum install -y certbot python2-certbot-apache
sudo certbot certonly --apache -d yourdomain.com

Configure Apache to use the certificate by editing /etc/httpd/conf.d/ssl.conf to point to the paths Certbot created. Restart Apache.

Your WordPress site is now live on HTTPS. You can access wp-admin and start configuring. The challenge: you now own all updates, backups, security patches, and monitoring.

Cost Reality: What You'll Actually Pay

This is the section people skip but should not.

Lightsail costs $5/month for the smallest instance. Add $1 for a static IP. If your site stays under 1 GB of data transfer per month, that is all. Most Lightsail instances stay under $15 per month.

EC2 on free tier costs $0 for 12 months, then $7.50/month for t3.micro. t3.small is $15/month. Add storage at about $2.50/month for 30 GB.

Data transfer is where people get surprised. The first 1 GB of outbound data per month is free. Beyond that, AWS charges $0.09 per GB. If your site gets 100,000 pageviews per month and each page is 2 MB, you are looking at 200 GB of transfer, which is $18 in charges on top of your compute costs.

RDS starts at $12/month for db.t3.small plus $4-5 per month for storage. If you add it to EC2, your total jumps to $32-40/month minimum.

A real example: small WordPress site on Lightsail with static IP equals $6/month. Same site on EC2 plus typical data transfer equals $26.50/month. Same site on EC2 plus RDS equals $32/month minimum.

The AWS free tier is generous for 12 months. After that, your costs jump immediately. Many people are shocked when they get the first real bill.

Costs spiral when traffic spikes (every GB over 1 GB costs $0.09), your database grows (storage charges), you take frequent snapshots (each stored and charged), or you make mistakes like leaving an instance running by accident.

The real cost of DIY AWS is not the monthly instance. It is the time you spend managing it plus surprise charges when something breaks or traffic spikes.

Security and Operational Overhead

Hosting WordPress on AWS means you are responsible for security. AWS provides the infrastructure; you provide the hardening.

Never use password-based SSH. Use key pairs only. Keep your private key secure. Restrict inbound traffic in security groups: only allow port 22 from your IP, port 80 and 443 from anywhere.

The database user should have minimal privileges. It should only access the WordPress database, not create new databases. Set a strong password (20+ characters, random). Create a non-admin WordPress user for day-to-day tasks.

Keep everything updated: WordPress core, plugins, themes, PHP, MySQL, the OS itself. Outdated software is the number-one attack vector.

On Lightsail, Bitnami sends notifications when updates are available. You apply them manually. On EC2, you have no automatic updates. SSH in and run sudo yum update -y. Enable automatic WordPress updates in wp-config.php:

define('WP_AUTO_UPDATE_CORE', true);
define('AUTOMATIC_UPDATER_DISABLED', false);

Backups are critical. Lightsail includes automatic daily snapshots. On EC2, use AWS Backup for snapshots or a WordPress plugin like UpdraftPlus for database backups to S3. For production, do both.

Set up CloudWatch alarms: CPU above 80%, disk space above 85% full, failed logins, database connection errors. A simple dashboard costs nothing and alerts you before failure.

If you have one WordPress site, budget 5-10 hours per month for updates, monitoring, and troubleshooting. If you have 10 sites, it scales super-linearly. You end up with a part-time DevOps role. For agencies managing client sites, this overhead multiplies quickly.

Common Mistakes and How to Avoid Them

Elastic IP changes break DNS. You launch an EC2 instance with a public IP. You point your domain to it. Weeks later, you restart the instance for maintenance. The IP changes. Your site is unreachable. The DNS still points to the old IP. Use an Elastic IP from day one. Associate it with your instance. It persists through restarts.

Database connection issues happen after setup works fine. The MySQL service stopped and did not restart on boot, the database user password was wrong, the database ran out of disk space, or MySQL crashed. Ensure MySQL starts on boot: sudo systemctl enable mysqld. Monitor disk usage. Set a CloudWatch alarm for disk space above 85%.

File permission issues block uploads. Apache does not have write access to wp-content. Run: sudo chown -R apache:apache /var/www/html and sudo chmod 775 /var/www/html/wp-content.

SSL/HTTPS mixed-content errors show up after Let's Encrypt is installed. Some resources still load over HTTP. Go to Settings > General in WordPress and change both URLs to https://. Update plugins. Use find-and-replace to swap any remaining http:// to https://.

Server crashes during traffic spikes. A t3.micro instance cannot handle viral traffic. Use a caching plugin like WP Super Cache. Monitor memory usage. If consistently above 80%, upgrade the instance. Review slow query logs and optimize database queries.

When to Ditch DIY and Switch to Managed WordPress

At some point, managing WordPress on AWS stops being worth it.

You are spending more than 5 hours a month on maintenance: That is 60 hours per year. Assuming your time is worth $50/hour, that is $3,000 per year in hidden cost. Add it to your AWS bill. Most managed WordPress plans cost $30-100/month. At $60/month, that is $720/year. The DIY economics no longer work.

You have more than 3-5 WordPress sites: One site is manageable. Each additional site adds complexity without economies of scale. You are still managing security, backups, updates, and monitoring for each one. For agencies managing multiple client sites, services like Opsily offer per-site isolation, 1-click updates, and staging environments so you can test changes safely before pushing to production.

You need GDPR compliance and EU data residency: AWS has data centers globally, but navigating compliance requires careful setup. Managed WordPress providers on EU infrastructure handle this transparently. If your audience is in Europe, check whether the provider can offer EU data residency as a core feature.

You are building a client-facing platform: If you are selling WordPress hosting to clients, DIY AWS becomes a liability. Each client needs isolated backups, separate databases, their own security updates, and transparent SLAs. Managed WordPress with multi-site support handles this automatically.

You cannot handle 2 AM emergencies: If your site crashes at 2 AM and your business depends on it being up, you need 24/7 support. AWS has limited phone support (at cost). Managed WordPress providers offer 24/7 support as standard.

Managed WordPress handles automatic core, plugin, and theme updates; daily backups with one-click restore; SSL certificates auto-renewed; staging environments; 24/7 monitoring and support; DDoS protection; and performance caching. You focus on content and business logic. The platform handles infrastructure.

If you are managing agencies or high-traffic WordPress sites, switching to managed WordPress is not failure. It is growing up.

Frequently Asked Questions

Can I host WordPress on AWS free tier?

Yes, but with limits. Amazon's free tier includes t3.micro instance, 30 GB of storage, and some data transfer for 12 months. After that, you pay. Lightsail's free tier is $5/month for the first 3 months, then full price. Free tier is enough for a low-traffic blog or development environment, not production.

Do I need RDS or can I use a local database on EC2?

You can use MySQL on the same EC2 instance. It is simpler and cheaper. As traffic grows, decoupling the database using RDS lets you scale the web server and database independently. For small sites, local is fine. For production with significant traffic, RDS is safer because it handles automated failover and backups.

How do I backup WordPress on AWS?

Three approaches: AWS snapshots of the entire instance, RDS automated backups if using a separate database, or WordPress plugins like UpdraftPlus that back up to S3. Best practice is all three: infrastructure backups, database backups, and application-level backups.

What is the minimum cost to run WordPress on AWS?

Lightsail at $5/month. EC2 free tier is free for 12 months, then $7.50/month for t3.micro. Add a domain ($10-15/year) and SSL (free with Let's Encrypt). Real minimum is $5/month if you use Lightsail and accept low-traffic assumptions.

Is AWS secure for WordPress?

AWS infrastructure is secure. Your security depends on how you configure it. Lightsail has reasonable defaults. EC2 gives you control; you have to harden it yourself. Enable security groups, use SSH keys, keep software updated, use strong passwords. AWS is as secure as you make it.

How do I scale WordPress on AWS if traffic grows?

Lightsail: upgrade to a larger instance (downtime, but simple). EC2: use auto-scaling groups to add instances plus a load balancer to distribute traffic. This is complex and requires AWS knowledge. Managed WordPress: they handle scaling automatically.

When should I use Lightsail instead of EC2?

Lightsail if you want simplicity and have predictable, low-to-moderate traffic. EC2 if you need full control, are building a larger architecture, or need auto-scaling. For most people starting out: Lightsail.

The Bottom Line

Hosting WordPress on AWS works. You can run it on Lightsail for $5/month, or on EC2 for $15-30/month, or on a combination of services for more control. The appeal is real: no arbitrary limits, transparent costs, and full ownership of your data.

The catch: operational overhead. You are not just buying a server. You are becoming your own DevOps team. That is worth it only if you have the time, expertise, or traffic to justify it.

For small teams or agencies managing multiple sites, managed WordPress removes that overhead. Services offering EU data centers with automatic updates, backups, and monitoring deliver value that DIY rarely matches. The cost per site is higher, but the hidden costs disappear. That is a tradeoff worth calculating honestly before you start.

Start with the question: What are you optimizing for? If it is cost and you have ops capability, use AWS. If it is time and you have clients to focus on, use managed. If it is control and you need integration with other AWS services, use EC2. Know your answer. Then choose the option that actually delivers it.

Ready to skip the management overhead?
Opsily handles WordPress updates, backups, and staging environments automatically, with transparent pricing and 24/7 support.
Explore Managed WordPress

Ready to self-host your own apps?

One server. Multiple apps. No per-app fees.

Get started →