Config S3
@Configuration
public class S3Config {
@Value("${aws.access_key_id}")
private String awsId;
@Value("${aws.secret_access_key}")
private String awsKey;
@Value("${s3.region}")
private String region;
@Bean
public AmazonS3 s3client() {
//passando access_key e secret_access_key
BasicAWSCredentials awsCred = new BasicAWSCredentials(awsId, awsKey);
AmazonS3 s3client = AmazonS3ClientBuilder.standard().withRegion(Regions.fromName(region))
.withCredentials(new AWSStaticCredentialsProvider(awsCred)).build();
return s3client;
}
}
Atualizado