I cannot connect to AWS RabbitMQ from my local machine

0

I have created RabbitMQ instance in AWS, it works and Web Console works too. I have created an exchange, queue bound with it and message. All works. Then I try the c# code , the host and port I have got from AWS RabbitMQ config.

`ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.Port = 5671; connectionFactory.HostName = "amqps://prefix.mq.us-east-1.amazonaws.com"; connectionFactory.HostName = "prefix.mq.us-east-1.amazonaws.com"; connectionFactory.UserName = "admin"; connectionFactory.Password = "mypwd";

        try
        {
            IConnection connection = connectionFactory.CreateConnection();
        }
        catch(Exception x)
        {
            Console.WriteLine("TEST: {0}", x.Message);
        }`

The result is: "x.Message = "None of the specified endpoints were reachable"" Where am I wrong? How to fix it?

gefragt vor 2 Jahren2152 Aufrufe
5 Antworten
0

Hi!

I gather you have deployed RabbitMQ through Amazon MQ? What are the settings for the actual RabbitMQ, is the network settings set to 'public access' or 'private access'?

AWS
beantwortet vor 2 Jahren
  • Hi, yes, I have re-checked again: it is "Public accessibility : Yes" .
    What else can I check?

0

Also, I have scanned the url using Zenmap

Starting Nmap 7.92 ( https://nmap.org ) at 2022-02-11 09:45 W. Europe Standard Time NSE: Loaded 155 scripts for scanning. NSE: Script Pre-scanning. Initiating NSE at 09:45 Completed NSE at 09:45, 0.00s elapsed Initiating NSE at 09:45 Completed NSE at 09:45, 0.00s elapsed Initiating NSE at 09:45 Completed NSE at 09:45, 0.00s elapsed Failed to resolve "<prefix>.mq.us-east-1.amazonaws.com:5671". NSE: Script Post-scanning.

beantwortet vor 2 Jahren
0

Also, I see

Security and network VPC vpc-xxxxxx3a Subnet(s) subnet-xxxxx0e Public accessibility Yes


But no any Security group. May be I need to add it? How to ?

beantwortet vor 2 Jahren
0

I have scanned the url without port using ZenMap: the host was found and traceroute built from my local machine to AWS. But: it found only one opened port: 443. I need 5671, what can I do in this situation?

beantwortet vor 2 Jahren
0

i had simillar problem with C# .Net 6.0. I solved it by adding Ssl setting like following:

string hostName = "b-407ac8c5-64dc-4b0c-adb6-dae0423fa7b1.mq.ap-northeast-1.amazonaws.com"; // change to yours

var factory = new ConnectionFactory()

{

HostName = hostName,

Port = 5671,

UserName = "YOURS",

Password = "YOURS",

`Ssl = new SslOption`

`{`

    `ServerName = hostName,`

  `  Enabled = true`

}

};

beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen