Skip to content

Instantly share code, notes, and snippets.

@Azrael808
Last active June 25, 2017 00:26
Show Gist options
  • Save Azrael808/983fd6dcd6fa91c6dd1275528d68ebcd to your computer and use it in GitHub Desktop.
Save Azrael808/983fd6dcd6fa91c6dd1275528d68ebcd to your computer and use it in GitHub Desktop.
Automatically Publishing Files to CloudFront in Elastic Beanstalk
container_commands:
01_upload_to_cdn:
command: |
export REGION=`curl -s http://169.254.169.254/latest/dynamic/instance-identity/document |grep region |cut -d: -f2 | sed -e 's/[\",]//g'`
export INCLUDES=`echo $W3TC_CF_FILE_EXTENSIONS | sed 's/;/\ /g'`
for INC in $INCLUDES; do
aws s3 sync wp-includes/ s3://${W3TC_CF_BUCKET_NAME}/wp-includes/ --exclude "*" --include "${INC}" --region $REGION
aws s3 sync wp-content/ s3://${W3TC_CF_BUCKET_NAME}/wp-content/ --exclude "*" --include "${INC}" --region $REGION
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment