0
votes

When using the Java s3 sdk aws-java-sdk-s3:1.11.542 in Scala, I'm getting a "AWS Access Key Id you provided does not exist in our records."

I've verified that I can access the bucket and run commands, e.g: aws s3 mv s3://{bucket} ./ --recursive and aws s3 ls s3://{bucket}.

My implementation for the client is:

implicit val s3Client: AmazonS3 = AmazonS3ClientBuilder
      .standard
      .withRegion(new DefaultAwsRegionProviderChain().getRegion)
      .withCredentials(new DefaultAWSCredentialsProviderChain)
      .build

I've tried explicitly using BasicAWSCredentials, EnvironmentVariableCredentialsProvider, and ProfileCredentialsProvider too.

Edit: Was an issue with my default profile and okta that I'm using

1

1 Answers

0
votes

you can use AWSCredentialsProvider API

implicit val awsCredentialsProvider = new AWSCredentialsProvider {    
          override def getCredentials = new BasicAWSCredentials(AWSKey, AWSSecret)
          override def refresh(): Unit = ??? 
    }

and use the awsCredentialsProvider to create a AmazonS3ClientBuilder.

implicit val s3Client: AmazonS3 = AmazonS3ClientBuilder
      .standard
      .withCredentials(awsCredentialsProvider)
      .withRegion(new DefaultAwsRegionProviderChain().getRegion)
      .build