AmazonS3Client(credentials) is deprecated

You can either use AmazonS3ClientBuilder or AwsClientBuilder as alternatives.

For S3, simplest would be with AmazonS3ClientBuilder,

BasicAWSCredentials creds = new BasicAWSCredentials("access_key", "secret_key"); 
AmazonS3 s3Client = AmazonS3ClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(creds)).build();

Use the code listed below to create an S3 client without credentials:

AmazonS3 s3Client = AmazonS3ClientBuilder.standard().build();

An usage example would be a lambda function calling S3.


You need to pass the region information through the

com.amazonaws.regions.Region object.

Use AmazonS3Client(credentials, Region.getRegion(Regions.REPLACE_WITH_YOUR_REGION))