Tagging Systems Manager documents - AWS Systems Manager

Tagging Systems Manager documents

The topics in this section describe how to work with tags on Systems Manager documents (SSM documents).

Creating documents with tags

You can add tags to custom SSM documents at the time you create them.

For information, see the following topics:

Adding tags to existing documents

You can add tags to custom SSM documents that you own by using the Systems Manager console or the command line.

Adding tags to an existing SSM document (console)

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

  2. In the navigation pane, choose Documents.

    -or-

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

  3. Choose the Owned by me tab.

  4. Choose the name of the document to add tags to, and then choose the Details tab.

  5. In the Tags section, choose Edit, and then add one or more key-value tag pairs.

  6. Choose Save.

Adding tags to an existing SSM document (command line)

To add tags to an existing SSM document (command line)
  1. Using your preferred command line tool, run the following command to view the list of documents that you can tag.

    Linux & macOS
    aws ssm list-documents
    Windows
    aws ssm list-documents
    PowerShell
    Get-SSMDocumentList

    Note the name of a document that you want to tag.

  2. Run the following command to tag a document. Replace each example resource placeholder with your own information.

    Linux & macOS
    aws ssm add-tags-to-resource \ --resource-type "Document" \ --resource-id "document-name" \ --tags "Key=tag-key,Value=tag-value"
    Windows
    aws ssm add-tags-to-resource ^ --resource-type "Document" ^ --resource-id "document-name" ^ --tags "Key=tag-key,Value=tag-value"
    PowerShell
    $tag = New-Object Amazon.SimpleSystemsManagement.Model.Tag
    $tag.Key = "tag-key"
    $tag.Value = "tag-value"
    Add-SSMResourceTag ` -ResourceType "Document" ` -ResourceId "document-name" ` -Tag $tag ` -Force

    If successful, the command has no output.

  3. Run the following command to verify the document tags.

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

Removing tags from SSM documents

You can use the Systems Manager console or the command line to remove tags from SSM documents.

Removing tags from SSM documents (console)

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

  2. In the navigation pane, choose Documents.

    -or-

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

  3. Choose the Owned by me tab.

  4. Choose the name of the document to remove tags from, and then choose the Details tab.

  5. In the Tags section, choose Edit, and then choose Remove next to the tag pair you no longer need.

  6. Choose Save.

Removing tags from SSM documents (command line)

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

    Linux & macOS
    aws ssm list-documents
    Windows
    aws ssm list-documents
    PowerShell
    Get-SSMDocumentList

    Note the name of a document from which you want to remove tags.

  2. Run the following command to remove tags from a document. Replace each example resource placeholder with your own information.

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

    If successful, the command has no output.

  3. Run the following command to verify the document tags.

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