Skip to main content

documents

Creates, updates, deletes or gets a document resource or lists documents in a region

Overview

Namedocuments
TypeResource
DescriptionThe AWS::SSM::Document resource is an SSM document in AWS Systems Manager that defines the actions that Systems Manager performs, which can be used to set up and run commands on your instances.
Idaws.ssm.documents

Fields

NameDatatypeDescription
contentobjectThe content for the Systems Manager document in JSON, YAML or String format.
attachmentsarrayA list of key and value pairs that describe attachments to a version of a document.
namestringA name for the Systems Manager document.
version_namestringAn optional field specifying the version of the artifact you are creating with the document. This value is unique across all versions of a document, and cannot be changed.
document_typestringThe type of document to create.
document_formatstringSpecify the document format for the request. The document format can be either JSON or YAML. JSON is the default format.
target_typestringSpecify a target type to define the kinds of resources the document can run on.
tagsarrayOptional metadata that you assign to a resource. Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment.
requiresarrayA list of SSM documents required by a document. For example, an ApplicationConfiguration document requires an ApplicationConfigurationSchema document.
update_methodstringUpdate method - when set to 'Replace', the update will replace the existing document; when set to 'NewVersion', the update will create a new version.
regionstringAWS region.

Methods

NameAccessible byRequired Params
create_resourceINSERTContent, region
delete_resourceDELETEdata__Identifier, region
update_resourceUPDATEdata__Identifier, data__PatchDocument, region
list_resourcesSELECTregion
get_resourceSELECTdata__Identifier, region

SELECT examples

Gets all documents in a region.

SELECT
region,
content,
attachments,
name,
version_name,
document_type,
document_format,
target_type,
tags,
requires,
update_method
FROM aws.ssm.documents
WHERE region = 'us-east-1';

Gets all properties from an individual document.

SELECT
region,
content,
attachments,
name,
version_name,
document_type,
document_format,
target_type,
tags,
requires,
update_method
FROM aws.ssm.documents
WHERE region = 'us-east-1' AND data__Identifier = '<Name>';

INSERT example

Use the following StackQL query and manifest file to create a new document resource, using stack-deploy.

/*+ create */
INSERT INTO aws.ssm.documents (
Content,
region
)
SELECT
'{{ Content }}',
'{{ region }}';

DELETE example

/*+ delete */
DELETE FROM aws.ssm.documents
WHERE data__Identifier = '<Name>'
AND region = 'us-east-1';

Permissions

To operate on the documents resource, the following permissions are required:

Create

ssm:CreateDocument,
ssm:GetDocument,
ssm:AddTagsToResource,
ssm:ListTagsForResource,
s3:GetObject,
iam:PassRole

Read

ssm:GetDocument,
ssm:ListTagsForResource

Update

ssm:UpdateDocument,
s3:GetObject,
ssm:AddTagsToResource,
ssm:RemoveTagsFromResource,
ssm:ListTagsForResource,
iam:PassRole,
ssm:UpdateDocumentDefaultVersion,
ssm:DescribeDocument

Delete

ssm:DeleteDocument,
ssm:GetDocument

List

ssm:ListDocuments