Change the default content type to multiple files that were uploaded to the AWS S3 bucket
Using aws-cli, I have uploaded 5gb of files to an Amazon S3 bucket I made on a static website. Some of the site link files are .shtml files, but S3 has Metadata Content Type by default binary/octet-stream
, but I want these files to contain Metadata Content - Type text/html
. Otherwise it doesn't work in the browser.
Is there an aws-cli s3api command that I can use to change the content type for all .shtml files?
+3
source to share
2 answers
To change the metadata on an Amazon S3 object , copy the object to yourself and specify the metadata.
From StackOverflow: How to change the content type of an object using aws cli? :
$ aws s3api copy-object --bucket archive --content-type "application/rss+xml" \
--copy-source archive/test/test.html --key test/test.html \
--metadata-directive "REPLACE"
+3
source to share