Skip to content

Commit

Permalink
let assume role session duration to be set as default 15 minutes
Browse files Browse the repository at this point in the history
  • Loading branch information
amrutha-shanbhag committed Sep 30, 2021
1 parent f6cd799 commit d99025b
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static AmazonS3ClientBuilder getS3ClientBuilderWithRegionAndCredentials(f
AWSStaticCredentialsProvider awsStaticCredentialsProvider = new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKey, secret));
AWSCredentialsProvider awsCredentialsProvider;

if (roleArn == null || StringUtils.isBlank(roleArn)) {
if (StringUtils.isBlank(roleArn)) {
// when IAM user has direct access to the S3 bucket
awsCredentialsProvider = awsStaticCredentialsProvider;
} else {
Expand All @@ -58,7 +58,6 @@ public static AmazonS3ClientBuilder getS3ClientBuilderWithRegionAndCredentials(f

awsCredentialsProvider = assumeRoleBuilder
.withStsClient(awsSecurityTokenService)
.withRoleSessionDurationSeconds((int) TimeUnit.HOURS.toSeconds(1))
.build();
}

Expand Down

0 comments on commit d99025b

Please sign in to comment.