forked from buildkite/elastic-ci-stack-for-aws
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathautoscale.yml
63 lines (58 loc) · 1.75 KB
/
autoscale.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Resources:
MissingMetricsAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
MetricName: ScheduledJobsCount
Namespace: Buildkite
Statistic: SampleCount
Period: 300
EvaluationPeriods: 1
Threshold: 0
Dimensions:
- Name: Queue
Value: $(BuildkiteQueue)
ComparisonOperator: LessThanOrEqualToThreshold
AgentScaleUpPolicy:
Type: AWS::AutoScaling::ScalingPolicy
Properties:
AdjustmentType: ChangeInCapacity
AutoScalingGroupName: $(AgentAutoScaleGroup)
Cooldown: 120
ScalingAdjustment : $(ScaleUpAdjustment)
AgentScaleDownPolicy:
Type: AWS::AutoScaling::ScalingPolicy
Properties:
AdjustmentType: ChangeInCapacity
AutoScalingGroupName: $(AgentAutoScaleGroup)
Cooldown : 60
ScalingAdjustment: $(ScaleDownAdjustment)
AgentUtilizationAlarmHigh:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmDescription: Scale-up if ScheduledJobs > 0 for 1 minute
MetricName: ScheduledJobsCount
Namespace: Buildkite
Statistic: Maximum
Period: 60
EvaluationPeriods: 1
Threshold: 0
AlarmActions: [ $(AgentScaleUpPolicy) ]
Dimensions:
- Name: Queue
Value: $(BuildkiteQueue)
ComparisonOperator: GreaterThanThreshold
AgentUtilizationAlarmLow:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmDescription: Scale-down if UnfinishedJobs == 0 for 30 minutes
MetricName: UnfinishedJobsCount
Namespace: Buildkite
Statistic: Maximum
Period: 300
EvaluationPeriods: 6
Threshold: 0
AlarmActions: [ $(AgentScaleDownPolicy) ]
Dimensions:
- Name: Queue
Value: $(BuildkiteQueue)
ComparisonOperator: LessThanOrEqualToThreshold