title: AmazonS3Exception: The authorization header is malformed; the region is wrong
body: <p>Found a few topics that covered the same error in Stackoverlfow, but the scenarios don't match mine.  Have an AWS s3 java client program that runs fine on windows in uploading files to an s3 bucket.  Now trying to run the same program on a Linux (Ubuntu) server, and getting this error</p>
  <p>com.amazonaws.services.s3.model.AmazonS3Exception: The authorization header is malformed; the region 'us-east-1' is wrong; expecting 'eu-west-2' (Service: Amazon S3; Status Code: 400; Error Code: AuthorizationHeaderMalformed; Request ID:</p>
  <p>I uploaded the .aws\credentials file from my Windows laptop to the ~/.aws/ directory on the server. Didn't make any changes. I confirmed I had the right credential key after cross-checking with IAM on AWS.</p>
  <p>Here's the code (yes, it's hardcoded) that sets the region
  AmazonS3 s3Client;
  private static final byte[] BUFFER = new byte[4096 * 1024];</p>
  <pre><code>public FileUpload() {
      s3Client = AmazonS3ClientBuilder.standard().withRegion(&quot;us-east-1&quot;).build();
  }
  </code></pre>
  <p>I created the bucket manually in the AWS console and it's in the us-east-1 region.</p>
  <p>Do I need a config file under ~/.aws ?  Don't have one
  on the Windows laptop</p>