Create AWS EFS (Elastic File System) Plugin storage for WordPress behind Load Balancer

This article is the continuation of WordPress with Docker, AWS (ECS, Code Pipeline, Load Balancer, RDS, EFS) Complete Series. For better understating, please start from the beginning of the series.

Why do we need to use EFS for plugin storage

We all love the fact that on WordPress, we can install plugins without a deployment. Here’s the challenge with this approach, if your WordPress website is behind a Load balancer and there are multiple instances running. You will be installing the plugin only on the instance you are connected to. It will crash for the users who are connected to other instances.

One simpler solution is to deploy the WordPress website again with the plugin included. It takes away the freedom of installing or un-installing a plugin without a redeployment.

AWS Elastic File System (EFS) is our answer, we will simple mount the plugin directory of WordPress instances to our EFS.

Let’s get our hands dirty folks !!!

Create EFS Service

Select EFS from the service tab of your AWS console and click on Create file system

In the security groups we will add efs Security group.

Note: Please use MAX/IO option optimal performance.

Go ahead and finish creating the EFS setup. It will take few minutes for AWS to create our file system.

In the meantime, we will SSH into our Bastian instance and install few things. Please refer to the Prepare AWS Security Groups for WordPress project Connect to Bastian Instance section to connect.

Once you connect to the bastian instance, run the following commands:

We will use the same EFS for our plugins and cache (for SEO optimization later)

Go to your EFS file system and copy the DNS value.

Run the following command

Please replace fs-6f0f3156.efs.ap-southeast-2.amazonaws.com with your own file system DNS name

now run the following command to make sure that the EFS is mounted correctly.

As I told you earlier, It’ll get easier as we will progress. Our plugins and cache storage in completed !!!!

Written by

One thought on “Create AWS EFS (Elastic File System) Plugin storage for WordPress behind Load Balancer

  1. Hai How to get the DNS name in EFS. I could not able to see screen what you have showed in this article. Please can you help me in this regard

Leave a Reply to Krishna Cancel reply

Your email address will not be published. Required fields are marked *