I have an issue with an app running on an .NET ECS. The ECS reads a SQS queue then does its work using the data read.
On my computer, with local queues the project works fine. But once deployed, the ECS fails when reading the queue with the following message :
Unhandled exception. Amazon.SQS.Model.InvalidAddressException: The address https://sqs.<my-region>.amazonaws.com/ is not valid for this endpoint.
This is the configuration regarding the SQS queue :
{
"SimpleQueueServiceSettings__QueueUrl": "http://localhost:9324/000000000000/my-queue.fifo",
"AWS_ENDPOINT_URL_SQS": "http://localhost:9324" // Only on my computer, not on ECS configuration because of auto discovery
}
I read this configuration and then use it like this :
var receiveMessageRequest = new ReceiveMessageRequest
{
AttributeNames = { MessageAttributesToGet },
MessageAttributeNames = { MessageAttributesToGet },
MaxNumberOfMessages = MessagesMaxAmount,
QueueUrl = this._sqsSettings.WorkerQueueUrl, // <----
VisibilityTimeout = VisibilityTimeout,
WaitTimeSeconds = PollTime
};
this._logger.LogInformation("Receiving queue messages...");
var receiveMessageResponse = await this._amazonSqs.ReceiveMessageAsync(receiveMessageRequest);
The SQS and ECS runs in a VPC context, with DNS hostnames and resolution enabled.
I do not know, and din’t manage to find, if the issue is .net-related or AWS-related.
Do you have any idea on how can I solve this ?