title: Unable to connect to endpoint when writing to S3 using Tensorflow
body: <p>Tensorflow 1.4.0 comes with the S3 filesystem driver by default. I'm having trouble using it, and have this minimal example, that does not work for me:</p>
  
  <pre><code>import tensorflow as tf
  
  f = tf.gfile.Open("s3://bucket/plipp", mode='w')
  f.write("foo")
  f.close()
  </code></pre>
  
  <p>which gives the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "test2.py", line 5, in &lt;module&gt;
      f.close()
    File "/Users/me/venv3/lib/python3.6/site-packages/tensorflow/python/lib/io/file_io.py", line 234, in close
      pywrap_tensorflow.Set_TF_Status_from_Status(status, ret_status)
    File "/Users/me/venv3/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py", line 473, in __exit__
      c_api.TF_GetCode(self.status.status))
  tensorflow.python.framework.errors_impl.InternalError: : Unable to connect to endpoint
  </code></pre>
  
  <p>From what I can see, it seems like "Unable to connect to endpoint" is an error from the C++ AWS SDK. I've given myself <code>*</code> permissions to the bucket.</p>
  
  <p>My bucket is in <code>eu-west-1</code> and I've tried doing <code>export S3_ENDPOINT=https://s3-eu-west-1.amazonaws.com</code> and <code>export S3_REGION=eu-west-1</code> since it seems that those variables are consumed by the <a href="https://github.com/tensorflow/tensorflow/blob/b3d5ec90bc6b7ae7822ea82d82b41e529c5e047a/tensorflow/core/platform/s3/s3_file_system.cc" rel="nofollow noreferrer">S3 driver</a>, but this changes nothing.</p>
  
  <p>I've also tried using <code>s3://bucket.s3-eu-west-1.amazonaws.com/plipp</code> as the path, instead of just using the bucket name.</p>
  
  <p>I can copy files to the bucket fine:</p>
  
  <pre><code>~&gt; aws s3 cp foo s3://bucket/plipp 
  upload: ./foo to s3://bucket/plipp
  </code></pre>
  
  <p>Any ideas what I might be doing wrong? How can I debug further?</p>