If you have already uploaded an object to an Amazon S3 bucket, how do you change the metadata using the API? It is possible to do this in the AWS Management Console, but it
here is the code that worked for me. I'm using aws-java-sdk-s3 version 1.10.15
ObjectMetadata metadata = new ObjectMetadata(); metadata.setContentType(fileExtension.getMediaType()); s3Client.putObject(new PutObjectRequest(bucketName, keyName, tempFile) .withMetadata(metadata));