We will be using the ebextensions to deploy the EFS in Elastic beanstalk.

Installation and configuration

Clone the project locally to your Linux machine.

$ git clone git@github.com:ahamedyaserarafath/ebextension_wordpress_efs.git

Copy the extension as .ebxtenstion in your core code and upload the same in your AWS Elastic Beanstalk.

$ cp -r ebxtenstion <path_to_your_application>/.ebxtenstion

Add the below values as Environment properties in your Elastic Beanstalk.

+-------------------+--------------------------------------------+
|        Key        |                       Value                |
+-------------------+--------------------------------------------+
| EFS_NAME          |  <efs_dns_name>                            |
+-------------------+--------------------------------------------+

Script Flow

  1. Install nfs-utils and jq for the mounting purpose.
  2. Simple bash script to mount the efs to /mnt/efs/uploads
  3. Removing the /var/app/ondeck/wp-content/uploads directory.
  4. Link the /var/app/ondeck/wp-content/uploads to /mnt/efs/uploads

https://github.com/ahamedyaserarafath/ebextension_wordpress_efs

GitHub Link, Please feel free to fork and use it

Categorized in:

Tagged in:

,