aws에서 제공하는 많은 credentialpProvider 중에 뭘 써야 하는 지.. 한참 삽질하다가..
bean 설정도 해보고 configuration 파일도 만들어보고 ㅠㅠ
결국엔 ClasspathPropertiesFileCredentialsProvider 를 사용.
1. credentials.properties 파일 설정
2. 어디에 박아야 하는가
여기에다
3. 어케 불러오냐.
credentialsProvider 를 생성해 줄 때 경로를 지정해준다.
Spring mvc 프로젝트라면 src/main/resources 안에다가 .properties 파일을 넣어준다.
만약 바로 밑에 넣지 않고 패키지로 한번 싼다면
Provider 생성할 때 경로에 "패키지명/credentials.properties" 로 해주면..
아마 잘 됐었는뎀...
public S3Util() { try { credentialsProvider = new ClasspathPropertiesFileCredentialsProvider( "credentials.properties" ); credentials = credentialsProvider.getCredentials(); s3 = new AmazonS3Client( credentials ); // 클라이언트 구성 northEast1 = Region.getRegion( Regions.AP_NORTHEAST_1 ); s3.setRegion( northEast1 ); } catch (Exception e) { e.printStackTrace(); } }
':D > Spring' 카테고리의 다른 글
[Tomcat]The absolute uri: '~~' cannot be resolved in either web.xml or the jar files (....) (0) | 2024.03.18 |
---|---|
[Spring]java.io.IOException: The temporary upload location [C:\어쩌구저쩌구] is not valid (0) | 2023.07.13 |
[Spring][Spring Boot]logback.xml 로 프로파일 별 로그 남기기.. (2) (0) | 2018.03.29 |
[Spring]logback.xml 로 프로파일 별 로그 남기기.. (0) | 2018.03.27 |
[Spring]@RequestParam 과 @PathVariable 차이 (0) | 2016.02.03 |