Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

[ aws . ssm ]

get-document

Description

Gets the contents of the specified Systems Manager document.

See also: AWS API Documentation

See 'aws help' for descriptions of global parameters.

Synopsis

  get-document
--name <value>
[--version-name <value>]
[--document-version <value>]
[--document-format <value>]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

Options

--name (string)

The name of the Systems Manager document.

--version-name (string)

An optional field specifying the version of the artifact associated with the document. For example, "Release 12, Update 6". This value is unique across all versions of a document, and cannot be changed.

--document-version (string)

The document version for which you want information.

--document-format (string)

Returns the document in the specified format. The document format can be either JSON or YAML. JSON is the default format.

Possible values:

  • YAML
  • JSON

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

See 'aws help' for descriptions of global parameters.

Examples

To get the contents of a document

This example returns the content of a document.

Command:

aws ssm get-document --name "RunShellScript"

Output:

{
  "Content": "{\n   \"schemaVersion\":\"2.0\",\n   \"description\":\"Run a script\",\n   \"parameters\":{\n      \"commands\":{\n         \"type\":\"StringList\",\n         \"description\":\"(Required) Specify a shell script or a command to run.\",\n         \"minItems\":1,\n         \"displayType\":\"textarea\"\n      }\n   },\n   \"mainSteps\":[\n      {\n         \"action\":\"aws:runShellScript\",\n         \"name\":\"runShellScript\",\n         \"inputs\":{\n            \"commands\":\"{{ commands }}\"\n         }\n      },\n      {\n         \"action\":\"aws:runPowerShellScript\",\n         \"name\":\"runPowerShellScript\",\n         \"inputs\":{\n            \"commands\":\"{{ commands }}\"\n         }\n      }\n   ]\n}\n",
  "Name": "RunShellScript.json",
  "DocumentVersion": "1",
  "DocumentType": "Command"
}

To get the contents of a document in YAML format

This example returns the content of a document in YAML format.

Command:

aws ssm get-document --name "RunShellScript" --document-format YAML

Output:

{
  "Name": "A-Document-yaml2",
  "DocumentVersion": "1",
  "Status": "Active",
  "Content": "---\nschemaVersion: '1.2'\ndescription: Run a PowerShell script or specify the paths to scripts to run.\nparameters:\n  commands:\n    type: StringList\n    description: \"(Required) Specify the commands to run or the paths to existing\n      scripts on the instance.\"\n    minItems: 1\n    displayType: textarea\n  workingDirectory:\n    type: String\n    default: ''\n    description: \"(Optional) The path to the working directory on your instance.\"\n    maxChars: 4096\n  executionTimeout:\n    type: String\n    default: '3600'\n    description: \"(Optional) The time in seconds for a command to be completed before\n      it is considered to have failed. Default is 3600 (1 hour). Maximum is 172800\n      (48 hours).\"\n    allowedPattern: \"([1-9][0-9]{0,4})|(1[0-6][0-9]{4})|(17[0-1][0-9]{3})|(172[0-7][0-9]{2})|(172800)\"\nruntimeConfig:\n  aws:runPowerShellScript:\n    properties:\n    - id: 0.aws:runPowerShellScript\n      runCommand: \"{{ commands }}\"\n      workingDirectory: \"{{ workingDirectory }}\"\n      timeoutSeconds: \"{{ executionTimeout }}\"\n",
  "DocumentType": "Command",
  "DocumentFormat": "YAML"
}

Output

Name -> (string)

The name of the Systems Manager document.

VersionName -> (string)

The version of the artifact associated with the document. For example, "Release 12, Update 6". This value is unique across all versions of a document, and cannot be changed.

DocumentVersion -> (string)

The document version.

Status -> (string)

The status of the Systems Manager document, such as Creating , Active , Updating , Failed , and Deleting .

StatusInformation -> (string)

A message returned by AWS Systems Manager that explains the Status value. For example, a Failed status might be explained by the StatusInformation message, "The specified S3 bucket does not exist. Verify that the URL of the S3 bucket is correct."

Content -> (string)

The contents of the Systems Manager document.

DocumentType -> (string)

The document type.

DocumentFormat -> (string)

The document format, either JSON or YAML.

AttachmentsContent -> (list)

A description of the document attachments, including names, locations, sizes, etc.

(structure)

A structure that includes attributes that describe a document attachment.

Name -> (string)

The name of an attachment.

Size -> (long)

The size of an attachment in bytes.

Hash -> (string)

The cryptographic hash value of the document content.

HashType -> (string)

The hash algorithm used to calculate the hash value.

Url -> (string)

The URL location of the attachment content.