Use ListDocuments
with an Amazon SDK or CLI
The following code examples show how to use ListDocuments
.
- CLI
-
- Amazon CLI
-
Example 1: To list documents
The following
list-documents
example lists documents owned by the requesting account tagged with the custom tag.aws ssm list-documents \ --filters
Key=Owner,Values=Self
Key=tag:DocUse,Values=Testing
Output:
{ "DocumentIdentifiers": [ { "Name": "Example", "Owner": "29884EXAMPLE", "PlatformTypes": [ "Windows", "Linux" ], "DocumentVersion": "1", "DocumentType": "Automation", "SchemaVersion": "0.3", "DocumentFormat": "YAML", "Tags": [ { "Key": "DocUse", "Value": "Testing" } ] } ] }
For more information, see Amazon Systems Manager Documents
in the Amazon Systems Manager User Guide. Example 2: To list shared documents
The following
list-documents
example lists shared documents, including private shared documents not owned by Amazon.aws ssm list-documents \ --filters
Key=Name,Values=sharedDocNamePrefix
Key=Owner,Values=Private
Output:
{ "DocumentIdentifiers": [ { "Name": "Example", "Owner": "12345EXAMPLE", "PlatformTypes": [ "Windows", "Linux" ], "DocumentVersion": "1", "DocumentType": "Command", "SchemaVersion": "0.3", "DocumentFormat": "YAML", "Tags": [] } ] }
For more information, see Amazon Systems Manager Documents
in the Amazon Systems Manager User Guide. -
For API details, see ListDocuments
in Amazon CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell
-
Example 1: Lists all the configuration documents in your account.
Get-SSMDocumentList
Output:
DocumentType : Command DocumentVersion : 1 Name : AWS-ApplyPatchBaseline Owner : Amazon PlatformTypes : {Windows} SchemaVersion : 1.2 DocumentType : Command DocumentVersion : 1 Name : AWS-ConfigureAWSPackage Owner : Amazon PlatformTypes : {Windows, Linux} SchemaVersion : 2.0 DocumentType : Command DocumentVersion : 1 Name : AWS-ConfigureCloudWatch Owner : Amazon PlatformTypes : {Windows} SchemaVersion : 1.2 ...
Example 2: This example retrieves all automation documents with name matchingi 'Platform'
Get-SSMDocumentList -DocumentFilterList @{Key="DocumentType";Value="Automation"} | Where-Object Name -Match "Platform"
Output:
DocumentFormat : JSON DocumentType : Automation DocumentVersion : 7 Name : KT-Get-Platform Owner : 987654123456 PlatformTypes : {Windows, Linux} SchemaVersion : 0.3 Tags : {} TargetType : VersionName :
-
For API details, see ListDocuments
in Amazon Tools for PowerShell Cmdlet Reference.
-
For a complete list of Amazon SDK developer guides and code examples, see Using Systems Manager with an Amazon SDK. This topic also includes information about getting started and details about previous SDK versions.