CreateDocument - Amazon Systems Manager
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).


Creates a Amazon 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 Systems Manager Documents in the Amazon Systems Manager User Guide.

Request Syntax

{ "Attachments": [ { "Key": "string", "Name": "string", "Values": [ "string" ] } ], "Content": "string", "DisplayName": "string", "DocumentFormat": "string", "DocumentType": "string", "Name": "string", "Requires": [ { "Name": "string", "RequireType": "string", "Version": "string", "VersionName": "string" } ], "Tags": [ { "Key": "string", "Value": "string" } ], "TargetType": "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.


A list of key-value pairs that describe attachments to a version of a document.

Type: Array of AttachmentsSource objects

Array Members: Minimum number of 0 items. Maximum number of 20 items.

Required: No


The content for the new SSM document in JSON or YAML format. The content of the document must not exceed 64KB. This quota also includes the content specified for input parameters at runtime. We recommend storing the contents for your new document in an external JSON or YAML file and referencing the file in a command.

For examples, see the following topics in the Amazon Systems Manager User Guide.

Type: String

Length Constraints: Minimum length of 1.

Required: Yes


An optional field where you can specify a friendly name for the SSM document. This value can differ for each version of the document. You can update this value at a later time using the UpdateDocument operation.

Type: String

Length Constraints: Maximum length of 1024.

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

Required: No


Specify the document format for the request. The document format can be JSON, YAML, or TEXT. JSON is the default format.

Type: String

Valid Values: YAML | JSON | TEXT

Required: No


The type of document to create.


The DeploymentStrategy document type is an internal-use-only document type reserved for Amazon AppConfig.

Type: String

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

Required: No


A name for the SSM document.


You can't use the following strings as document name prefixes. These are reserved by Amazon for use as document name prefixes:

  • aws

  • amazon

  • amzn

Type: String

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

Required: Yes


A list of SSM documents required by a document. This parameter is used exclusively by Amazon AppConfig. When a user creates an Amazon AppConfig configuration in an SSM document, the user must also specify a required document for validation purposes. In this case, an ApplicationConfiguration document requires an ApplicationConfigurationSchema document for validation purposes. For more information, see What is Amazon AppConfig? in the Amazon AppConfig User Guide.

Type: Array of DocumentRequires objects

Array Members: Minimum number of 1 item.

Required: No


Optional metadata that you assign to a resource. Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag an SSM document to identify the types of targets or the environment where it will run. In this case, you could specify the following key-value pairs:

  • Key=OS,Value=Windows

  • Key=Environment,Value=Production


To add tags to an existing SSM document, use the AddTagsToResource operation.

Type: Array of Tag objects

Array Members: Maximum number of 1000 items.

Required: No


Specify a target type to define the kinds of resources the document can run on. For example, to run a document on EC2 instances, specify the following value: /AWS::EC2::Instance. If you specify a value of '/' the document can run on all types of resources. If you don't specify a value, the document can't run on any resources. For a list of valid resource types, see Amazon resource and property types reference in the Amazon CloudFormation User Guide.

Type: String

Length Constraints: Maximum length of 200.

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

Required: No


An optional field specifying the version of the artifact you are creating with the document. For example, Release12.1. 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

{ "DocumentDescription": { "ApprovedVersion": "string", "AttachmentsInformation": [ { "Name": "string" } ], "Author": "string", "Category": [ "string" ], "CategoryEnum": [ "string" ], "CreatedDate": number, "DefaultVersion": "string", "Description": "string", "DisplayName": "string", "DocumentFormat": "string", "DocumentType": "string", "DocumentVersion": "string", "Hash": "string", "HashType": "string", "LatestVersion": "string", "Name": "string", "Owner": "string", "Parameters": [ { "DefaultValue": "string", "Description": "string", "Name": "string", "Type": "string" } ], "PendingReviewVersion": "string", "PlatformTypes": [ "string" ], "Requires": [ { "Name": "string", "RequireType": "string", "Version": "string", "VersionName": "string" } ], "ReviewInformation": [ { "ReviewedTime": number, "Reviewer": "string", "Status": "string" } ], "ReviewStatus": "string", "SchemaVersion": "string", "Sha1": "string", "Status": "string", "StatusInformation": "string", "Tags": [ { "Key": "string", "Value": "string" } ], "TargetType": "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.


Information about the SSM document.

Type: DocumentDescription object


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


The specified document already exists.

HTTP Status Code: 400


You can have at most 500 active SSM documents.

HTTP Status Code: 400


An error occurred on the server side.

HTTP Status Code: 500


The content for the document isn't valid.

HTTP Status Code: 400


The version of the document schema isn't supported.

HTTP Status Code: 400


The size limit of a document is 64 KB.

HTTP Status Code: 400



This example illustrates one usage of CreateDocument.

Sample Request

POST / HTTP/1.1 Host: Accept-Encoding: identity X-Amz-Target: AmazonSSM.CreateDocument 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: 20200324T145550Z Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20200324/us-east-2/ssm/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=39c3b3042cd2aEXAMPLE Content-Length: 963 { "Content": "---\ndescription: \"Example\"\nschemaVersion: '0.3'\nassumeRole: \"{{ AutomationAssumeRole }}\"--truncated--", "Name": "Example", "DocumentType": "Automation", "DocumentFormat": "YAML" }

Sample Response

{ "DocumentDescription": { "CreatedDate": 1585061751.738, "DefaultVersion": "1", "Description": "Custom Automation Example", "DocumentFormat": "YAML", "DocumentType": "Automation", "DocumentVersion": "1", "Hash": "0d3d879b3ca072e03c12638d0255ebd004d2c65bd318f8354fcde820dEXAMPLE", "HashType": "Sha256", "LatestVersion": "1", "Name": "Example", "Owner": "111122223333", "Parameters": [ { "DefaultValue": "", "Description": "(Optional) The ARN of the role that allows Automation to perform the actions on your behalf. If no role is specified, Systems Manager Automation uses your IAM permissions to execute this document.", "Name": "AutomationAssumeRole", "Type": "String" }, { "DefaultValue": "", "Description": "(Required) The Instance Id to create an image of.", "Name": "InstanceId", "Type": "String" } ], "PlatformTypes": [ "Windows", "Linux" ], "SchemaVersion": "0.3", "Status": "Creating", "Tags": [] } }

See Also

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