As the question implies I want to change/set some HTTP headers for a single object in a S3 bucket via CLI. This is what I have tried so far:
aws s3 sync --delete --acl public-read --cache-control \
max-age=31536000 --expires "Mon, 01 Oct 2035 20:30:00 GMT" \
js/jquery-blockui/jquery.blockUI.min.js \
s3://mybucket/js/jquery-blockui/jquery.blockUI.min.js --dryrun
The problem is, that aws s3 sync
tells me that he could not find the file /home/user/somedir/js/jquery-blockui/jquery.blockUI.min.js/
(see the last slash - the file DOES exist actually) on my file system:
warning: Skipping file
/home/user/somedir/js/jquery-blockui/jquery.blockUI.min.js/.
File does not exist.
So aws s3 sync
does only expect a directory to be passed as the source? Does anyone has an idea, how to do that for a single file? I want to write a script and pass some files, which need to be altered - that's why I am asking. Thanks.
aws s3 cp
is your friend :)This should work:
Note that
--delete
is not supported withaws s3 cp
but that's a minor. You can always delete it locally after upload with good old/bin/rm
:)And yes,
aws s3 sync
only works recursively between local directories and S3 folders, not on single files.Hope that helps :)