I'm writing a Lambda function (in Java) that should add a message to the SQS.
Lambda has permissions to access any SQS (AmazonSQSFullAccess):
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"sqs:*"
],
"Effect": "Allow",
"Resource": "*"
}
]
}
My code is using a standard SQS client: private final AmazonSQS sqs = AmazonSQSClientBuilder.standard().withRegion(Regions.EU_NORTH_1).build();
The problem is lambda never ends (timeouts) when trying to get list of queues or send a message:
ListQueuesResult result = sqs.listQueues();
SendMessageRequest sendMsgRequest = new SendMessageRequest()
.withQueueUrl(queueUrl)
.withMessageBody(assetBody)
.withDelaySeconds(0);
sqs.sendMessage(sendMsgRequest);
My question is whether I should provide credentials when instantiating the sqs client (lambda is scripted with terraform, so it's not easy/nice to do it) or I'm doing wrong something else?
Lambda timeout is set to 30s now.
thanks, Chris