Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

I want to deploy to s3 with compression

xicond February 14, 2023

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

2 answers

1 accepted

0 votes
Answer accepted
xicond February 16, 2023

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=*
0 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 16, 2023

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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events