Retaining meta-tags in AWS S3 upon deployments by Code Pipeline

Viewed 237

I have a serverless website on AWS with the HTML, JS, CSS files in an S3 bucket - to optimize performance most of these files are GZIP compressed and marked with content-encoding gzip in the Properties > Metadata

I recently create a Code Pipeline to deploy any changes to s3 bucket... So instead of manually replacing the s3 bucket from my local folder - I update my repo in CodeCommit (AWS's flavored Git) and it deploys it to my S3 bucket... no issues with the pipeline at all

The issue I am facing: As a result of code pipeline firing, when a new file replaces an existing file in s3, it removes the meta-tags that I had put there (on the previous file)... especially the content-encoding : gzip meta-tags... which messes up my website !!!

What would be the best way to preserve any/all meta-tags when code-pipeline deploys stuff to s3?

Ideally, I would like to avoid (if possible) using CloudFront - or writing a Lambda function which scans my repo and adds a gzip tag to all HTML, CSS, JS etc.

0 Answers
Related