title: AWS CLI 'cp' fails with "The specified bucket does not exist"
body: <p>I am doing my first steps with AWS and trying AWS CLI to copy a file from an EC2 server to a S3 server.</p>
  
  <p>I receive an error: </p>
  
  <blockquote>
    <p>A client error (NoSuchBucket) occurred when calling the PutObject operation: The specified bucket does not exist</p>
  </blockquote>
  
  <p>My command is as follows:<br>
   - I went to my S3 dashboard, selected the bucket -> properties and copeied the 'Endpoint' value which is </p>
  
  <blockquote>
    <p>[bucket name].s3-website-us-west-2.amazonaws.com</p>
  </blockquote>
  
  <ul>
  <li>Then executed</li>
  </ul>
  
  <blockquote>
    <p>aws s3 cp ./file.ext
    s3://[bucket name].s3-website-us-west-2.amazonaws.com/file.ext</p>
  </blockquote>
  
  <p>But it failed with the error described earlier - bucket does not exist.</p>
  
  <p>p.s. Running </p>
  
  <blockquote>
    <p>aws s3api list-buckets --query 'Buckets[].Name'</p>
  </blockquote>
  
  <p>Shows that the bucket does exist so that isn't the issue to my understanding. </p>
  
  <p><strong>EDIT</strong>
  If I do not use the endpoint but only use the bucket name the error message encourage to use the full name which in all the online examples seems exactly like the endpoint  </p>
  
  <blockquote>
    <p>upload failed: ./file.ext to s3://[bucket name]/file.ext A client error (PermanentRedirect) occurred when calling the PutObject operation: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint: [bucket name].s3.amazonaws.com
    You can fix this issue by explicitly providing the correct region location using the --region argument, the AWS_DEFAULT_REGION environment variable, or the region variable in the AWS CLI configuration file.  You can get the bucket's location by running "aws s3api get-bucket-location --bucket BUCKET".</p>
  </blockquote>