Skip to content

Commit bd9b774

Browse files
committed
Add windows support for ssm automations
1 parent 624ea72 commit bd9b774

File tree

1 file changed

+47
-21
lines changed

1 file changed

+47
-21
lines changed

templates/aws-stack.yml

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,9 @@ Resources:
11611161
Resource: "*"
11621162
- Effect: Allow
11631163
Action: ssm:SendCommand
1164-
Resource: !Sub arn:${AWS::Partition}:ssm:${AWS::Region}::document/AWS-RunShellScript
1164+
Resource:
1165+
- !Sub arn:${AWS::Partition}:ssm:${AWS::Region}::document/AWS-RunShellScript
1166+
- !Sub arn:${AWS::Partition}:ssm:${AWS::Region}::document/AWS-RunPowerShellScript
11651167
- Effect: Allow
11661168
Action: ssm:SendCommand
11671169
Resource: !Sub arn:${AWS::Partition}:ec2:${AWS::Region}:${AWS::AccountId}:instance/*
@@ -1226,16 +1228,28 @@ Resources:
12261228
type: String
12271229
default: !Ref BootHook
12281230
mainSteps:
1229-
- name: RunCommand
1230-
action: aws:runCommand
1231-
inputs:
1232-
DocumentName: AWS-RunShellScript
1233-
InstanceIds:
1234-
- "{{ InstanceId }}"
1235-
Parameters:
1236-
executionTimeout: "300"
1237-
commands:
1238-
- systemctl start buildkite-agent
1231+
- !If
1232+
- UseLinuxAgents
1233+
- name: RunCommand
1234+
action: aws:runCommand
1235+
inputs:
1236+
DocumentName: AWS-RunShellScript
1237+
InstanceIds:
1238+
- "{{ InstanceId }}"
1239+
Parameters:
1240+
executionTimeout: "300"
1241+
commands:
1242+
- systemctl start buildkite-agent
1243+
- name: RunCommand
1244+
action: aws:runCommand
1245+
inputs:
1246+
DocumentName: AWS-RunPowerShellScript
1247+
InstanceIds:
1248+
- "{{ InstanceId }}"
1249+
Parameters:
1250+
executionTimeout: "300"
1251+
commands:
1252+
- nssm start buildkite-agent
12391253
- name: CompleteLifecycleAction
12401254
action: aws:executeAwsApi
12411255
inputs:
@@ -1294,16 +1308,28 @@ Resources:
12941308
type: String
12951309
default: !Ref ShutdownHook
12961310
mainSteps:
1297-
- name: RunCommand
1298-
action: aws:runCommand
1299-
inputs:
1300-
DocumentName: AWS-RunShellScript
1301-
InstanceIds:
1302-
- "{{ InstanceId }}"
1303-
Parameters:
1304-
executionTimeout: "3600"
1305-
commands:
1306-
- systemctl stop buildkite-agent
1311+
- !If
1312+
- UseLinuxAgents
1313+
- name: RunCommand
1314+
action: aws:runCommand
1315+
inputs:
1316+
DocumentName: AWS-RunShellScript
1317+
InstanceIds:
1318+
- "{{ InstanceId }}"
1319+
Parameters:
1320+
executionTimeout: "3600"
1321+
commands:
1322+
- systemctl stop buildkite-agent
1323+
- name: RunCommand
1324+
action: aws:runCommand
1325+
inputs:
1326+
DocumentName: AWS-RunPowerShellScript
1327+
InstanceIds:
1328+
- "{{ InstanceId }}"
1329+
Parameters:
1330+
executionTimeout: "3600"
1331+
commands:
1332+
- nssm stop buildkite-agent
13071333
- name: CompleteLifecycleAction
13081334
action: aws:executeAwsApi
13091335
inputs:

0 commit comments

Comments
 (0)