Search code examples
amazon-web-servicesamazon-s3content-type

recursively update object metadata in AWS S3


I have tons of files (20GB) with the incorrect metadata (content-type) causing the browser to download the file instead of displaying images inline..

I tried with

aws s3 cp \
    --exclude "*" \
    --include "*.jpg" \
    --content-type="image/jpg"  \
    --metadata-directive="REPLACE" \
    --recursive \
    --dryrun \
    s3://mybucket01/accounts/full/ \
    s3://mybucket01/accounts/full/

looks like is only copying the file itself but not updating the content-type. any ideas how to fix this? thanks!


Solution

  • removing --dryrun solved my problem.

    http://docs.aws.amazon.com/cli/latest/reference/s3/cp.html

    --dryrun (boolean) Displays the operations that would be performed using the specified command without actually running them.