I'm setting up Spring Cloud on AWS ECS but I have a problem with Zuul/Eureka. When I'm trying to hit endpoint "/api/second/service2" I see this error:
Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: service2
I'm using Elastic IP for Eureka instance as explained here https://github.com/Netflix/eureka/wiki/Deploying-Eureka-Servers-in-EC2 . I have 2 spring boot applications, and I see both of them in Eureka. I'm able to hit endpoint directly.
This is config for Eureka server:
server:
port: 8761
eureka:
client:
fetchRegistry: false
registerWithEureka: false
eurekaServerURLContext: eureka
region: eu-west-3
eurekaServerPort: 8761
useDnsForFetchingServiceUrls: true
eurekaServerDNSName: my.dns
datacenter: cloud
Service2:
spring:
application:
name: service2
server:
port: 8882
eureka:
datacenter: cloud
instance:
preferIpAddress: true
client:
fetchRegistry: true
eurekaServerURLContext: eureka
region: eu-west-3
eurekaServerPort: 8761
useDnsForFetchingServiceUrls: true
eurekaServerDNSName: my.dns
Zuul:
pring:
application:
name: api-gateway
server:
port: 8080
eureka:
datacenter: cloud
client:
fetchRegistry: true
eurekaServerURLContext: eureka
region: eu-west-3
eurekaServerPort: 8761
useDnsForFetchingServiceUrls: true
eurekaServerDNSName: my.dns
zuul:
prefix: /api
routes:
first-service:
path: /first/**
serviceId: service1
second-service:
path: /second/**
serviceId: service2
Do you have any idea where can be the problem?
EDIT: It works only if I map my service2 instance port from 8882 to port 80