The Amazon documentation says to use:
AwsBasicCredentials awsCreds = AwsBasicCredentials.create(
"your_access_key_id",
"your_secret_access_key");
S3Client s3 = S3Client.builder()
.credentialsProvider(StaticCredentialsProvider.create(awsCreds))
.build();
But that's for the S3Client, when I try to use the same structure for my AthenaClient my app won't even run and it fails to initialize.
For my application I'm grabbing the credentials from a repo with a configuration file for this app.
static @Value("${AWS_ACCESS_KEY_ID}") String amazonAccessId;
static @Value("${AWS_SECRET_ACCESS_KEY}") String amazonSecretKey;
AwsBasicCredentials awsCreds = AwsBasicCredentials.create(
"your_access_key_id",
"your_secret_access_key");
AthenaClient athenaClient = AthenaClient.builder()
.region(Region.US_WEST_2)
.credentialsProvider(StaticCredentialsProvider.create(awsCreds))
.build();
I want to provide the credentials this way so that when I push the code from my local machine the code still functions, instead of relying on my environment variables. Please tell me what I'm doing wrong, because the documentation does not.
