Skip to main content

documents

Creates, updates, deletes, gets or lists a documents resource.

Overview

Namedocuments
TypeResource
Idaws.ssm.documents

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
approved_versionstringThe version of the document currently approved for use in the organization. (pattern: <code>([$]LATEST|[$]DEFAULT|^[1-9][0-9]*$)</code>)
attachments_informationarrayDetails about the document attachments, including names, locations, sizes, and so on.
authorstringThe user in your organization who created the document.
categoryarrayThe classification of a document to help you identify and categorize its use.
category_enumarrayThe value that identifies a document's category.
created_datestring (date-time)The date when the document was created.
default_versionstringThe default version. (pattern: <code>([$]LATEST|[$]DEFAULT|^[1-9][0-9]*$)</code>)
descriptionstringA description of the document.
display_namestringThe 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. (pattern: <code>^[\w.-:/ ]*$</code>)
document_formatstringThe document format, either JSON or YAML. (YAML, JSON, TEXT)
document_typestringThe type of document. (Command, Policy, Automation, Session, Package, ApplicationConfiguration, ApplicationConfigurationSchema, DeploymentStrategy, ChangeCalendar, Automation.ChangeTemplate, ProblemAnalysis, ProblemAnalysisTemplate, CloudFormation, ConformancePackTemplate, QuickSetup, ManualApprovalPolicy, AutoApprovalPolicy)
document_versionstringThe document version. (pattern: <code>([$]LATEST|[$]DEFAULT|^[1-9][0-9]*$)</code>)
hashstringThe Sha256 or Sha1 hash created by the system when the document was created. Sha1 hashes have been deprecated.
hash_typestringThe hash type of the document. Valid values include Sha256 or Sha1. Sha1 hashes have been deprecated. (Sha256, Sha1)
latest_versionstringThe latest version of the document. (pattern: <code>([$]LATEST|[$]DEFAULT|^[1-9][0-9]*$)</code>)
namestringThe name of the SSM document. (pattern: <code>^[a-zA-Z0-9_-.:/]{3,128}$</code>)
ownerstringThe Amazon Web Services user that created the document.
parametersarrayA description of the parameters for a document.
pending_review_versionstringThe version of the document that is currently under review. (pattern: <code>([$]LATEST|[$]DEFAULT|^[1-9][0-9]*$)</code>)
platform_typesarrayThe list of operating system (OS) platforms compatible with this SSM document.
requiresarrayA list of SSM documents required by a document. For example, an ApplicationConfiguration document requires an ApplicationConfigurationSchema document.
review_informationarrayDetails about the review of a document.
review_statusstringThe current status of the review. (APPROVED, NOT_REVIEWED, PENDING, REJECTED)
schema_versionstringThe schema version. (pattern: <code>([0-9]+).([0-9]+)</code>)
sha_1stringThe SHA1 hash of the document, which you can use for verification.
statusstringThe status of the SSM document. (Creating, Active, Updating, Deleting, Failed)
status_informationstringA message returned by Amazon Web Services 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."
tagsarrayThe tags, or metadata, that have been applied to the document.
target_typestringThe target type which defines the kinds of resources the document can run on. For example, /AWS::EC2::Instance. For a list of valid resource types, see Amazon Web Services resource and property types reference in the CloudFormation User Guide. (pattern: <code>^/[\w.-:/]*$</code>)
version_namestringThe version of the artifact associated with the document. (pattern: <code>^[a-zA-Z0-9_-.]{1,128}$</code>)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_documentselectregionDescribes the specified Amazon Web Services Systems Manager document (SSM document).
create_documentinsertregionCreates a Amazon Web Services Systems Manager (SSM document). An SSM document defines the actions that Systems Manager performs on your managed nodes. For more information about SSM documents, including information about supported schemas, features, and syntax, see Amazon Web Services Systems Manager Documents in the Amazon Web Services Systems Manager User Guide.
update_document_default_versionupdateregion, DocumentVersionSet the default version of a document. If you change a document version for a State Manager association, Systems Manager immediately runs the association unless you previously specifed the apply-only-at-cron-interval parameter.
update_document_metadataupdateregion, DocumentReviewsAmazon Web Services Systems Manager Change Manager is no longer open to new customers. Existing customers can continue to use the service as normal. For more information, see Amazon Web Services Systems Manager Change Manager availability change. Updates information related to approval reviews for a specific version of a change template in Change Manager.
update_documentupdateregionUpdates one or more values for an SSM document.
delete_documentdeleteregionDeletes the Amazon Web Services Systems Manager document (SSM document) and all managed node associations to the document. Before you delete the document, we recommend that you use DeleteAssociation to disassociate all managed nodes that are associated with the document.
get_documentexecregionGets the contents of the specified Amazon Web Services Systems Manager document (SSM document).
list_documentsexecregionReturns all Systems Manager (SSM) documents in the current Amazon Web Services account and Amazon Web Services Region. You can limit the results of this request by using a filter.
start_change_request_executionexecregion, DocumentName, RunbooksAmazon Web Services Systems Manager Change Manager is no longer open to new customers. Existing customers can continue to use the service as normal. For more information, see Amazon Web Services Systems Manager Change Manager availability change. Creates a change request for Change Manager. The Automation runbooks specified in the change request run only after all required approvals for the change request have been received.
start_execution_previewexecregion, DocumentNameInitiates the process of creating a preview showing the effects that running a specified Automation runbook would have on the targeted resources.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Describes the specified Amazon Web Services Systems Manager document (SSM document).

SELECT
approved_version,
attachments_information,
author,
category,
category_enum,
created_date,
default_version,
description,
display_name,
document_format,
document_type,
document_version,
hash,
hash_type,
latest_version,
name,
owner,
parameters,
pending_review_version,
platform_types,
requires,
review_information,
review_status,
schema_version,
sha_1,
status,
status_information,
tags,
target_type,
version_name
FROM aws.ssm.documents
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a Amazon Web Services Systems Manager (SSM document). An SSM document defines the actions that Systems Manager performs on your managed nodes. For more information about SSM documents, including information about supported schemas, features, and syntax, see Amazon Web Services Systems Manager Documents in the Amazon Web Services Systems Manager User Guide.

INSERT INTO aws.ssm.documents (
Content,
Requires,
Attachments,
Name,
DisplayName,
VersionName,
DocumentType,
DocumentFormat,
TargetType,
Tags,
region
)
SELECT
'{{ Content }}',
'{{ Requires }}',
'{{ Attachments }}',
'{{ Name }}',
'{{ DisplayName }}',
'{{ VersionName }}',
'{{ DocumentType }}',
'{{ DocumentFormat }}',
'{{ TargetType }}',
'{{ Tags }}',
'{{ region }}'
RETURNING
document_description
;

UPDATE examples

Set the default version of a document. If you change a document version for a State Manager association, Systems Manager immediately runs the association unless you previously specifed the apply-only-at-cron-interval parameter.

UPDATE aws.ssm.documents
SET
Name = '{{ Name }}',
DocumentVersion = '{{ DocumentVersion }}'
WHERE
region = '{{ region }}' --required
AND DocumentVersion = '{{ DocumentVersion }}' --required
RETURNING
description;

DELETE examples

Deletes the Amazon Web Services Systems Manager document (SSM document) and all managed node associations to the document. Before you delete the document, we recommend that you use DeleteAssociation to disassociate all managed nodes that are associated with the document.

DELETE FROM aws.ssm.documents
WHERE region = '{{ region }}' --required
;

Lifecycle Methods

Gets the contents of the specified Amazon Web Services Systems Manager document (SSM document).

EXEC aws.ssm.documents.get_document
@region='{{ region }}' --required
@@json=
'{
"Name": "{{ Name }}",
"VersionName": "{{ VersionName }}",
"DocumentVersion": "{{ DocumentVersion }}",
"DocumentFormat": "{{ DocumentFormat }}"
}'
;