title: Amazon S3 Command Line Copy all objects to themselves setting Cache control
body: <p>I have an Amazon S3 bucket with about 300K objects in it and need to set the Cache-control header on all of them. Unfortunately it seems like the only way to do this, besides one at a time, is by copying the objects to themselves and setting the cache control header that way:</p>
  
  <ul>
  <li><a href="http://docs.aws.amazon.com/cli/latest/reference/s3/cp.html" rel="nofollow noreferrer">http://docs.aws.amazon.com/cli/latest/reference/s3/cp.html</a></li>
  </ul>
  
  <p>Is the documentation for the Amazon S3 CLI copy command but I have been unsuccessful setting the cache control header using it. Does anyone have an example command that would work for this. I am trying to set cache-control to max-age=1814400</p>
  
  <p>Some background material:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/10435334/set-cache-control-for-entire-s3-bucket-automatically-using-bucket-policies">Set cache-control for entire S3 bucket automatically (using bucket policies?)</a></li>
  <li><a href="https://forums.aws.amazon.com/thread.jspa?messageID=567440" rel="nofollow noreferrer">https://forums.aws.amazon.com/thread.jspa?messageID=567440</a></li>
  </ul>