You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.0 KiB
33 lines
1.0 KiB
|
8 months ago
|
package kr.re.etri.autoflow.common;
|
||
|
|
|
||
|
|
import org.springframework.beans.factory.annotation.Value;
|
||
|
|
import org.springframework.context.annotation.Bean;
|
||
|
|
import org.springframework.context.annotation.Configuration;
|
||
|
|
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
|
||
|
|
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
|
||
|
|
import software.amazon.awssdk.regions.Region;
|
||
|
|
import software.amazon.awssdk.services.s3.S3Client;
|
||
|
|
|
||
|
|
@Configuration
|
||
|
|
public class AwsConfig {
|
||
|
|
|
||
|
|
@Value("${cloud.aws.credentials.access-key}")
|
||
|
|
private String accessKey;
|
||
|
|
|
||
|
|
@Value("${cloud.aws.credentials.secret-key}")
|
||
|
|
private String secretKey;
|
||
|
|
|
||
|
|
@Value("${cloud.aws.region.static}")
|
||
|
|
private String region;
|
||
|
|
|
||
|
|
@Bean
|
||
|
|
public S3Client s3Client() {
|
||
|
|
AwsBasicCredentials credentials = AwsBasicCredentials.create(accessKey, secretKey);
|
||
|
|
|
||
|
|
return S3Client.builder()
|
||
|
|
.region(Region.of(region))
|
||
|
|
.credentialsProvider(StaticCredentialsProvider.create(credentials))
|
||
|
|
.build();
|
||
|
|
}
|
||
|
|
}
|