DefaultAWSCredentialsProviderChain does not contain providers by default. You need to add some, for example:
val awsCredentials = new AWSCredentialsProviderChain(new
auth.EnvironmentVariableCredentialsProvider(), new
auth.profile.ProfileCredentialsProvider(), new
auth.AWSCredentialsProvider())
You can use them with an S3 client or, as you noticed by Spark:
hadoopConfig.set("fs.s3a.access.key", awsCredentials.getAWSAccessKeyId)
hadoopConfig.set("fs.s3a.secret.key", awsCredentials.getAWSSecretKey)
To switch between different AWS profiles, you can switch between profiles by setting the AWS_PROFILE environment variable. If you need to, expand to any point.
source
share