This document describes how to run TensorFlow on S3 file system.
We assume that you are familiar with reading data.
To use S3 with TensorFlow, change the file paths you use to read and write data to an S3 path. For example:
filenames = ["s3://bucketname/path/to/file1.tfrecord", "s3://bucketname/path/to/file2.tfrecord"] dataset = tf.data.TFRecordDataset(filenames)
When reading or writing data on S3 with your TensorFlow program, the behavior could be controlled by various environmental variables:
- AWS_REGION: By default, regional endpoint is used for S3, with region
AWS_REGIONis not specified, then
- S3_ENDPOINT: The endpoint could be overridden explicitly with
- S3_USE_HTTPS: HTTPS is used to access S3 by default, unless
- S3_VERIFY_SSL: If HTTPS is used, SSL verification could be disabled
To read or write objects in a bucket that is no publicly accessible, AWS credentials must be provided through one of the following methods:
- Set credentials in the AWS credentials profile file on the local system,
~/.aws/credentialson Linux, macOS, or Unix, or
- Set the
- If TensorFlow is deployed on an EC2 instance, specify an IAM role and then give the EC2 instance access to that role.