Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

sychronous webclient communication between springboot applications when deployed to aws ecs

Joined
Feb 9, 2023
Messages
82
I have deployed my springboot microservice to aws ecs.But i found that my eureka server is not avaliable after deployed to aws ecs which make my apllication cannot communicate between microservice which should be work in my local machine.The application should on different port in the same ip address

Here is the error:

Code:
2023-02-27T05:53:34.937Z ERROR [api-gateway,,]` 1 --- [tbeatExecutor-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_API-GATEWAY/***:api-gateway:8080 - was unable to send heartbeat!
Later on i have checked on aws ecs and i found that the aws ecs not supported to third party application,but there are inbound discovery service in aws ecs.Hence i have tried to to make request in webclient using dns+port directly.But it also fail with the following error:

Code:
com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
    at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:112) ~[eureka-client-2.0.0.jar:2.0.0]
    at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.sendHeartBeat(EurekaHttpClientDecorator.java:89) ~[eureka-client-2.0.0.jar:2.0.0]
    at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$3.execute(EurekaHttpClientDecorator.java:92) ~[eureka-client-2.0.0.jar:2.0.0]
    at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77) ~[eureka-client-2.0.0.jar:2.0.0]
    at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.sendHeartBeat(EurekaHttpClientDecorator.java:89) ~[eureka-client-2.0.0.jar:2.0.0]
    at com.netflix.discovery.DiscoveryClien

It seems that can i just remove the eureka-client and use aws dns + port can solve the problem or how can achieve the communication between microservice in ecs

code:

Code:
  public Mono<user_info> finduser(String username){
            return webClientBuilder.baseUrl("http://"+dns).build().get()
                    .uri(uriBuilder -> uriBuilder
                            .path("UserJob/get/Byusername/{username}")//"http://localhost:8082/Checkuser/{id}")
                            .build(username))
                    .retrieve()
                .bodyToMono(user_info.class);
    }
 
New member
Joined
Feb 27, 2023
Messages
2
It's not 100% clear to me from a network Point-of-View what you are trying to achieve. Is Eureka running on a different EC2?
Because it's seems like a connection issue to me. To solve connection issues inside VPCs, please check
  • That the DNS names are reachable (try to ping them from inside the machines)
  • That the security groups of the EC2 Instances allow the traffic (try to execute a curl on the ip/dns+port from the other machine)
  • That everything is located in the same VPC or the VPCs are connected to each other
  • That NACLs and RouteTables allow the Traffic (which might not be necessary if you just use one VPC).
Since you are using HTTPS please also check the inner exception for certificate errors.
 
Top