Java Aws sdk 2连接和异步调用

时间:2017-12-11 03:56:34

标签: java amazon-s3 amazon-ec2 proxy aws-sdk

我尝试在本地通过代理写入异步 S3存储桶,而使用Java aws sdk 2库通过EC2实例写入

我能够创建同步客户端,但 ASYNC 似乎是不同的球类游戏。

这里的代码是我用来使用iam密钥和EC2实例进行本地连接的代码:      Region region = Region.of(awsS3Config.getRegion());            if(goalsEngineConfig!= null&& ENVIRONMENT_LOCAL.equalsIgnoreCase(goalsEngineConfig.getEnv()))             {                 AwsCredentials                     awsCredentials =                     AwsCredentials.create(awsS3Config.getIamKey(),awsS3Config.getIamSecretKey());

github_rsa
github_rsa.pub
id_boot2docker
id_boot2docker.pub
id_rsa
id_rsa.pub
known_hosts

//创建异步不工作所以我需要帮助创建它                 this.s3AsyncClient = S3AsyncClient.builder()                     .region(区域)                     .asyncHttpConfiguration(ClientAsyncHttpConfiguration.builder()                        .httpClient(sdkHttpClient)                       .build())。credentialsProvider(StaticCredentialsProvider.create(awsCredentials))                     。建立();             }             否//不是本地环境,使用EC2实例身份验证             { this.s3AsyncClient = S3AsyncClient.builder()                     .region(区域)                     .credentialsProvider(new InstanceProfileCredentialsProvider.create())                     。建立();             }

欢迎任何帮助?

0 个答案:

没有答案