Cloud / AWS /

copying SVG files to S3 using AWS CLI


15 April 2015

1 Minute Read

Although a really simple one once you work it out, but painful before you get there, the AWS CLI is failry primitive in some respects and can cause some pain in getting things done.

We recently had this problem introducing SVG files to our static website that is built using AWESTRUCT and hosted on S3. Yes, AWESTRUCT is pretty cool.

SVG files by default have the wrong content-type and wont render correctly. To solve this, we did the following.

aws s3 sync _site/ s3://BUCKET --delete --exclude '*.svg'
aws s3 sync _site/ s3://BUCKET --delete --exclude '*' --include '*.svg' --content-type 'image/svg+xml'

Pretty easy but took some time to work out the right combination, especially since we are using Jenkins to build a Docker container to produce the slave that then pushes to S3.

More Tech Posts