Skip to content

Commit

Permalink
[WIP] debug InstanceProfileCredentialsProvider usage
Browse files Browse the repository at this point in the history
  • Loading branch information
agebhar1 authored and embano1 committed Nov 4, 2024
1 parent 9deafbc commit 422ba5e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.apache.kafka.common.Configurable;
import org.slf4j.Logger;
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
import software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider;
import software.amazon.awssdk.profiles.ProfileFileSupplier;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.sts.StsClient;
Expand Down Expand Up @@ -82,9 +82,9 @@ public static AwsCredentialsProvider getAwsCredentialsProvider(EventBridgeSinkCo
return getStsAssumeRoleCredentialsProvider(config);
}

private static DefaultCredentialsProvider getDefaultCredentialsProvider(
private static InstanceProfileCredentialsProvider getDefaultCredentialsProvider(
EventBridgeSinkConfig config) {
var builder = DefaultCredentialsProvider.builder();
var builder = InstanceProfileCredentialsProvider.builder();

// Leverage DefaultSupplier to automatically reload credentials on file refresh
// https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/credentials-profiles.html#profile-reloading
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
Expand All @@ -24,6 +25,7 @@ public class EventBridgeCredentialsProviderFactoryTest {
"aws.eventbridge.eventbus.arn", "arn:aws:events:us-east-1:000000000000:event-bus/e2e");

@Test
@Disabled
public void shouldUseDefaultAwsCredentialsProvider() {

var provider =
Expand Down

0 comments on commit 422ba5e

Please sign in to comment.