- Más nuevo
- Más votos
- Más comentarios
The error message indicates that you need to use AWS Signature Version 4 to authenticate your requests to Amazon S3 with Object Lock parameters. This is because Object Lock is a feature that provides WORM (Write Once Read Many) functionality, and as such, requires a higher level of security.
You can enable Signature Version 4 by removing the .withClientConfiguration(new ClientConfiguration().withSignerOverride("AWSS3V4SignerType")) line from your code. The AWS SDK for Java will automatically use Signature Version 4 if it's required for the API you're calling.
Here's an updated version of your code:
final AwsClientBuilder.EndpointConfiguration endpoint = new AwsClientBuilder.EndpointConfiguration( s3Endpoint, s3Region ); final AmazonS3 s3client = AmazonS3ClientBuilder .standard() .withEndpointConfiguration(endpoint) .enablePathStyleAccess() .build();
Note that it's recommended to use IAM roles or instance profiles to provide AWS credentials to applications running on EC2 or EKS, rather than using explicit access keys. This approach can help improve security and simplify credential management.
Thanks, I updated my code to use SDK v2 and that solved the problem.
Contenido relevante
- OFICIAL DE AWSActualizada hace un año
- OFICIAL DE AWSActualizada hace 3 años
- OFICIAL DE AWSActualizada hace 7 meses
- OFICIAL DE AWSActualizada hace 3 años
Can you share the code to put the object, including client initialization?
Here is my code for creating the client
And then I make a call for writing object into the bucket