Create an SSM document (command line) - AWS Systems Manager

Create an SSM document (command line)

After you create the content for your custom AWS Systems Manager (SSM) document, as described in Writing SSM document content, you can use the AWS Command Line Interface (AWS CLI) or AWS Tools for PowerShell to create an SSM document using your content. This is shown in the following command.

Before you begin

Install and configure the AWS CLI or the AWS Tools for PowerShell, if you haven't already. For information, see Install or upgrade AWS command line tools.

Linux & macOS
aws ssm create-document \ --content file://path/to/file/documentContent.json \ --name "document-name" \ --document-type "Command" \ --tags "Key=tag-key,Value=tag-value"
aws ssm create-document ^ --content file://C:\path\to\file\documentContent.json ^ --name "document-name" ^ --document-type "Command" ^ --tags "Key=tag-key,Value=tag-value"
$json = Get-Content -Path "C:\path\to\file\documentContent.json" | Out-String New-SSMDocument ` -Content $json ` -Name "document-name" ` -DocumentType "Command" ` -Tags "Key=tag-key,Value=tag-value"

document-name is the name of the SSM document you want to tag.

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

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

If successful, the command returns a response similar to the following.

      "Tags": [
                "Key": "Purpose",
                "Value": "Test"