Hosting a WordPress Using S3

Leveraged EC2 for WordPress management and S3 for hosting a static version.

CLOUD PROJECTS

2/12/20243 min read

Purpose: Maintaining a dynamic WordPress website on an Amazon EC2 instance can incur significant costs due to the continuous computing resources required. To reduce these costs and decrease the load on the EC2 instance, convert the dynamic website into a static version. The static HTML pages will then be hosted on an Amazon S3 bucket, a cost-effective and scalable storage solution. This approach ensures lower operational costs and improves the website's loading speed and resilience to traffic spikes. The EC2 instances will only be transitioned to an active state when updates are necessary, such as publishing new blog posts or changing the site's content or design. This strategy optimizes resource usage and costs while maintaining the flexibility to update the website as needed.

Here is the login to the WordPress website to start editing a blog.

I have configured WordPress on an Amazon EC2 instance, and now it hosts my blog called "The Cloud Journey of an Immigrant."

I created and edited the S3 bucket to host the static version of WordPress. I also unblocked public access.

I implemented critical steps to optimize the WordPress site by utilizing the WP-static tool, which allowed me to convert the site into static HTML pages. This approach significantly reduces the server's overhead and lowers associated costs.

Next, I uploaded the static pages to the S3 bucket. This approach lets me access the website without running the WordPress server or EC2 instances. I also found my blog post, 'The Cloud Journey as an Immigrant,' among the static pages.

The next step is to upload the static pages to the S3 bucket. I can still access the website when the WordPress server is turned off. It does not require the EC2 instances to be running.

Next, I needed to change the WordPress directory, eliminate the WordPress-static directory, run the tool to create the HTML pages, and copy the files into the S3 bucket.

I created another blog, and now the script helps copy the pages or any updates from the WordPress website running on an EC2 instance to be copied into the S3 bucket without copying the file manually. The key here is to turn off the EC2 instance after the static pages have been updated and copied to the bucket. And then turn it on whenever a change needs to be done.

Finally, I created the static website and hosted it in an S3 bucket.

I hope you enjoyed the project!