I'm using atlassian/aws-s3-deploy pipeline to deploy to s3, and using cloudfront
But sadly cloudfront doesnt compress images, so I'm wandering whether atlassian/aws-s3-deploy pipeline can compress and add encoding header
Nvm,
I found the answer, I compress it myself
find $(realpath ./build/static/images) -name "*" -type f -exec sh -c "gzip -c9 '{}' > '{}.gz'; mv '{}.gz' '{}'" \;
and deploy aws-s3-deploy with
CONTENT_ENCODING: 'gzip'
the problematic need to careful is when I use extra args filtering
--exclude *
which work fine if I execute
aws s3 sync
directly,
which somehow not exactly same as I expected in the pipe, then I need use
DEBUG: 'true'
to see what's happen, and found it need to use this style
--exclude=*
Hello @xicond ,
Thank you for reaching out to Atlassian Support.
What the pipe atlassian/aws-s3-deploy is essentially doing is executing the aws s3 sync command, with the arguments you pass as variables for the pipe.
Looking at AWS's CLI s3 sync documentation, it doesn't look to provide any argument to enable compressions of images, so I think this is not currently supported by that AWS command.
In this case, you would either have to execute the compression before executing the pipe atlassian/aws-s3-deploy , or implement something on AWS side, such as a Lambda function, to compress the images after they were uploaded. I found the following article that might be relevant to your use-case :
Hope that helps! Let me know in case you have any questions.
Thank you, @xicond
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.