Support Automation Workflow (SAW) Runbook: AWSSupport-ManageWindowsService
How can I use the AWSSupport-ManageWindowsService Systems Manager Automation runbook to stop, start, restart, pause, or disable a Windows Service on a target managed Windows instance?
In this article, I will show you how to use the AWSSupport-ManageWindowsService Systems Manager automation runbook to manage the lifecycle of Window Services. This is useful when you want to remotely manage Windows Services on a target Windows managed instance.
How it works?
AWSSupport-ManageWindowsService workflow executes the following three steps:
- Checks that managed instance is Online
- Checks the provided instance's platform is Windows
- Runs the PowerShell script to apply the desired configuration to the Windows service on the target instance
The successful runbook execution output will show you the changes that occurred to the Service status and Service startup type.
If the runbook execution fails, there are the following possible outputs:
- The Service name is invalid.
- Stopping a service with dependencies.
- Invalid Service Action and Startup Type combinations (e.g. starting a service while also trying to keep the service disabled).
- Invalid Actions and Startup Types that are not supported by the service.
Before running the automation make sure your user or the IAM service role has the permissions listed in the Required IAM permissions section.
- Navigate to the Systems Manager console
- In the navigation pane, choose Documents
- In the document search type AWSSupport-ManageWindowsService
- Select AWSSupport-ManageWindowsService document
- Click on Execute automation
- For the input parameters enter the following:
- InstanceId (required): This is the ID of the managed instance.
- ServiceAction (required): An action you want to apply to the Windows service. Default value: Check. Note that you can use Force-Restart and Force-Stop to restart and to stop a service that has dependent services. Valid values: Check | Restart | Force-Restart | Start | Stop | Force-Stop | Pause.
- StartupType (required): A startup type you will apply to the Windows service. Default value: Check. Valid values: Check | Auto | Demand | Disabled | DelayedAutoStart.
- WindowsServiceName (required): A valid Windows service name.
- AutomationAssumeRole (optional): This is the Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that allows Systems Manager Automation to perform the actions on your behalf. If no role is specified, Systems Manager Automation will use the permissions of the user that starts this runbook.
The following example demonstrates how to use the AWSSupport-ManageWindowsService automation runbook in order to restart Windows Time service (W32Time).
- Click on Execute
- You should see that the automation has been initiated
- Once completed, you can review the Outputs section for the detailed results of the execution
In this article, I have shown how to manage (stop, start, restart, pause, or disable ) any Windows service on the target instance by using the SAW runbook AWSSupport-ManageWindowsService, available in System Manager.
Systems Manager Automation
Running a simple automation: https://docs.aws.amazon.com/systems-manager/latest/userguide/automation-working-executing.html
Setting up Automation: https://docs.aws.amazon.com/systems-manager/latest/userguide/automation-setup.html
Documentation related to the AWS service
For more information how to run this runbook, please see the AWS public document: AWSSupport-ManageWindowsService.
To help you troubleshoot, remediate, manage, and reduce costs on your AWS resources, AWS Support maintains a subset of the AWS provided predefined runbooks . These runbooks are prefixed with “AWSSupport-“ or “AWSPremiumSupport-“.