title: AWS CLI S3 copy (cp) command return 0 (zero) status code on both successful and unsuccessful attempts - Is this correct behavior?
body: <p>I'm running a simple S3 copy command using the AWS command line tools. I have purposely entered a non-existent bucket name to test failures and handle them accordingly. However my return code is 0 (zero) on both successfully and non-successful copies to S3. Is this normal behavior or a bug? If this is normal, then how can I capture errors without having to inspect (i.e. grep) the standard output for string values (i.e. "upload failed")?</p>
  
  <p><strong>Successful copy</strong></p>
  
  <pre><code>[ec2-user@ip-10-0-10-68 ~]$ aws s3 cp puppetmaster-bootstrap.sh s3://puppet-enterprise
  upload: ./puppetmaster-bootstrap.sh to s3://puppet-enterprise/puppetmaster-bootstrap.sh
  [ec2-user@ip-10-0-10-68 ~]$ echo $?
  0
  </code></pre>
  
  <p><strong>Unsuccessful copy</strong></p>
  
  <pre><code>[ec2-user@ip-10-0-10-68 ~]$ aws s3 cp puppetmaster-bootstrap.sh s3://puppe-enterprise | tee -a ${LOGFILE}
  upload failed: ./puppetmaster-bootstrap.sh to s3://puppe-enterprise/puppetmaster-bootstrap.sh A    client error (NoSuchBucket) occurred when calling the PutObject operation: The specified bucket does not exist
  [ec2-user@ip-10-0-10-68 ~]$ echo $?
  0
  </code></pre>
  
  <p>Using CLI version: </p>
  
  <pre><code>[ec2-user@ip-10-0-10-68 ~]$ aws --version
  aws-cli/1.3.17 Python/2.6.9 Linux/3.10.35-43.137.amzn1.x86_64
  </code></pre>