Search code examples
amazon-web-servicesrabbitmqamqp

Why can't I access my RabbitMQ broker on AWS?


I'm trying to communicate with my RabbitMQ server using a C# .NET Core 3.1 client. If I run a RabbitMQ server on my local machine, it works fine. If I try to do the same on the RabbitMQ server I started on AWS, I cannot reach it.

C# client:

        var factory = new ConnectionFactory
        {
            HostName = amqp.Server,
            UserName = amqp.Username,
            Password = amqp.Password,
            Port = amqp.Port
        };

        _connection = factory.CreateConnection();

I checked the values of amqp.Server, Username, Password and Port and all of them are correct. Anyways, it returns the following exception:

RabbitMQ.Client.Exceptions.BrokerUnreachableException: None of the specified endpoints were reachable ---> System.AggregateException: One or more errors occurred. (Connection failed) ---> RabbitMQ.Client.Exceptions.ConnectFailureException: Connection failed ---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (10060): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

First I thought, the AWS firewall may block requests from the used port (5671, AMQPs), but trying to connect using Telnet worked.

Screenshot of the current ACL settings: enter image description here

Same setting is used for Outbound rules too. But to be honest I am not sure whether I have to use TCP or another traffic type.

EDIT: Access type is set to "Public access". I forgot to say that. My apologies.

Does anyone have an idea what to try?

EDIT2: Here's the output of the CLI command list-brokers: enter image description here


Solution

  • I found the problem. Our company firewall blocked the port 5671. Now it works. Thank you for your help @samtoddler and @amitd.