Currently for AWS SDK for Java 1.x im using below code.
@Configuration
@ImportResource("classpath:aws-context.xml")
public class AmazonS3Config {
@Bean(destroyMethod = "shutdown")
public AmazonS3Client amazonS3Client(@Value("${aws.s3.roleSessionName}") String roleSessionName,
@Value("${aws.s3.roleArn}") String role) {
AmazonS3ClientBuilder builder = AmazonS3ClientBuilder.standard();
builder.withRegion(Regions.US_EAST_1).withCredentials(new
STSAssumeRoleSessionCredentialsProvider.Builder(role, roleSessionName).build());
return (AmazonS3Client)builder.build();
}
How to do the same for AWS SDK for Java 2.x?
Thanks