Referencing S3 Data in Applications
You can reference data in Amazon S3 using a URL starting with the s3a:// prefix followed by bucket name and path to file or directory.
The URL structure is:
s3a://<bucket>/<dir>/<file>
For example, to access a file called "mytestfile" in a directory called "mytestdir", which is stored in a bucket called "mytestbucket", the URL is:
s3a://mytestbucket/mytestdir/mytestfile
The following FileSystem shell commands demonstrate access to a bucket named
mytestbucket
:
hadoop fs -ls s3a://mytestbucket/ hadoop fs -mkdir s3a://mytestbucket/testDir hadoop fs -put testFile s3a://mytestbucket/testFile hadoop fs -cat s3a://mytestbucket/testFile