title: Can the S3 SDK figure out a bucket's region on its own?
body: <p>I'm writing an Amazon S3 client that might potentially access buckets in different regions. Our IT department is fairly strict about outgoing HTTP, and I want to use path-style access for this client to avoid having to make firewall changes for each new bucket.</p>
  
  <p>My client uses the java SDK v1.4.4.2. As a test, I created a bucket in Singapore, then took a working S3 unit test that lists objects, and changed it to  use path-style access:</p>
  
  <pre><code>AmazonS3 client = new AmazonS3Client(environ);
  client.setS3ClientOptions(new S3ClientOptions().withPathStyleAccess(true));
  </code></pre>
  
  <p>When I run the unit test with this version of the client, all S3 accesses fail with the error that I have to set the right endpoint.</p>
  
  <p>My question is, do I have to add the logic to look up the bucket's region and set that for the client? Or can the SDK be set to do that on its own? It seems the SDK should be able to do this automatically, since the function to look up a bucket's location is in there.</p>
  
  <p>As a side issue, are there any particular performance issues with using path-style access? I presume it's just an extra round trip to query the bucket's location if I don't already know it.</p>