I am not able to send message on an SQS queue through AWS Java SDK. Here is code that I am using:
final AmazonSQS sqs = AmazonSQSClientBuilder.defaultClient();
try {
String queueUrl = "My sqs queue url"
sqs.sendMessage(new SendMessageRequest(queueUrl, "This is my message text."));
} catch (final AmazonServiceException ase) {
//log error message here
} catch (final AmazonClientException ace) {
//log error message here
}
This snippet throws AmazonServiceException
with message: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details
In SDK documentation, there is nothing mentioned about how to sign the request. Also, For authentication, I have exported environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY containing AWS access key and secret values.
I picked this sample code from AWS documentation
Can anyone help me about how to fix this?
us-west-2
) – Alexandre Dupriez