小编R M*_*R M的帖子

如何将 STSAssumeRoleSessionCredentialsProvider 与 roleSessionName 和 roleArn 结合使用用于适用于 Java 2.x 的 AWS 开发工具包进行配置?

目前,对于 AWS SDK for Java 1.x,我使用以下代码。

@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();
   }
Run Code Online (Sandbox Code Playgroud)

如何对适用于 Java 2.x 的 AWS 开发工具包执行相同操作?

谢谢

file-upload amazon-s3 amazon-web-services aws-java-sdk aws-java-sdk-2.x

6
推荐指数
1
解决办法
9300
查看次数