https://growth-coder.tistory.com/114

https://growth-coder.tistory.com/116

<build.gradle>
dependencies {
.
.
.
   implementation 'org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE'
}
<application.properties>
#access key
cloud.aws.credentials.accessKey=ACCESS_KEY

#secret key
cloud.aws.credentials.secretKey=SECRET_KEY

#버킷 이름
cloud.aws.s3.bucketName=BUCKET_NAME

#리전
cloud.aws.region.static=ap-northeast-2

#cloud formation 기능을 사용하지 않기 위함.
cloud.aws.stack.auto=false
<S3Config>
@Configuration
public class S3Config {
    @Value("${cloud.aws.credentials.accessKey}")
    private String accessKey;
    
    @Value("${cloud.aws.credentials.secretKey}")
    private String secretKey;
    
    @Value("${cloud.aws.s3.bucketName}")
    private String bucketName;
    
    @Value("${cloud.aws.region.static}")
    private String region;

    @Bean
    public AmazonS3 s3Client() {
        AWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretKey);

        return AmazonS3ClientBuilder.standard()
                .withCredentials(new AWSStaticCredentialsProvider(awsCredentials))
                .withRegion(region)
                .build();
    }
}