@Bean
public DynamoDbClient amazonDynamoDB() {
final AssumeRoleRequest assumeRoleRequest = AssumeRoleRequest.builder().roleSessionName(UUID.randomUUID().toString()).roleArn("roleArn").build();
final StsAssumeRoleCredentialsProvider stsAssumeRoleCredentialsProvider = StsAssumeRoleCredentialsProvider.builder().refreshRequest(assumeRoleRequest).build();
return DynamoDbClient.builder().credentialsProvider(stsAssumeRoleCredentialsProvider).region(Region.EU_WEST_1)
.build();
}
getting error
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [software.amazon.awssdk.services.dynamodb.DynamoDbClient]: Factory method 'amazonDynamoDB' threw exception; nested exception is java.lang.NullPointerException: STS client must not be null. at [email protected]/org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) at [email protected]/org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:650) ... 58 common frames omitted Caused by: java.lang.NullPointerException: STS client must not be null.