-1

I have deployed my service in AWS behind a load balancer

If I point http://subdomain.myservice.com to the DNS name of the AWS load balancer using a CNAME record, I can get my service respond to requests at http://subdomain.myservice.com/8080

But I would like it to work at http://subdomain.myservice.com

I've tried creating a CNAME record that points http://subdomain.myservice.com to the DNS name of the AWS load balancer adding :8080 at the end, but it didn't work.

How can I do that?

This is the Docker-compose file for the service

version: "2"
services:
  api:
    image: my_java_service
    ports:
      - "8080:8080"
    links:
      - mongo
  mongo:
    image: mongo_db
    ports:
      - "27017:27017"
Mike
  • 1,296
  • 2
  • 15
  • 40
  • if you change the line `ports:- "8080:8080"` does it change the port the service listens on? – TZHX Oct 16 '17 at 14:37

1 Answers1

3

Take advantage of your load balancer listening ports. Go into your load balancer listeners tab. Add a new listener on port 80 of the load balancer and have it send to port 8080 of the instance.

With that done your load balancer will listen to the default port 80 at http://subdomain.myservice.com, it will then forward those requests to port 8080 where your docker container resides to handle the request.

Rick Baker
  • 873
  • 11
  • 22