A WordPress plugin to sync uploads to an Amazon S3 bucket from a VIP Go instance.
This plugin syncs the uploads
directory of a VIP Platform WordPress environment to an AWS S3 instance.
Props to S3-Uploads and Human Made for creating much of the functionality: https://github.com/humanmade/S3-Uploads
This plugin uses composer as a package manager. After downloading the plugin (as a ZIP file or via git pull
) run one of the following commands:
composer install --no-dev --optimize-autoloader
composer install
Running one of the above commands will create a vendor
directory which is required for the plugin to function correctly. Applications that are using CI/CD already run one of these commands automatically and can skip this step.
plugins
directory.wp s3-media upload-all --url=example-site.com
How can I upload media to a subdirectory in S3?
As an example, you already have a bucket named my-awesome-site
but you want all of your media to go into a preprod
subdirectory of that bucket. To configure media to upload to that subdirectory, go to the S3 Media Sync settings page and enter the following for the S3 Bucket Name
field:
my-awesome-site/preprod
Then, all media will automatically be kept in-sync within my-awesome-site/preprod/wp-content/uploads
.
How can I confirm if all of the attachments were uploaded?
You can check which attachments were skipped by running the following command:
wp vip migration validate-attachments invalid-attachments.csv --url=example-site.com
The generated log file will be available at invalid-attachments.csv
. The full command can be found here:
https://github.com/Automattic/vip-go-mu-plugins/blob/master/wp-cli/vip-migrations.php#L165-L187