- associate ECS service to load balancer
- define target group for load balancer
- running tasks of this ECS service become targets of this target group
#cloudformation template snippet
Service:
Type: "AWS::ECS::Service"
Properties:
Cluster: !FindInMap [BuildEnvironment, !Ref 'EnvironmentType', "cluster"]
DesiredCount: !FindInMap [BuildEnvironment, !Ref 'EnvironmentType', "desire"]
LoadBalancers:
- ContainerName: !Sub "${EnvironmentType}-${APP}"
ContainerPort: 80
TargetGroupArn: my_target_group_arn
See targets in a target group
- Go to EC2
- In left side, under Load Balancing. Click Target Groups link
- Search target group by name. Click that target group
- In Registered targets section, see targets. They are running tasks. Find port
- Go to a task. Check the Network bindings for the task to find port. These ports are matched.
No comments:
Post a Comment