How to configure the microcervices on cloud for comunication to each other
<p>I deployed two different spring boot micro-service on azure cloud. With micro-service I also deployed eureka. When I register both the micro-service on eureka its done.My next task is to send the data from one micro-service to another. I am new to spring-boot so, on local system I perform same task and its working fine but on azure micro-services are not communicating with each other. I am unable to establish a connection by using feign client and rest template as the IP and Hostname is dynamic. Please suggest what configuration do I need to make to achieve this task.</p>

<p><strong>What I have done</strong></p>

<p>I have configured eureka with below properties in its application properties:</p>

<pre><code>spring.application.name=eureka.azurewebsites.net

eureka.client.registerWithEureka=false
eureka.client.fetchRegistry=false
eureka.instance.hostname=eureka.azurewebsites.net
eureka.client.serviceUrl.defaultZone=http://${eureka.instance.hostname}:${server.port}/eureka/
</code></pre>

<p>Service1 in azure:</p>

<pre><code>spring.application.name=service1.azurewebsites.net
eureka.client.registerWithEureka=true
eureka.client.serviceUrl.defaultZone=http://eureka.azurewebsites.net/eureka/
</code></pre>

<p>Service 2 in azure:</p>

<pre><code>spring.application.name=service2.azurewebsites.net
eureka.client.registerWithEureka=true
eureka.client.serviceUrl.defaultZone=http://eureka.azurewebsites.net/eureka/
</code></pre>

<p>Now when i try to call rest api from service 1 to another service 2 get unknowhost exception.</p>

<p>Below is the code snippet:</p>

<pre><code>@RestController
@EnableAutoConfiguration
@ComponentScan
@SpringBootApplication
@EnableDiscoveryClient
public class Service2 {
       private static final Logger LOG = LoggerFactory.getLogger(PLMBommsApplication.class);
       @Bean
       @LoadBalanced
       RestTemplate restTemplate() {
             return new RestTemplate();
       }
       @Autowired
       RestTemplate restTemplate;
       @RequestMapping(value = "/")
       public StringBuilder fromCall() throws URISyntaxException {
             StringBuilder response = new StringBuilder();
              URI uri = new URI("http://service1.azurewebsites.net/receiverPOST");
             MultiValueMap&lt;String, Object&gt; mvm = new LinkedMultiValueMap&lt;String, Object&gt;();
             mvm.add("abc", "Hello Part");
             result = restTemplate.postForObject(uri, mvm, String.class);
             response.append("successPost = " + result);
             response.append("\n");
             return response;
             }
       public static void main(String[] args) {
             SpringApplication.run(Service2.class, args);
       } 
</code></pre>