GetDocument - AWS Systems Manager

GetDocument

Gets the contents of the specified AWS Systems Manager document (SSM document).

Request Syntax

{ "DocumentFormat": "string", "DocumentVersion": "string", "Name": "string", "VersionName": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

DocumentFormat

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

Type: String

Valid Values: YAML | JSON | TEXT

Required: No

DocumentVersion

The document version for which you want information.

Type: String

Pattern: ([$]LATEST|[$]DEFAULT|^[1-9][0-9]*$)

Required: No

Name

The name of the SSM document.

Type: String

Pattern: ^[a-zA-Z0-9_\-.:/]{3,128}$

Required: Yes

VersionName

An optional field specifying the version of the artifact associated with the document. For example, 12.6. This value is unique across all versions of a document and can't be changed.

Type: String

Pattern: ^[a-zA-Z0-9_\-.]{1,128}$

Required: No

Response Syntax

{ "AttachmentsContent": [ { "Hash": "string", "HashType": "string", "Name": "string", "Size": number, "Url": "string" } ], "Content": "string", "CreatedDate": number, "DisplayName": "string", "DocumentFormat": "string", "DocumentType": "string", "DocumentVersion": "string", "Name": "string", "Requires": [ { "Name": "string", "RequireType": "string", "Version": "string", "VersionName": "string" } ], "ReviewStatus": "string", "Status": "string", "StatusInformation": "string", "VersionName": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

AttachmentsContent

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

Type: Array of AttachmentContent objects

Content

The contents of the SSM document.

Type: String

Length Constraints: Minimum length of 1.

CreatedDate

The date the SSM document was created.

Type: Timestamp

DisplayName

The friendly name of the SSM document. This value can differ for each version of the document. If you want to update this value, see UpdateDocument.

Type: String

Length Constraints: Maximum length of 1024.

Pattern: ^[\w\.\-\:\/ ]*$

DocumentFormat

The document format, either JSON or YAML.

Type: String

Valid Values: YAML | JSON | TEXT

DocumentType

The document type.

Type: String

Valid Values: Command | Policy | Automation | Session | Package | ApplicationConfiguration | ApplicationConfigurationSchema | DeploymentStrategy | ChangeCalendar | Automation.ChangeTemplate | ProblemAnalysis | ProblemAnalysisTemplate | CloudFormation | ConformancePackTemplate | QuickSetup

DocumentVersion

The document version.

Type: String

Pattern: ([$]LATEST|[$]DEFAULT|^[1-9][0-9]*$)

Name

The name of the SSM document.

Type: String

Pattern: ^[a-zA-Z0-9_\-.:/]{3,128}$

Requires

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

Type: Array of DocumentRequires objects

Array Members: Minimum number of 1 item.

ReviewStatus

The current review status of a new custom Systems Manager document (SSM document) created by a member of your organization, or of the latest version of an existing SSM document.

Only one version of an SSM document can be in the APPROVED state at a time. When a new version is approved, the status of the previous version changes to REJECTED.

Only one version of an SSM document can be in review, or PENDING, at a time.

Type: String

Valid Values: APPROVED | NOT_REVIEWED | PENDING | REJECTED

Status

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

Type: String

Valid Values: Creating | Active | Updating | Deleting | Failed

StatusInformation

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 doesn't exist. Verify that the URL of the S3 bucket is correct."

Type: String

VersionName

The version of the artifact associated with the document. For example, 12.6. This value is unique across all versions of a document, and can't be changed.

Type: String

Pattern: ^[a-zA-Z0-9_\-.]{1,128}$

Errors

For information about the errors that are common to all actions, see Common Errors.

InternalServerError

An error occurred on the server side.

HTTP Status Code: 500

InvalidDocument

The specified SSM document doesn't exist.

HTTP Status Code: 400

InvalidDocumentVersion

The document version isn't valid or doesn't exist.

HTTP Status Code: 400

Examples

Example

This example illustrates one usage of GetDocument.

Sample Request

POST / HTTP/1.1 Host: ssm.us-east-2.amazonaws.com Accept-Encoding: identity X-Amz-Target: AmazonSSM.GetDocument Content-Type: application/x-amz-json-1.1 User-Agent: aws-cli/1.17.12 Python/3.6.8 Darwin/18.7.0 botocore/1.14.12 X-Amz-Date: 20240324T190721Z Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20240324/us-east-2/ssm/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=39c3b3042cd2aEXAMPLE Content-Length: 30 { "Name": "AWS-UpdateSSMAgent" }

Sample Response

{ "Content":"{\n \"schemaVersion\": \"1.2\",\n \"description\": \"Update the Amazon SSM Agent to the latest version or specified version.\",--truncated--n", "DocumentFormat":"JSON", "DocumentType":"Command", "DocumentVersion":"1", "Name":"AWS-UpdateSSMAgent", "Status":"Active" }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: