AWS Systems Manager
User Guide

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

Systems Manager Maintenance Windows Tutorials (AWS CLI)

This section includes tutorials that help you learn how to use the AWS Command Line Interface (AWS CLI) to do the following:

  • Create and configure a maintenance window

  • View information about a maintenance window

  • View information about maintenance windows tasks and task executions

  • Update a maintenance window

  • Delete a maintenance window

Complete prerequisites

Before trying these tutorials, complete the following prerequisites.

  • Configure the AWS CLI on your local machine: Before you can run AWS CLI commands, you must install and configure the CLI on your local machine. For information, see Install or Upgrade the AWS CLI.

  • Verify maintenance window roles and permissions: An AWS administrator in your account must grant you the AWS Identity and Access Management (IAM) permissions you need to manage maintenance windows using the CLI. For information, see Controlling Access to Maintenance Windows.

  • Create or configure a Systems Manager-compatible instance: You need at least one Amazon EC2 instance that is configured for use with Systems Manager in order to complete the tutorials. This means that SSM Agent is installed on the instance, and an IAM instance profile for Systems Manager is attached to the instance.

    We recommend launching an instance from one of the following Amazon Machine Image (AMI) types. SSM Agent is preinstalled on each one:

    • Windows Server 2003-2012 R2 AMIs published in November 2016 or later

    • Windows Server 2016 and 2019

    • Amazon Linux

    • Amazon Linux 2

    • Ubuntu Server 16.04

    • Ubuntu Server 18.04

    For information about installing SSM Agent on an instance, see the following topics:

    For information about creating and attaching an IAM instance profile for Systems Manager to your instance, see the following topics:

  • Create additional resources as needed: Many Run Command tasks do not require you to create resources other than those listed in this prerequisites topic. For that reason, we provide a simple Run Command task for you to use your first time through the tutorials. You also need an Amazon EC2 instance that is configured to use with Systems Manager, as described above. After you configure that instance, you can register a simple Run Command task.

    The Systems Manager Maintenance Windows capability supports running four types of tasks:

    • Systems Manager Run Command commands

    • Systems Manager Automation workflows

    • AWS Lambda functions

    • AWS Step Functions tasks

    In general, if a maintenance window task that you want to run requires additional resources, you should create them first. For example, if you want a maintenance window that runs an AWS Lambda function, create the Lambda function before you begin; for a Run Command task, create the S3 bucket that you can save command output to (if you plan to do so); and so on.

Keep track of resource IDs

As you complete the tasks in this AWS CLI tutorial, keep track of resource IDs generated by the commands you run. You use many of these as input for subsequent commands. For example, when you create the maintenance window, the system provides you with a maintenance window ID in this format:

{
   "WindowId":"mw-0c50858d01EXAMPLE"
}

Make a note of the following system-generated IDs because the tutorials in this section use them:

  • WindowId

  • WindowTargetId

  • WindowTaskId

  • WindowExecutionId

  • TaskExecutionId

  • InvocationId

  • ExecutionId

You also need the ID of the Amazon EC2 instance you plan to use in the tutorial. For example: i-02573cafcfEXAMPLE