title: How to properly deploy Spring Cloud services to AWS ECS
body: <p>I've spent the last week trying to find a good example on how to properly achieve this but the internet doesn't seem to have anything out there... </p>
  
  <p>I have what I'd say is a pretty basic Spring Cloud service. It includes Eureka, Zuul, Spring Config, and a handful of services. </p>
  
  <p>I've worked out using the <code>esc-cli</code> how I can easily create new tasks based on my <code>docker-compose.yml</code> files. So I have two tasks</p>
  
  <p>A management task which has basic things that at this stage don't need to scale, and having one instance of them is just fine for this project. </p>
  
  <pre><code>version: '2'
  services:
  
    mongo:
      image: mongo
      cpu_shares: 300
      mem_limit: 268435456
      ports:
        - 27017:27017   
  
    config-service:
      image: config-service
      cpu_shares: 300
      mem_limit: 268435456
      ports:
        - 8888:8888
      environment:
        - SPRING_PROFILES_ACTIVE=cloud
  
    edge-service:
      image: edge-service
      cpu_shares: 300
      mem_limit: 268435456
      ports:
        - 80:8080
      environment:
        - SPRING_PROFILES_ACTIVE=cloud
  </code></pre>
  
  <p>My second task has the clients of the above task. </p>
  
  <pre><code>version: '2'
  services:
  
    instance-service:
      image: instance-service
      cpu_shares: 300
      mem_limit: 268435456
      ports:
        - 8081:8081
      environment:
        - SPRING_PROFILES_ACTIVE=cloud
  
    restore-service:
      image: restore-service:latest
      cpu_shares: 300
      mem_limit: 268435456
      ports:
        - 8082:8082
      environment:
        - SPRING_PROFILES_ACTIVE=cloud
  </code></pre>
  
  <p>I can easily create these tasks with a simple command such as <code>ecs-cli compose --file management-task.yml --project-name management-task up</code> No problem there. </p>
  
  <p>Where I hit an issue nothing can reach the <code>Eureka</code> or the <code>Config</code> services, so they all die. I've read all over the place that I can use an application load balance to allow the containers to talk to each other, however I can't actually find any information on <strong>how</strong> to do this.</p>
  
  <p>The closest I've managed to find is a blog post here <a href="http://www.rahulkatte.com/index.html#!/microservice-part-V" rel="nofollow noreferrer">http://www.rahulkatte.com/index.html#!/microservice-part-V</a> however they're not making use of Eureka being inside a task, nor a config server. </p>
  
  <p>So, is there any comprehensive examples out there on how exactly you deploy a modern Spring Cloud app to AWS? Or does anyone have any pointers as to how to get my tasks/containers talking to each other, without just saying "Use a load balancers..."?</p>
  
  <p>Thanks for your time. </p>