-
AWS CLI를 열고 다음 명령을 실행하여 이름 및 설명을 포함하도록 대상을 업데이트합니다.
- Linux & macOS
-
aws ssm update-maintenance-window-target \
--window-id "mw-0c50858d01EXAMPLE" \
--window-target-id "e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE" \
--name "My-Maintenance-Window-Target" \
--description "Description for my maintenance window target"
- Windows
-
aws ssm update-maintenance-window-target ^
--window-id "mw-0c50858d01EXAMPLE" ^
--window-target-id "e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE" ^
--name "My-Maintenance-Window-Target" ^
--description "Description for my maintenance window target"
시스템은 다음과 유사한 정보를 반환합니다.
{
"WindowId": "mw-0c50858d01EXAMPLE",
"WindowTargetId": "e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE",
"Targets": [
{
"Key": "InstanceIds",
"Values": [
"i-02573cafcfEXAMPLE"
]
}
],
"Name": "My-Maintenance-Window-Target",
"Description": "Description for my maintenance window target"
}
-
다음 명령에 replace 옵션을 사용하여 실행하여 설명 필드를 제거하고 다른 대상을 추가합니다. 업데이트에 필드는 포함되지 않으므로(null 값) 설명 필드는 제거됩니다. Systems Manager에 사용하도록 구성된 추가 노드를 반드시 지정해야 합니다.
- Linux & macOS
-
aws ssm update-maintenance-window-target \
--window-id "mw-0c50858d01EXAMPLE" \
--window-target-id "d208dedf-3f6b-41ff-ace8-8e751EXAMPLE" \
--targets "Key=InstanceIds,Values=i-02573cafcfEXAMPLE,i-0471e04240EXAMPLE" \
--name "My-Maintenance-Window-Target" \
--replace
- Windows
-
aws ssm update-maintenance-window-target ^
--window-id "mw-0c50858d01EXAMPLE" ^
--window-target-id "d208dedf-3f6b-41ff-ace8-8e751EXAMPLE" ^
--targets "Key=InstanceIds,Values=i-02573cafcfEXAMPLE,i-0471e04240EXAMPLE" ^
--name "My-Maintenance-Window-Target" ^
--replace
시스템은 다음과 유사한 정보를 반환합니다.
{
"WindowId": "mw-0c50858d01EXAMPLE",
"WindowTargetId": "e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE",
"Targets": [
{
"Key": "InstanceIds",
"Values": [
"i-02573cafcfEXAMPLE",
"i-0471e04240EXAMPLE"
]
}
],
"Name": "My-Maintenance-Window-Target"
}
-
start-date 옵션을 사용하면 향후 지정한 날짜까지 유지 관리 기간의 활성화를 지연시킬 수 있습니다. end-date 옵션을 사용하면 유지 관리 기간이 더 이상 실행되지 않는 미래의 날짜 및 시간을 설정할 수 있습니다. 이 옵션은 ISO-8601 확장 형식으로 지정합니다.
다음 명령을 실행하여 예약된 유지 관리 기간을 정기적으로 실행하는 날짜 및 시간 범위를 지정합니다.
- Linux & macOS
-
aws ssm update-maintenance-window \
--window-id "mw-0c50858d01EXAMPLE" \
--start-date "2020-10-01T10:10:10Z" \
--end-date "2020-11-01T10:10:10Z"
- Windows
-
aws ssm update-maintenance-window ^
--window-id "mw-0c50858d01EXAMPLE" ^
--start-date "2020-10-01T10:10:10Z" ^
--end-date "2020-11-01T10:10:10Z"
-
다음 명령을 실행하여 Run Command 작업을 업데이트합니다.
대상이 Windows Server용 Amazon Elastic Compute Cloud(Amazon EC2) 인스턴스인 경우 다음 명령에서 df를 ipconfig로, AWS-RunShellScript를 AWS-RunPowerShellScript로 변경합니다.
- Linux & macOS
-
aws ssm update-maintenance-window-task \
--window-id "mw-0c50858d01EXAMPLE" \
--window-task-id "4f7ca192-7e9a-40fe-9192-5cb15EXAMPLE" \
--targets "Key=WindowTargetIds,Values=e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE" \
--task-arn "AWS-RunShellScript" \
--service-role-arn "arn:aws:iam::account-id:role/MaintenanceWindowsRole" \
--task-invocation-parameters "RunCommand={Comment=Revising my Run Command task,Parameters={commands=df}}" \
--priority 1 --max-concurrency 10 --max-errors 4 \
--name "My-Task-Name" --description "A description for my Run Command task"
- Windows
-
aws ssm update-maintenance-window-task ^
--window-id "mw-0c50858d01EXAMPLE" ^
--window-task-id "4f7ca192-7e9a-40fe-9192-5cb15EXAMPLE" ^
--targets "Key=WindowTargetIds,Values=e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE" ^
--task-arn "AWS-RunShellScript" ^
--service-role-arn "arn:aws:iam::account-id:role/MaintenanceWindowsRole" ^
--task-invocation-parameters "RunCommand={Comment=Revising my Run Command task,Parameters={commands=df}}" ^
--priority 1 --max-concurrency 10 --max-errors 4 ^
--name "My-Task-Name" --description "A description for my Run Command task"
시스템은 다음과 유사한 정보를 반환합니다.
{
"WindowId": "mw-0c50858d01EXAMPLE",
"WindowTaskId": "4f7ca192-7e9a-40fe-9192-5cb15EXAMPLE",
"Targets": [
{
"Key": "WindowTargetIds",
"Values": [
"e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE"
]
}
],
"TaskArn": "AWS-RunShellScript",
"ServiceRoleArn": "arn:aws:iam::111122223333:role/MaintenanceWindowsRole",
"TaskParameters": {},
"TaskInvocationParameters": {
"RunCommand": {
"Comment": "Revising my Run Command task",
"Parameters": {
"commands": [
"df"
]
}
}
},
"Priority": 1,
"MaxConcurrency": "10",
"MaxErrors": "4",
"Name": "My-Task-Name",
"Description": "A description for my Run Command task"
}
-
다음 명령을 변경 및 실행하여 Lambda 태스크를 업데이트합니다.
- Linux & macOS
-
aws ssm update-maintenance-window-task \
--window-id mw-0c50858d01EXAMPLE \
--window-task-id 4f7ca192-7e9a-40fe-9192-5cb15EXAMPLE \
--targets "Key=WindowTargetIds,Values=e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE" \
--task-arn "arn:aws:lambda:region:111122223333:function:SSMTestLambda" \
--service-role-arn "arn:aws:iam:account-id:role/MaintenanceWindowsRole" \
--task-invocation-parameters '{"Lambda":{"Payload":"{\"InstanceId\":\"{{RESOURCE_ID}}\",\"targetType\":\"{{TARGET_TYPE}}\"}"}}' \
--priority 1 --max-concurrency 10 --max-errors 5 \
--name "New-Lambda-Task-Name" \
--description "A description for my Lambda task"
- Windows
-
aws ssm update-maintenance-window-task ^
--window-id mw-0c50858d01EXAMPLE ^
--window-task-id 4f7ca192-7e9a-40fe-9192-5cb15EXAMPLE ^
--targets "Key=WindowTargetIds,Values=e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE" ^
--task-arn --task-arn "arn:aws:lambda:region:111122223333:function:SSMTestLambda" ^
--service-role-arn "arn:aws:iam:account-id:role/MaintenanceWindowsRole" ^
--task-invocation-parameters '{"Lambda":{"Payload":"{\"InstanceId\":\"{{RESOURCE_ID}}\",\"targetType\":\"{{TARGET_TYPE}}\"}"}}' ^
--priority 1 --max-concurrency 10 --max-errors 5 ^
--name "New-Lambda-Task-Name" ^
--description "A description for my Lambda task"
시스템은 다음과 유사한 정보를 반환합니다.
{
"WindowId": "mw-0c50858d01EXAMPLE",
"WindowTaskId": "4f7ca192-7e9a-40fe-9192-5cb15EXAMPLE",
"Targets": [
{
"Key": "WindowTargetIds",
"Values": "e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE"
}
],
"TaskArn": "arn:aws:lambda:us-east-2:111122223333:function:SSMTestLambda",
"ServiceRoleArn": "arn:aws:iam::111122223333:role/MaintenanceWindowsRole",
"TaskParameters": {},
"TaskInvocationParameters": {
"Lambda": {
"Payload": "e30="
}
},
"Priority": 1,
"MaxConcurrency": "10",
"MaxErrors": "5",
"Name": "New-Lambda-Task-Name",
"Description": "A description for my Lambda task"
}
-
Step Functions 태스크를 업데이트하는 경우 다음 명령을 채택하고 실행하여 task-invocation-parameters를 업데이트합니다.
- Linux & macOS
-
aws ssm update-maintenance-window-task \
--window-id "mw-0c50858d01EXAMPLE" \
--window-task-id "4f7ca192-7e9a-40fe-9192-5cb15EXAMPLE" \
--targets "Key=WindowTargetIds,Values=e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE" \
--task-arn "arn:aws:states:region:execution:SSMStepFunctionTest" \
--service-role-arn "arn:aws:iam:account-id:role/MaintenanceWindowsRole" \
--task-invocation-parameters '{"StepFunctions":{"Input":"{\"InstanceId\":\"{{RESOURCE_ID}}\"}"}}' \
--priority 0 --max-concurrency 10 --max-errors 5 \
--name "My-Step-Functions-Task" \
--description "A description for my Step Functions task"
- Windows
-
aws ssm update-maintenance-window-task ^
--window-id "mw-0c50858d01EXAMPLE" ^
--window-task-id "4f7ca192-7e9a-40fe-9192-5cb15EXAMPLE" ^
--targets "Key=WindowTargetIds,Values=e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE" ^
--task-arn "arn:aws:states:region:execution:SSMStepFunctionTest" ^
--service-role-arn "arn:aws:iam:account-id:role/MaintenanceWindowsRole" ^
--task-invocation-parameters '{"StepFunctions":{"Input":"{\"InstanceId\":\"{{RESOURCE_ID}}\"}"}}' ^
--priority 0 --max-concurrency 10 --max-errors 5 ^
--name "My-Step-Functions-Task" ^
--description "A description for my Step Functions task"
시스템은 다음과 유사한 정보를 반환합니다.
{
"WindowId": "mw-0c50858d01EXAMPLE",
"WindowTaskId": "4f7ca192-7e9a-40fe-9192-5cb15EXAMPLE",
"Targets": [
{
"Key": "WindowTargetIds",
"Values": [
"e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE"
]
}
],
"TaskArn": "arn:aws:states:us-east-2:111122223333:execution:SSMStepFunctionTest",
"ServiceRoleArn": "arn:aws:iam::111122223333:role/MaintenanceWindowsRole",
"TaskParameters": {},
"TaskInvocationParameters": {
"StepFunctions": {
"Input": "{\"instanceId\":\"{{RESOURCE_ID}}\"}"
}
},
"Priority": 0,
"MaxConcurrency": "10",
"MaxErrors": "5",
"Name": "My-Step-Functions-Task",
"Description": "A description for my Step Functions task"
}
-
다음 명령을 실행하여 유지 관리 기간에서 대상을 등록 취소합니다. 이 예에서는 safe 파라미터를 사용하여 대상이 다른 태스크에서 참조되고 따라서 안전하고 등록 취소할 수 있는지 확인합니다.
- Linux & macOS
-
aws ssm deregister-target-from-maintenance-window \
--window-id "mw-0c50858d01EXAMPLE" \
--window-target-id "e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE" \
--safe
- Windows
-
aws ssm deregister-target-from-maintenance-window ^
--window-id "mw-0c50858d01EXAMPLE" ^
--window-target-id "e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE" ^
--safe
시스템은 다음과 유사한 정보를 반환합니다.
An error occurred (TargetInUseException) when calling the DeregisterTargetFromMaintenanceWindow operation:
This Target cannot be deregistered because it is still referenced in Task: 4f7ca192-7e9a-40fe-9192-5cb15EXAMPLE
-
다음 명령을 실행하여 작업에서 대상을 참조하는 경우에도 유지 관리 기간에서 대상을 등록 취소합니다. no-safe 파라미터를 사용하여 등록 취소 작업을 강제로 실행할 수 있습니다.
- Linux & macOS
-
aws ssm deregister-target-from-maintenance-window \
--window-id "mw-0c50858d01EXAMPLE" \
--window-target-id "e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE" \
--no-safe
- Windows
-
aws ssm deregister-target-from-maintenance-window ^
--window-id "mw-0c50858d01EXAMPLE" ^
--window-target-id "e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE" ^
--no-safe
시스템은 다음과 유사한 정보를 반환합니다.
{
"WindowId": "mw-0c50858d01EXAMPLE",
"WindowTargetId": "e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE"
}
-
다음 명령을 실행하여 Run Command 작업을 업데이트합니다. 이 예에서는 '{{ssm:UpdateLevel}}' 형식의 UpdateLevel이라는 Systems Manager Parameter Store 파라미터를 사용합니다.
- Linux & macOS
-
aws ssm update-maintenance-window-task \
--window-id "mw-0c50858d01EXAMPLE" \
--window-task-id "4f7ca192-7e9a-40fe-9192-5cb15EXAMPLE" \
--targets "Key=InstanceIds,Values=i-02573cafcfEXAMPLE" \
--task-invocation-parameters "RunCommand={Comment=A comment for my task update,Parameters={UpdateLevel='{{ssm:UpdateLevel}}'}}"
- Windows
-
aws ssm update-maintenance-window-task ^
--window-id "mw-0c50858d01EXAMPLE" ^
--window-task-id "4f7ca192-7e9a-40fe-9192-5cb15EXAMPLE" ^
--targets "Key=InstanceIds,Values=i-02573cafcfEXAMPLE" ^
--task-invocation-parameters "RunCommand={Comment=A comment for my task update,Parameters={UpdateLevel='{{ssm:UpdateLevel}}'}}"
시스템은 다음과 유사한 정보를 반환합니다.
{
"WindowId": "mw-0c50858d01EXAMPLE",
"WindowTaskId": "4f7ca192-7e9a-40fe-9192-5cb15EXAMPLE",
"Targets": [
{
"Key": "InstanceIds",
"Values": [
"i-02573cafcfEXAMPLE"
]
}
],
"TaskArn": "AWS-RunShellScript",
"ServiceRoleArn": "arn:aws:iam::111122223333:role/MyMaintenanceWindowServiceRole",
"TaskParameters": {},
"TaskInvocationParameters": {
"RunCommand": {
"Comment": "A comment for my task update",
"Parameters": {
"UpdateLevel": [
"{{ssm:UpdateLevel}}"
]
}
}
},
"Priority": 10,
"MaxConcurrency": "1",
"MaxErrors": "1"
}
-
다음 명령을 실행하여 Automation 태스크를 업데이트하고 task-invocation-parameters 파라미터에 대한 WINDOW_ID 및 WINDOW_TASK_ID 파라미터를 지정합니다.
- Linux & macOS
-
aws ssm update-maintenance-window-task \
--window-id "mw-0c50858d01EXAMPLE" \
--window-task-id "4f7ca192-7e9a-40fe-9192-5cb15EXAMPLE" \
--targets "Key=WindowTargetIds,Values=e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE \
--task-arn "AutoTestDoc" \
--service-role-arn "arn:aws:iam:account-id:role/MyMaintenanceWindowServiceRole \
--task-invocation-parameters "Automation={Parameters={InstanceId='{{RESOURCE_ID}}',initiator='{{WINDOW_ID}}.Task-{{WINDOW_TASK_ID}}'}}" \
--priority 3 --max-concurrency 10 --max-errors 5
- Windows
-
aws ssm update-maintenance-window-task ^
--window-id "mw-0c50858d01EXAMPLE" ^
--window-task-id "4f7ca192-7e9a-40fe-9192-5cb15EXAMPLE" ^
--targets "Key=WindowTargetIds,Values=e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE ^
--task-arn "AutoTestDoc" ^
--service-role-arn "arn:aws:iam:account-id:role/MyMaintenanceWindowServiceRole ^
--task-invocation-parameters "Automation={Parameters={InstanceId='{{RESOURCE_ID}}',initiator='{{WINDOW_ID}}.Task-{{WINDOW_TASK_ID}}'}}" ^
--priority 3 --max-concurrency 10 --max-errors 5
시스템은 다음과 유사한 정보를 반환합니다.
{
"WindowId": "mw-0c50858d01EXAMPLE",
"WindowTaskId": "4f7ca192-7e9a-40fe-9192-5cb15EXAMPLE",
"Targets": [
{
"Key": "WindowTargetIds",
"Values": [
"e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE"
]
}
],
"TaskArn": "AutoTestDoc",
"ServiceRoleArn": "arn:aws:iam::111122223333:role/MyMaintenanceWindowServiceRole",
"TaskParameters": {},
"TaskInvocationParameters": {
"Automation": {
"Parameters": {
"multi": [
"{{WINDOW_TASK_ID}}"
],
"single": [
"{{WINDOW_ID}}"
]
}
}
},
"Priority": 0,
"MaxConcurrency": "10",
"MaxErrors": "5",
"Name": "My-Automation-Task",
"Description": "A description for my Automation task"
}