Ich habe eine erstellt Zugriffsschlüssel -ID unter Verwendung eines Speichergrid -Mieter -Managers
Hier ist mein Code: < /p>
Code: Select all
BasicAWSCredentials awsCredentials = new BasicAWSCredentials("The Access key ID from above", "The Secret Access Key that was created along with the Access key ID");
AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
.withRegion("us-east-1")
.withCredentials(new AWSStaticCredentialsProvider(awsCredentials))
.build();
File videoFile = new File("C:\\Users\\charlie\\Downloads\\20250205_130357.mp4");
try (InputStream inputStream = new FileInputStream(videoFile)) {
ObjectMetadata metadata = new ObjectMetadata();
metadata.setContentLength(videoFile.length());
s3Client.putObject("audio-files", "20250205_130357.mp4", inputStream, metadata);
System.out.println("Video uploaded successfully: " + "20250205_130357.mp4");
} catch (IOException e) {
System.err.println("Error uploading video: " + e.getMessage());
}
< /code>
Ich habe eine Reihe von Schlüssel erstellt und weiß, dass sie korrekt sind. Aber ich bekomme immer noch Folgendes, wenn es versucht, das PutObject zu machen: < /p>
Request processing failed: com.amazonaws.services.s3.model.AmazonS3Exception: The AWS Access Key Id you provided does not exist in our records.
Vielen Dank