Skip to content

Commit

Permalink
health checking the ecs agent to terminate ec2 instances if the agent…
Browse files Browse the repository at this point in the history
… goes down
  • Loading branch information
michaelwittig committed May 3, 2017
1 parent f517bf1 commit 35194e9
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions ecs/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,18 @@ Resources:
- ','
- 'Fn::ImportValue':
!Sub '${ParentVPCStack}-SubnetsPublic'
DefaultTargetGroup: # this is used as the fall-back target group. Services use their own ListenerRules to accept traffic based on path prefixes.
DefaultTargetGroup: # this is used as the fall-back target group and is used to health checking the ECS agent. Services use their own ListenerRules to accept traffic based on path prefixes.
Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
Properties:
Port: 80
HealthCheckIntervalSeconds: 15
HealthCheckPort: 51678
HealthCheckPath: '/'
HealthCheckProtocol: HTTP
HealthCheckTimeoutSeconds: 10
HealthyThresholdCount: 2
Matcher:
HttpCode: '200'
Port: 80 # port 80 is a reserved port that is never used by the agent, so we are safe to use it here
Protocol: HTTP
VpcId:
'Fn::ImportValue': !Sub '${ParentVPCStack}-VPC'
Expand Down Expand Up @@ -787,6 +795,10 @@ Resources:
MinSize: !Ref MinSize
MaxSize: !Ref MaxSize
DesiredCapacity: !Ref DesiredCapacity
HealthCheckGracePeriod: 300
HealthCheckType: ELB
TargetGroupARNs:
- !Ref DefaultTargetGroup
VPCZoneIdentifier: !Split
- ','
- 'Fn::ImportValue':
Expand Down

0 comments on commit 35194e9

Please sign in to comment.