Skip to content

Commit c308293

Browse files
committed
Fix: credetial을 IAM role을 통해 부여하는 방식으로 변화
1 parent c8cd747 commit c308293

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

src/main/java/acc/hotsix/file_share/global/config/S3Config.java

-20
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,20 @@
33
import org.springframework.beans.factory.annotation.Value;
44
import org.springframework.context.annotation.Bean;
55
import org.springframework.context.annotation.Configuration;
6-
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
7-
import software.amazon.awssdk.auth.credentials.AwsCredentials;
8-
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
9-
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
106
import software.amazon.awssdk.regions.Region;
117
import software.amazon.awssdk.services.s3.S3Client;
128
import software.amazon.awssdk.services.s3.presigner.S3Presigner;
139

1410
@Configuration
1511
public class S3Config {
16-
17-
@Value("${cloud.aws.credentials.access-key}")
18-
private String accessKey;
19-
20-
@Value("${cloud.aws.credentials.secret-key}")
21-
private String secretKey;
22-
2312
@Value("${cloud.aws.region.static}")
2413
private String region;
2514

26-
// access, secret key 이용해 aws 자격증명 제공
27-
@Bean
28-
public AwsCredentialsProvider awsCredentialsProvider() {
29-
AwsCredentials awsCredentials = AwsBasicCredentials.create(accessKey, secretKey);
30-
return StaticCredentialsProvider.create(awsCredentials);
31-
}
32-
3315
// s3서비스를 이용하기 위한 S3Client 객체 생성
3416
@Bean
3517
public S3Client s3Client() {
3618
return S3Client.builder()
3719
.region(Region.of(region))
38-
.credentialsProvider(awsCredentialsProvider())
3920
.build();
4021
}
4122

@@ -44,7 +25,6 @@ public S3Client s3Client() {
4425
public S3Presigner s3Presigner() {
4526
return S3Presigner.builder()
4627
.region(Region.of(region))
47-
.credentialsProvider(awsCredentialsProvider())
4828
.build();
4929
}
5030
}

0 commit comments

Comments
 (0)