I have created classical load balancer in Amazon Web Services and I have given the listener port as 9090. And I have associated the load balancer with a cluster with 2 EC2 instances. I have given the inbound rules for the instances for 9090 as well.
And in order to create a service in the cluster I have created a task definition as follows.
{
"family": “my-spring-task“,
"containerDefinitions": [{
"image": “my-docker-group/my-spring-app“,
"name": "my-spring-app",
"cpu": 10,
"memory": 256,
"essential": true,
"portMappings": [{
"containerPort": 9090,
"hostPort": 9090
}]
}]
}
Then I create the service, with the above task definition given.
aws ecs register-task-definition --cli-input-json file://service90-task.json
aws ecs create-service --cluster service90-cluster --service-name service90-service --load-balancers loadBalancerName=service90-load-balancer,containerName=my-spring-app,containerPort=9090 --task-definition service90-task --role ecs-service-role --desired-count 0
My plan is to run a Spring Boot project, which is build with gradle and docker plugin.
I have the project running port 8080. And it is working as expected. But when I try to run a service on port 9090 it doesn't work due to the failing of the health check.
I need advice as to how to make the port to 9090. or any port number.