title: AWS S3 Golang SDK - uploading files - wrong region
body: <p>I'm having an issue where I'm trying to upload a file to S3 via the official Golang AWS SDK. </p>
  
  <p>I'm targeting a bucket that's specified to be in Northern California region (us-west-1). I can see it in the S3 explorer; however, when I run the put operation I get the following error:</p>
  
  <pre><code>BucketRegionError: incorrect region, the bucket is not in 'Northern California' region
  </code></pre>
  
  <p>This is how I am setting up my connection:</p>
  
  <pre><code>creds := credentials.NewStaticCredentials(aws_access_key_id, aws_secret_access_key, token)
  _,err := creds.Get()
  
  config := &amp;aws.Config{
      Region          :aws.String("us-west-1"),
      Endpoint        :aws.String("s3.amazonaws.com"),
      S3ForcePathStyle:aws.Bool(true),
      Credentials     :creds,
      //LogLevel        :0,
  }
  
  s3_client := s3.New(session.New(config))
  
  params := &amp;s3.PutObjectInput{
      Bucket       :aws.String(p_bucket_name_str),         
      Key          :aws.String(p_target_file__s3_path_str),
      ACL          :aws.String("public-read"),
      Body         :file_bytes,
      ContentLength:aws.Int64(size),
      ContentType  :aws.String(file_type),
      Metadata     :map[string]*string{
           "Key":aws.String("MetadataValue"),
      },
  }
  
  result,err := p_s3_client.PutObject(params)
  </code></pre>
  
  <p>Any suggestion or fix would be of huge help, thank you.</p>