AWS Systems Manager
API Reference (API Version 2014-11-06)

CreateDocument

Creates a Systems Manager document.

After you create a document, you can use CreateAssociation to associate it with one or more running instances.

Request Syntax

{ "Attachments": [ { "Key": "string", "Values": [ "string" ] } ], "Content": "string", "DocumentFormat": "string", "DocumentType": "string", "Name": "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.

Attachments

A list of key and 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 1 item.

Required: No

Content

A valid JSON or YAML string.

Type: String

Length Constraints: Minimum length of 1.

Required: Yes

DocumentFormat

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

Type: String

Valid Values: YAML | JSON

Required: No

DocumentType

The type of document to create. Valid document types include: Command, Policy, Automation, Session, and Package.

Type: String

Valid Values: Command | Policy | Automation | Session | Package

Required: No

Name

A name for the Systems Manager document.

Important

Do not use the following to begin the names of documents you create. They are reserved by AWS for use as document prefixes:

  • aws

  • amazon

  • amzn

Type: String

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

Required: Yes

Tags

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 name/value pairs:

  • Key=OS,Value=Windows

  • Key=Environment,Value=Production

Note

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

Type: Array of Tag objects

Array Members: Maximum number of 1000 items.

Required: No

TargetType

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 AWS Resource Types Reference in the AWS CloudFormation User Guide.

Type: String

Length Constraints: Maximum length of 200.

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

Required: No

VersionName

An optional field specifying the version of the artifact you are creating with the document. For example, "Release 12, Update 6". This value is unique across all versions of a document, and cannot be changed.

Type: String

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

Required: No

Response Syntax

{ "DocumentDescription": { "AttachmentsInformation": [ { "Name": "string" } ], "CreatedDate": number, "DefaultVersion": "string", "Description": "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" } ], "PlatformTypes": [ "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.

DocumentDescription

Information about the Systems Manager document.

Type: DocumentDescription object

Errors

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

DocumentAlreadyExists

The specified document already exists.

HTTP Status Code: 400

DocumentLimitExceeded

You can have at most 200 active Systems Manager documents.

HTTP Status Code: 400

InternalServerError

An error occurred on the server side.

HTTP Status Code: 500

InvalidDocumentContent

The content for the document is not valid.

HTTP Status Code: 400

InvalidDocumentSchemaVersion

The version of the document schema is not supported.

HTTP Status Code: 400

MaxDocumentSizeExceeded

The size limit of a document is 64 KB.

HTTP Status Code: 400

See Also

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