AWSCredentials l_credentials = new BasicAWSCredentials(
<Access Key>,
<Secret Key>
);
AmazonS3 amazonS3Cleint = AmazonS3ClientBuilder
.standard()
.withRegion(Regions.AP_SOUTHEAST_1)
.withCredentials(new AWSStaticCredentialsProvider(l_credentials))
.build();
URI fileToBeDownloaded = new URI("https://s3-ap-southeast-1.amazonaws.com/bucket-name/private/service/entity/19/04/1554190039-first%20last.csv");
AmazonS3URI s3URI = new AmazonS3URI(fileToBeDownloaded);
S3Object l_object = amazonS3Cleint.getObject(s3URI.getBucket(), s3URI.getKey());
给我
com.amazonaws.services.s3.model.AmazonS3Exception: The request signature we calculated does not match the signature you provided. Check your key and signing method. (Service: Amazon S3; Status Code: 403; Error Code: SignatureDoesNotMatch; Request ID: 621B7DD7DDCA0734; S3 Extended Request ID: HLjCevVe8qEEbcn0X4p5CvLGEF5traDzXviP1NzuA3vN10GpDfe60vw7eIUN13Z/JedEowAcYMc=), S3 Extended Request ID: HLjCevVe8qEEbcn0X4p5CvLGEF5traDzXviP1NzuA3vN10GpDfe60vw7eIUN13Z/JedEowAcYMc=
凭据正确。我可以使用aws s3 cli检查铲斗的所有内容。有人可以检查我在做什么吗?我也无法使用此客户端列出存储桶。我猜在启动Amazon客户端时会有一些问题。