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
- Install nfs-utils and jq for the mounting purpose.
- Simple bash script to mount the efs to /mnt/efs/uploads
- Removing the /var/app/ondeck/wp-content/uploads directory.
- 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