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

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

RegisterTargetWithMaintenanceWindow

Registers a target with a maintenance window.

Request Syntax

{ "ClientToken": "string", "Description": "string", "Name": "string", "OwnerInformation": "string", "ResourceType": "string", "Targets": [ { "Key": "string", "Values": [ "string" ] } ], "WindowId": "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.

ClientToken

User-provided idempotency token.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 64.

Required: No

Description

An optional description for the target.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 128.

Required: No

Name

An optional name for the target.

Type: String

Length Constraints: Minimum length of 3. Maximum length of 128.

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

Required: No

OwnerInformation

User-provided value that will be included in any CloudWatch events raised while running tasks for these targets in this maintenance window.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 128.

Required: No

ResourceType

The type of target being registered with the maintenance window.

Type: String

Valid Values: INSTANCE | RESOURCE_GROUP

Required: Yes

Targets

The targets to register with the maintenance window. In other words, the instances to run commands on when the maintenance window runs.

You can specify targets using instance IDs, resource group names, or tags that have been applied to instances.

Example 1: Specify instance IDs

Key=InstanceIds,Values=instance-id-1,instance-id-2,instance-id-3

Example 2: Use tag key-pairs applied to instances

Key=tag:my-tag-key,Values=my-tag-value-1,my-tag-value-2

Example 3: Use tag-keys applied to instances

Key=tag-key,Values=my-tag-key-1,my-tag-key-2

Example 4: Use resource group names

Key=resource-groups:Name,Values=resource-group-name

Example 5: Use filters for resource group types

Key=resource-groups:ResourceTypeFilters,Values=resource-type-1,resource-type-2

Note

For Key=resource-groups:ResourceTypeFilters, specify resource types in the following format

Key=resource-groups:ResourceTypeFilters,Values=AWS::EC2::INSTANCE,AWS::EC2::VPC

For more information about these examples formats, including the best use case for each one, see Examples: Register Targets with a Maintenance Window in the AWS Systems Manager User Guide.

Type: Array of Target objects

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

Required: Yes

WindowId

The ID of the maintenance window the target should be registered with.

Type: String

Length Constraints: Fixed length of 20.

Pattern: ^mw-[0-9a-f]{17}$

Required: Yes

Response Syntax

{ "WindowTargetId": "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.

WindowTargetId

The ID of the target definition in this maintenance window.

Type: String

Length Constraints: Fixed length of 36.

Pattern: ^[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}$

Errors

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

DoesNotExistException

Error returned when the ID specified for a resource, such as a maintenance window or Patch baseline, doesn't exist.

For information about resource limits in Systems Manager, see AWS Systems Manager Limits.

HTTP Status Code: 400

IdempotentParameterMismatch

Error returned when an idempotent operation is retried and the parameters don't match the original call to the API with the same idempotency token.

HTTP Status Code: 400

InternalServerError

An error occurred on the server side.

HTTP Status Code: 500

ResourceLimitExceededException

Error returned when the caller has exceeded the default resource limits. For example, too many maintenance windows or patch baselines have been created.

For information about resource limits in Systems Manager, see AWS Systems Manager Limits.

HTTP Status Code: 400

See Also

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