Tagging maintenance windows - AWS Systems Manager

Tagging maintenance windows

The topics in this section describe how to work with tags on maintenance windows.

Creating maintenance windows with tags

You can add tags to maintenance windows at the time you create them.

For information, see the following topics:

Adding tags to existing maintenance windows

You can add tags to maintenance windows that you own by using the AWS Systems Manager console or the command line.

Adding tags to an existing maintenance window (console)

  1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems-manager/.

  2. In the navigation pane, choose Maintenance Windows.

    -or-

    If the AWS Systems Manager home page opens first, choose the menu icon ( ) to open the navigation pane, and then choose Maintenance Windows.

  3. Choose the name of a maintenance window you have already created, and then choose the Tags tabs.

  4. Choose Edit tags, and then choose Add tag.

  5. For Key, enter a key for the tag, such as Environment.

  6. For Value, enter a value for the tag, such as Test.

  7. Choose Save changes.

Adding tags to an existing maintenance window (AWS CLI)

  1. Using your preferred command line tool, run the following command to view the list of maintenance windows that you can tag.

    aws ssm describe-maintenance-windows

    Note the ID of a maintenance window that you want to tag.

  2. Run the following command to tag a maintenance window.

    Linux & macOS
    aws ssm add-tags-to-resource \ --resource-type "MaintenanceWindow" \ --resource-id "window-id" \ --tags "Key=tag-key,Value=tag-value"
    Windows
    aws ssm add-tags-to-resource ^ --resource-type "MaintenanceWindow" ^ --resource-id "window-id" ^ --tags "Key=tag-key,Value=tag-value"

    If successful, the command has no output.

    windows-id is the ID of the maintenance window you want to tag, such as mw-0c50858d01EXAMPLE.

    tag-key is the name of a custom key you supply. For example, Environment or Project.

    tag-value is the custom content for the value you want to supply for that key. For example, Production or Q321.

  3. Run the following command to verify the maintenance window tags.

    Linux & macOS
    aws ssm list-tags-for-resource \ --resource-type "MaintenanceWindow" \ --resource-id "window-id"
    Windows
    aws ssm list-tags-for-resource ^ --resource-type "MaintenanceWindow" ^ --resource-id "window-id"

Tag a maintenance window (AWS Tools for PowerShell)

  1. Run the following command to list maintenance windows that you can tag.

    Get-SSMMaintenanceWindow
  2. Run the following commands to tag a maintenance window.

    $tag = New-Object Amazon.SimpleSystemsManagement.Model.Tag
    $tag.Key = "tag-key"
    $tag.Value = "tag-value"
    Add-SSMResourceTag ` -ResourceType "MaintenanceWindow" ` -ResourceId "window-id" ` -Tag $tag

    window-id the ID of the maintenance window you want to tag.

    tag-key is the name of a custom key you supply. For example, Environment or Project.

    tag-value is the custom content for the value you want to supply for that key. For example, Production or Q321.

  3. Run the following command to verify the maintenance window tags.

    Get-SSMResourceTag ` -ResourceType "MaintenanceWindow" ` -ResourceId "window-id"

Removing tags from maintenance windows

You can use the Systems Manager console or the command line to remove tags from maintenance windows.

Removing tags from maintenance windows (console)

  1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems-manager/.

  2. In the navigation pane, choose Maintenance Windows.

    -or-

    If the AWS Systems Manager home page opens first, choose the menu icon ( ) to open the navigation pane, and then choose Maintenance Windows.

  3. Choose the name of the maintenance window to remove tags from, and then choose Tags tab.

  4. Choose Edit tags, and then choose Remove tag next to the tag pair you no longer need.

  5. Choose Save changes.

Removing tags from maintenance windows (command line)

  1. Using your preferred command line tool, run the following command to list the maintenance windows in your account.

    Linux & macOS
    aws ssm describe-maintenance-windows
    Windows
    aws ssm describe-maintenance-windows
    PowerShell
    Get-SSMMaintenanceWindows

    Note the ID of a maintenance window from which you want to remove tags.

  2. Run the following command to remove tags from a maintenance window.

    Linux & macOS
    aws ssm remove-tags-from-resource \ --resource-type "MaintenanceWindow" \ --resource-id "window-id" \ --tag-key "tag-key"
    Windows
    aws ssm remove-tags-from-resource ^ --resource-type "MaintenanceWindow" ^ --resource-id "window-id" ^ --tag-key "tag-key"
    PowerShell
    Remove-SSMResourceTag ` -ResourceType "MaintenanceWindow" ` -ResourceId "window-id" ` -TagKey "tag-key

    windows-id is the ID of the maintenance window from which you want to remove a tag, such as mw-0c50858d01EXAMPLE.

    tag-key is the name of a key assigned to the maintenance window. For example, Environment or Quarter.

    If successful, the command has no output.

  3. Run the following command to verify the maintenance window tags.

    Linux & macOS
    aws ssm list-tags-for-resource \ --resource-type "MaintenanceWindow" \ --resource-id "window-id"
    Windows
    aws ssm list-tags-for-resource ^ --resource-type "MaintenanceWindow" ^ --resource-id "window-id"
    PowerShell
    Get-SSMResourceTag ` -ResourceType "MaintenanceWindow" ` -ResourceId "window-id"