aws ssm register-target-with-maintenance-window
Registers a target with a maintenance window. AWS CLI reference
5 examples 7 options Its page in the AWS CLI reference
Examples
Example 1: To register a single target with a maintenance window
The following register-target-with-maintenance-window example registers an instance with a maintenance window.
aws ssm register-target-with-maintenance-window --window-id "mw-ab12cd34efEXAMPLE" --targets "Key=InstanceIds,Values=i-0000293ffd8c57862" --owner-information "Single instance" --resource-type "INSTANCE"Identify--window-idThe ID of the maintenance window the target should be registered with.--targetsThe targets to register with the maintenance window.--owner-informationUser-provided value that will be included in any Amazon CloudWatch Events events raised while running tasks for these targets in this maintenance window.--resource-typeThe type of target being registered with the maintenance window.Its output
{
"WindowTargetId":"1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d-1a2"
}Example 2: To register multiple targets with a maintenance window using instance IDs
The following register-target-with-maintenance-window example registers two instances with a maintenance window by specifying their instance IDs.
aws ssm register-target-with-maintenance-window --window-id "mw-ab12cd34efEXAMPLE" --targets "Key=InstanceIds,Values=i-0000293ffd8c57862,i-0cb2b964d3e14fd9f" --owner-information "Two instances in a list" --resource-type "INSTANCE"Identify--window-idThe ID of the maintenance window the target should be registered with.--targetsThe targets to register with the maintenance window.--owner-informationUser-provided value that will be included in any Amazon CloudWatch Events events raised while running tasks for these targets in this maintenance window.--resource-typeThe type of target being registered with the maintenance window.Its output
{
"WindowTargetId":"1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d-1a2"
}Example 3: To register targets with a maintenance window using resource tags
The following register-target-with-maintenance-window example registers instances with a maintenance window by specifying resource tags that have been applied to the instances.
aws ssm register-target-with-maintenance-window --window-id "mw-06cf17cbefcb4bf4f" --targets "Key=tag:Environment,Values=Prod" "Key=Role,Values=Web" --owner-information "Production Web Servers" --resource-type "INSTANCE"Identify--window-idThe ID of the maintenance window the target should be registered with.--targetsThe targets to register with the maintenance window.--owner-informationUser-provided value that will be included in any Amazon CloudWatch Events events raised while running tasks for these targets in this maintenance window.--resource-typeThe type of target being registered with the maintenance window.Its output
{
"WindowTargetId":"1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d-1a2"
}Example 4: To register targets using a group of tag keys
The following register-target-with-maintenance-window example register instances that all have one or more tag keys assigned to them, regardless of their key values.
aws ssm register-target-with-maintenance-window --window-id "mw-0c50858d01EXAMPLE" --resource-type "INSTANCE" --targets "Key=tag-key,Values=Name,Instance-Type,CostCenter"Identify--window-idThe ID of the maintenance window the target should be registered with.--resource-typeThe type of target being registered with the maintenance window.--targetsThe targets to register with the maintenance window.Its output
{
"WindowTargetId":"1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d-1a2"
}Example 5: To register targets using a resource group name
The following register-target-with-maintenance-window example register a specified resource group, regardless of the type of resources it contains.
aws ssm register-target-with-maintenance-window --window-id "mw-0c50858d01EXAMPLE" --resource-type "RESOURCE_GROUP" --targets "Key=resource-groups:Name,Values=MyResourceGroup"Identify--window-idThe ID of the maintenance window the target should be registered with.--resource-typeThe type of target being registered with the maintenance window.--targetsThe targets to register with the maintenance window.Its output
{
"WindowTargetId":"1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d-1a2"
}For more information, see Register a Target Instance with the Maintenance Window (AWS CLI) in the AWS Systems Manager User Guide.
Options
--client-tokenUser-provided idempotency token.--descriptionAn optional description for the target.--nameAn optional name for the target.--owner-informationUser-provided value that will be included in any Amazon CloudWatch Events events raised while running tasks for these targets in this maintenance window.--resource-typeThe type of target being registered with the maintenance window.--targetsThe targets to register with the maintenance window.--window-idThe ID of the maintenance window the target should be registered with.