Connecting to remote axon server deployed on aws

I have an axon server deployed on AWS on a docker container using ECS with EC2 instance. This EC2 instance is behind an application load balancer. I am able to access the axon server dashboard via the ALB domain.

I have an springboot application, that is not able to connect to the axon server. I tried ALB domain name, EC2 IP address and port.
Example :

axon:
  axonserver:
    servers: axon-server-app1.text.com
axon:
  axonserver:
    servers: 10.0.56.119:49160 (dynamic port mapped to 8124 container port)

I am getting the following error

2024-03-07T01:47:59.514Z INFO 1 ā€” [workspace] [ main] i.a.a.c.impl.AxonServerManagedChannel : Failed to get connection to AxonServer. Scheduling a reconnect in 2000ms
2024-03-07T01:47:59.611Z INFO 1 ā€” [workspace] [ main] i.a.a.c.impl.AxonServerManagedChannel : Requesting connection details from 10.0.56.119:49160
2024-03-07T01:47:59.617Z WARN 1 ā€” [workspace] [ main] i.a.a.c.impl.AxonServerManagedChannel : Connecting to AxonServer node [10.0.56.119:49160] failed: UNAVAILABLE: io exception

Hi,
do you have a single instance of AxonServer or are you deploying a cluster?
I assume is a single instance, but better asking.
In any case, Iā€™m not sure how is your load balancer configured, and what are the reasoning to have it in general.

First I suggest you make port 8124 accessible in your security group on both AxonServer instance and application side and let your application connect without anything in between.

If you are using AxonServer with Access Control enabled, remember that you must create an application token that has the role USE_CONTEXT on the specific context that your application is using: the generated application token needs to be specified in your axon server framework client properties file.