Python script for syncing AWS assets between Craft Cloud environments.
- python-dotenv
cp .env.example .env
Obtain the AWS S3 CLI crendetials from Craft Console Projects > Access > Asset Storage > AWS CLI
These values are needed for the following environment variables:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_DEFAULT_REGION
- AWS_SESSION_TOKEN
The following path variables set the local and remote S3 paths for syncing
- S3_REMOTE_ASSETS_PATH - The S3 target e.g. s3://{asset_storage_uuid}/{environment_uuid}/assets/
- LOCAL_ASSETS_PATH - The local path to the folder of local assets usually this is the path to web/uploads
python3 ./craft-cloud-aws-sync.py local
python3 ./craft-cloud-aws-sync.py remote