Serverless WordPress Hosting on AWS: Beginner’s Tutorial

Published 15/09/25 · Read 3 minute

Traditional WordPress hosting relies on dedicated servers or virtual machines. While this works for many websites, it can become expensive and harder to scale when traffic spikes.

A modern solution is serverless WordPress hosting, where your site runs on cloud services that automatically scale and you only pay for what you use.

In this guide, we’ll explore how to set up serverless WordPress hosting on AWS (Amazon Web Services) using services like Amazon S3, Lambda, Aurora, and CloudFront.


What is Serverless WordPress Hosting?

Serverless hosting means you don’t manage servers directly. Instead, your application runs on cloud infrastructure where resources scale automatically.

For WordPress, this usually means:

  • Static assets (images, CSS, JS) on Amazon S3.

  • PHP requests handled by AWS Lambda.

  • Database on Amazon Aurora (Serverless).

  • Caching and global delivery via Amazon CloudFront.


Benefits of Serverless WordPress

  • Auto Scaling – Handles traffic spikes without downtime.
  • 💰 Cost Efficiency – Pay only for the resources you use.
  • 🌎 Global Performance – AWS CloudFront ensures fast delivery across Canada and worldwide.
  • 🔒 Improved Security – Isolated functions reduce attack surfaces.
READ :  Tutorial WordPress Lengkap untuk Pemula dari Nol

Step 1: Set Up WordPress Database on AWS Aurora

  1. Open the AWS Management Console.

  2. Go to Amazon RDS → Create Database.

  3. Select Aurora MySQL (Serverless v2).

  4. Configure auto-scaling capacity.

  5. Save database credentials for WordPress connection.


Step 2: Store Media and Static Assets on Amazon S3

  1. Create an S3 bucket (e.g., my-wordpress-media).

  2. Use a plugin like WP Offload Media Lite to automatically upload WordPress media to S3.

  3. Enable CloudFront CDN for faster delivery.


Step 3: Run PHP on AWS Lambda

WordPress is a PHP application. To run it serverlessly:

  • Use AWS Lambda with PHP Runtime (via custom runtime such as Bref).

  • Package WordPress files and deploy with AWS SAM (Serverless Application Model) or Serverless Framework.

  • Connect Lambda to Aurora DB for database queries.

Example serverless.yml (simplified):

service: wordpress-lambda

provider:
  name: aws
  runtime: provided.al2
  region: ca-central-1

functions:
  wordpress:
    handler: public/index.php
    events:
      - httpApi: '*'

Step 4: Add CloudFront as CDN + Reverse Proxy

  1. Create a CloudFront distribution.

  2. Set origin to your API Gateway or Lambda function.

  3. Add S3 bucket as a secondary origin for media files.

  4. Enable caching for better performance.


Step 5: Manage Authentication and Security

  • Use AWS Cognito or standard WordPress login.

  • Secure your Aurora DB with VPC.

  • Use AWS WAF (Web Application Firewall) to protect against attacks.

READ :  Cara Memilih Tema WordPress yang SEO Friendly

Step 6: Deployment Automation

To simplify deployment, use:

  • Serverless Framework → easy CLI for Lambda deployments.

  • Terraform → manage AWS infrastructure as code.

  • GitHub Actions or AWS CodePipeline → automate CI/CD.


Best Practices

  • Always enable CloudFront caching for performance.

  • Use Aurora Serverless v2 for database cost efficiency.

  • Store environment variables in AWS Secrets Manager.

  • Regularly back up your S3 and Aurora DB.


FAQ

1. Can I run WordPress fully serverless?
Yes, using Lambda for PHP, Aurora Serverless for DB, and S3 for media.

2. Is serverless WordPress cheaper than EC2 hosting?
Yes, especially for sites with unpredictable traffic. You only pay when functions run.

3. Which AWS region should I choose for Canada?
Use Canada (Central) in Montréal (ca-central-1) for best latency.

4. Do I need coding skills for serverless WordPress?
Yes, some DevOps and AWS knowledge is required.

5. Can WooCommerce work with serverless WordPress?
Yes, but performance tuning and caching are critical for e-commerce workloads.