title: Load dataset from amazon S3 to jupyter notebook on EC2
body: <p>I want to try image segmentation with deep learning using AWS. I have my data stored on Amazon S3 and I'd like to access it from a Jupyter Notebook which is running on an Amazon EC2 instance. </p>
  
  <p>I'm planning on using Tensorflow for segmentation, therefore it seemed appropriate to me to use options provided by Tensorflow themselves (<a href="https://www.tensorflow.org/deploy/s3" rel="nofollow noreferrer">https://www.tensorflow.org/deploy/s3</a>) as it feels that in the end I want my data to be represented in the format of tf.Dataset. However, it didn't quite work out for me. I've tried the following:</p>
  
  <pre><code>filenames = ["s3://path_to_first_image.png", "s3://path_to_second_image.png"]
  dataset = tf.data.TFRecordDataset(filenames)
  
  iterator = dataset.make_one_shot_iterator()
  next_element = iterator.get_next()
  
  with tf.Session() as sess:
  for i in range(2):
      print(sess.run(next_element))
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>OutOfRangeError: End of sequence
   [[Node: IteratorGetNext_6 = IteratorGetNext[output_shapes=[[]], output_types=[DT_STRING], _device="/job:localhost/replica:0/task:0/device:CPU:0"](OneShotIterator_6)]]
  </code></pre>
  
  <p>I'm quite new to tensorflow and have just recently started trying out some stuff with AWS, so I hope that my mistake is gonna be obvious to someone with more experience. I would greatly appreciate any help or advice! Maybe it's even the wrong way and I'm better off with something like boto3 (also stumbled upon it, but thought that tf would be more appropriate in my case) or something else?</p>
  
  <p>P.S. Tensorflow also recommends to test a setup with the following piece:</p>
  
  <pre><code>from tensorflow.python.lib.io import file_io
  print (file_io.stat('s3://path_to_image.png'))
  </code></pre>
  
  <p>For me this leads to <code>Object doesn't exist</code> error, though the object certainly exists and it's being listed among others if I use</p>
  
  <pre><code>for obj in s3.Bucket(name=MY_BUCKET_NAME).objects.all():
  print(os.path.join(obj.bucket_name, obj.key))
  </code></pre>
  
  <p>I also have my credentials filled in <code>/.aws/credentials</code>. What might be the problem here?</p>