1. 기존 메소드
AmazonS3 s3Client = new AmazonS3Client(new BasicAWSCredentials(accessKey, secretKey));
- 해당 메소드 수석을 참고하면 아래와 같다.
/**
* Constructs a new Amazon S3 client using the specified AWS credentials to
* access Amazon S3.
*
* @param awsCredentials
* The AWS credentials to use when making requests to Amazon S3
* with this client.
*
* @see AmazonS3Client#AmazonS3Client()
* @see AmazonS3Client#AmazonS3Client(AWSCredentials, ClientConfiguration)
* @deprecated use {@link AmazonS3ClientBuilder#withCredentials(AWSCredentialsProvider)}
*/
@Deprecated
public AmazonS3Client(AWSCredentials awsCredentials) {
this(awsCredentials, configFactory.getConfig());
}
2. 변경된 메소드
BasicAWSCredentials creds = new BasicAWSCredentials(accessKey, secretKey);
AmazonS3 s3client = AmazonS3ClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(creds)).build();
- 리전을 추가할 경우
.withRegion(Regions.valueOf("AP_NORTHEAST_2"))
'프로그래밍 > JAVA' 카테고리의 다른 글
AWS s3 upload source Tip (0) | 2018.06.05 |
---|---|
json schema validator 사용하기 - 02 (0) | 2018.05.23 |
json schema validator 사용하기 - 01 (0) | 2018.04.18 |
시스템 종료 후 File 삭제 (0) | 2018.04.12 |
public static void main(String[] args){} (0) | 2018.04.03 |