[ 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 | --cli-input-yaml]
[--generate-cli-skeleton <value>]
[--cli-auto-prompt <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 can’t 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

  • TEXT

--cli-input-json | --cli-input-yaml (string) Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, those 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. This may not be specified along with --cli-input-yaml.

--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. Similarly, if provided yaml-input it will print a sample input YAML that can be used with --cli-input-yaml. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

--cli-auto-prompt (boolean) Automatically prompt for CLI input parameters.

See ‘aws help’ for descriptions of global parameters.

Examples

To get document content

The following get-document example displays the content of a Systems Manager document.

aws ssm get-document \
    --name "AWS-RunShellScript"

Output:

{
    "Name": "AWS-RunShellScript",
    "DocumentVersion": "1",
    "Status": "Active",
    "Content": "{\n    \"schemaVersion\":\"1.2\",\n    \"description\":\"Run a shell script or specify the commands to run.\",\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        \"workingDirectory\":{\n            \"type\":\"String\",\n            \"default\":\"\",\n            \"description\":\"(Optional) The path to the working directory on your instance.\",\n            \"maxChars\":4096\n        },\n        \"executionTimeout\":{\n            \"type\":\"String\",\n            \"default\":\"3600\",\n            \"description\":\"(Optional) The time in seconds for a command to complete before it is considered to have failed. Default is 3600 (1 hour). Maximum is 172800 (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)\"\n        }\n    },\n    \"runtimeConfig\":{\n        \"aws:runShellScript\":{\n            \"properties\":[\n                {\n                    \"id\":\"0.aws:runShellScript\",\n                    \"runCommand\":\"{{ commands }}\",\n                    \"workingDirectory\":\"{{ workingDirectory }}\",\n                    \"timeoutSeconds\":\"{{ executionTimeout }}\"\n                }\n            ]\n        }\n    }\n}\n",
    "DocumentType": "Command",
    "DocumentFormat": "JSON"
}

For more information, see AWS Systems Manager Documents in the AWS Systems Manager User Guide.

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.

Requires -> (list)

A list of SSM documents required by a document. For example, an ApplicationConfiguration document requires an ApplicationConfigurationSchema document.

(structure)

An SSM document required by the current document.

Name -> (string)

The name of the required SSM document. The name can be an Amazon Resource Name (ARN).

Version -> (string)

The document version required by the current document.

AttachmentsContent -> (list)

A description of the document attachments, including names, locations, sizes, and so on.

(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.