Skip to content

Commit edbe4e8

Browse files
authored
Merge pull request #10 from kepler442b/master
ECS image cleanup
2 parents b3469c7 + 53681a0 commit edbe4e8

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

ecs.cfndsl.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
az_conditions_resources('SubnetCompute', maximum_availability_zones)
66

77
asg_ecs_tags = []
8-
asg_ecs_tags << { Key: 'Name', Value: FnJoin('-', [ Ref(:EnvironmentName), component_name, '-xx' ]), PropagateAtLaunch: true }
8+
asg_ecs_tags << { Key: 'Name', Value: FnJoin('-', [ Ref(:EnvironmentName), component_name, 'xx' ]), PropagateAtLaunch: true }
99
asg_ecs_tags << { Key: 'Environment', Value: Ref(:EnvironmentName), PropagateAtLaunch: true}
1010
asg_ecs_tags << { Key: 'EnvironmentType', Value: Ref(:EnvironmentType), PropagateAtLaunch: true }
1111
asg_ecs_tags << { Key: 'Role', Value: "ecs", PropagateAtLaunch: true }
@@ -82,6 +82,11 @@
8282
user_data << ".amazonaws.com:/ /efs\n"
8383
end
8484

85+
ecs_agent_extra_config.each do |key, value|
86+
user_data << "echo #{key}=#{value}"
87+
user_data << " >> /etc/ecs/ecs.config\n"
88+
end if defined? ecs_agent_extra_config
89+
8590
volumes = []
8691
volumes << {
8792
DeviceName: '/dev/xvda',
@@ -103,11 +108,7 @@
103108

104109

105110
AutoScalingGroup('AutoScaleGroup') do
106-
UpdatePolicy('AutoScalingRollingUpdate', {
107-
"MinInstancesInService" => "0",
108-
"MaxBatchSize" => "1",
109-
"SuspendProcesses" => ["HealthCheck","ReplaceUnhealthy","AZRebalance","AlarmNotification","ScheduledActions"]
110-
})
111+
UpdatePolicy(asg_update_policy.keys[0], asg_update_policy.values[0]) if defined? asg_update_policy
111112
LaunchConfigurationName Ref('LaunchConfig')
112113
HealthCheckGracePeriod '500'
113114
MinSize Ref('AsgMin')

ecs.config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ maximum_availability_zones: 5
66
# ecs_extra_tags:
77
# Name: Value
88

9+
# ecs_agent_extra_config:
10+
# ECS_ENGINE_TASK_CLEANUP_WAIT_DURATION: 10m
11+
# ECS_IMAGE_CLEANUP_INTERVAL: 10m
12+
# ECS_IMAGE_MINIMUM_CLEANUP_AGE: 5m
13+
14+
# asg_update_policy:
15+
# AutoScalingRollingUpdate:
16+
# MaxBatchSize: 1
17+
# MinInstancesInService: 1
18+
# SuspendProcesses: ["HealthCheck","ReplaceUnhealthy","AZRebalance","AlarmNotification","ScheduledActions"]
919

1020
# volume_size: 20
1121

0 commit comments

Comments
 (0)