Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuring Load Balancing #11

Open
amlwwalker opened this issue May 22, 2017 · 1 comment
Open

Configuring Load Balancing #11

amlwwalker opened this issue May 22, 2017 · 1 comment

Comments

@amlwwalker
Copy link

I've been using nginx-proxy for a while now, and came across this when wanting to move off vanilla ec2 and over to ecs.
I've got it to a point where if I go directly to one of the 2 instances I am creating when I create a cluster (not both), I get the 'nginx is working' page. I have been writing down my understanding as following along, so will paste here:

First make a cluster

The name comes from the ecs config when you run ecs-cli configure...

ecs-cli up --keypair cluster-pair --capability-iam --size 2 --instance-type t2.small --force
Then we register the task that handles the proxy
aws ecs register-task-definition --cli-input-json file://./examples/task.json
Next we create a service, and connect up to the load balancer

(You need to have already created a load balancer)

aws ecs create-service --cluster ClusterName --role ecsServiceRole --load-balancers loadBalancerName=ECSLB,containerName=ecs-nginx-proxy,containerPort=80 --cli-input-json file://./examples/service.json

This tells the service that it should be accessible on port 80, the container is the ecs-nginx-proxy container, and the details are in service.json.

However when I configure the load balancer, and point it at my two instances that were created due to the above, going to its DNS address I get nothing back. Its only if I go directly to one of the instances.

Am I right in thinking that both sample_task and task are running on both instances and the load balancer is supposed to point to both instances?
Thanks

@codesuki
Copy link
Owner

codesuki commented May 23, 2017

The service will register itself with the load balancer (adds listeners). Normally you don't need to change it's settings if I remember correctly. The load balancer needs the correct security privileges, i.e. access to the ECS instances.

In my case I run the service with "desiredCount": 1, so there is only one container with the ecs-nginx-proxy but you could increase that number and all the containers will register themselves with the load balancer.

If that doesn't help, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants