File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -1204,3 +1204,41 @@ Resources:
1204
1204
# We give instances one hour to respond to this hook else we continue
1205
1205
HeartbeatTimeout : 3600
1206
1206
DefaultResult : CONTINUE
1207
+
1208
+ ShutdownHookAutomation :
1209
+ Type : AWS::SSM::Document
1210
+ Properties :
1211
+ DocumentType : Automation
1212
+ Content :
1213
+ schemaVersion : " 0.3"
1214
+ assumeRole : !GetAtt AutomationRole.Arn
1215
+ description : Stop the buildkite-agent, wait for it to exit, complete the launch lifecycle action
1216
+ parameters :
1217
+ InstanceId :
1218
+ type : String
1219
+ AutoScalingGroupName :
1220
+ type : String
1221
+ default : !Ref AgentAutoScaleGroup
1222
+ LifecycleHook :
1223
+ type : String
1224
+ default : !Ref ShutdownHook
1225
+ mainSteps :
1226
+ - name : RunCommand
1227
+ action : aws:RunCommand
1228
+ inputs :
1229
+ DocumentName : AWS-RunShellScript
1230
+ InstanceIds :
1231
+ - " {{ InstanceId }}"
1232
+ Parameters :
1233
+ executionTimeout : 3600
1234
+ commands :
1235
+ - systemctl stop buildkite-agent
1236
+ - name : CompleteLifecycleAction
1237
+ action : aws:executeAwsApi
1238
+ inputs :
1239
+ Service : autoscaling
1240
+ Api : CompleteLifecycleAction
1241
+ AutoScalingGroupName : " {{ AutoScalingGroupName }}"
1242
+ InstanceId : " {{ InstanceId }}"
1243
+ LifecycleActionResult : " CONTINUE"
1244
+ LifecycleHookName : " {{ LifecycleHook }}"
You can’t perform that action at this time.
0 commit comments