I would do something like this with AWS SDK instead of mix and match with Hadoop classes and only for listing objects, NOT recommending to load huge datasets.

import com.amazonaws.auth.DefaultAWSCredentialsProviderChain
import{AmazonS3Client, AmazonS3URI}

val location = "s3://bucketname/Daily/DailyCash.TXT"

val awsCredentials = new DefaultAWSCredentialsProviderChain()
val s3Client = new AmazonS3Client(awsCredentials)
val s3Uri = new AmazonS3URI(location)

val objects: ObjectListing = s3Client.listObjects(s3Uri.getBucket)

Related Query

More Query from same tag