Forbidden error while accessing AWS services on Kubernetes
If you have recently moved towards Kubernetes from EC2 and getting forbidden error while accessing AWS services make sure to have aws-sts in classpath.
In nutshell, the following dependency must be present
<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-sts -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-sts</artifactId>
<version>1.12.136</version>
</dependency>
The corresponding dependency for the AWS SDK v2 will be
<!-- https://mvnrepository.com/artifact/software.amazon.awssdk/sts -->
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sts</artifactId>
<version>2.16.24</version>
<scope>test</scope>
</dependency>
This is because the credential provider which is concerned with loading the credentials from EKS role lies in sts module