-
运行以下命令以创建名为 Production-Baseline
的适用于 Windows 的补丁基准。此补丁基准会在补丁发布或最后更新 7 天后批准用于生产环境。即,我们已标记补丁基准,以指示它适用于生产环境。
- Linux & macOS
-
aws ssm create-patch-baseline \
--name "Production-Baseline" \
--operating-system "WINDOWS" \
--tags "Key=Environment,Value=Production" \
--approval-rules "PatchRules=[{PatchFilterGroup={PatchFilters=[{Key=MSRC_SEVERITY,Values=[Critical,Important]},{Key=CLASSIFICATION,Values=[SecurityUpdates,Updates,ServicePacks,UpdateRollups,CriticalUpdates]}]},ApproveAfterDays=7}]" \
--description "Baseline containing all updates approved for production systems"
- Windows Server
-
aws ssm create-patch-baseline ^
--name "Production-Baseline" ^
--operating-system "WINDOWS" ^
--tags "Key=Environment,Value=Production" ^
--approval-rules "PatchRules=[{PatchFilterGroup={PatchFilters=[{Key=MSRC_SEVERITY,Values=[Critical,Important]},{Key=CLASSIFICATION,Values=[SecurityUpdates,Updates,ServicePacks,UpdateRollups,CriticalUpdates]}]},ApproveAfterDays=7}]" ^
--description "Baseline containing all updates approved for production systems"
系统将返回类似于以下内容的信息。
{
"BaselineId":"pb-0c10e65780EXAMPLE"
}
-
运行以下命令为两个补丁组注册“生产-基准”补丁基准。这些组命名为“数据库服务器”和“前端服务器”。
- Linux & macOS
-
aws ssm register-patch-baseline-for-patch-group \
--baseline-id pb-0c10e65780EXAMPLE \
--patch-group "Database Servers"
- Windows Server
-
aws ssm register-patch-baseline-for-patch-group ^
--baseline-id pb-0c10e65780EXAMPLE ^
--patch-group "Database Servers"
系统将返回类似于以下内容的信息。
{
"PatchGroup":"Database Servers",
"BaselineId":"pb-0c10e65780EXAMPLE"
}
- Linux & macOS
-
aws ssm register-patch-baseline-for-patch-group \
--baseline-id pb-0c10e65780EXAMPLE \
--patch-group "Front-End Servers"
- Windows Server
-
aws ssm register-patch-baseline-for-patch-group ^
--baseline-id pb-0c10e65780EXAMPLE ^
--patch-group "Front-End Servers"
系统将返回类似于以下内容的信息。
{
"PatchGroup":"Front-End Servers",
"BaselineId":"pb-0c10e65780EXAMPLE"
}
-
运行以下命令为生产服务器创建两个维护时段。第一个时段在每周二晚上 10 点运行。第二个时段在每周六晚上 10 点运行。此外,维护时段已标记来指示它适用于生产环境。
- Linux & macOS
-
aws ssm create-maintenance-window \
--name "Production-Tuesdays" \
--tags "Key=Environment,Value=Production" \
--schedule "cron(0 0 22 ? * TUE *)" \
--duration 1 \
--cutoff 0 \
--no-allow-unassociated-targets
- Windows Server
-
aws ssm create-maintenance-window ^
--name "Production-Tuesdays" ^
--tags "Key=Environment,Value=Production" ^
--schedule "cron(0 0 22 ? * TUE *)" ^
--duration 1 ^
--cutoff 0 ^
--no-allow-unassociated-targets
系统将返回类似于以下内容的信息。
{
"WindowId":"mw-0c50858d01EXAMPLE"
}
- Linux & macOS
-
aws ssm create-maintenance-window \
--name "Production-Saturdays" \
--tags "Key=Environment,Value=Production" \
--schedule "cron(0 0 22 ? * SAT *)" \
--duration 2 \
--cutoff 0 \
--no-allow-unassociated-targets
- Windows Server
-
aws ssm create-maintenance-window ^
--name "Production-Saturdays" ^
--tags "Key=Environment,Value=Production" ^
--schedule "cron(0 0 22 ? * SAT *)" ^
--duration 2 ^
--cutoff 0 ^
--no-allow-unassociated-targets
系统将返回类似于以下内容的信息。
{
"WindowId":"mw-9a8b7c6d5eEXAMPLE"
}
-
运行以下命令,将 Database
和 Front-End
服务器补丁组注册到其各自的维护时段。
- Linux & macOS
-
aws ssm register-target-with-maintenance-window \
--window-id mw-0c50858d01EXAMPLE \
--targets "Key=tag:PatchGroup,Values=Database Servers" \
--owner-information "Database Servers" \
--resource-type "INSTANCE"
- Windows Server
-
aws ssm register-target-with-maintenance-window ^
--window-id mw-0c50858d01EXAMPLE ^
--targets "Key=tag:PatchGroup,Values=Database Servers" ^
--owner-information "Database Servers" ^
--resource-type "INSTANCE"
系统将返回类似于以下内容的信息。
{
"WindowTargetId":"e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE"
}
- Linux & macOS
-
aws ssm register-target-with-maintenance-window \
--window-id mw-9a8b7c6d5eEXAMPLE \
--targets "Key=tag:PatchGroup,Values=Front-End Servers" \
--owner-information "Front-End Servers" \
--resource-type "INSTANCE"
- Windows Server
-
aws ssm register-target-with-maintenance-window ^
--window-id mw-9a8b7c6d5eEXAMPLE ^
--targets "Key=tag:PatchGroup,Values=Front-End Servers" ^
--owner-information "Front-End Servers" ^
--resource-type "INSTANCE"
系统将返回类似于以下内容的信息。
{
"WindowTargetId":"faa01c41-1d57-496c-ba77-ff9caEXAMPLE"
}
-
运行以下命令注册一个补丁任务,该任务在 Database
和 Front-End
服务器各自的维护时段内安装缺少的更新。
- Linux & macOS
-
aws ssm register-task-with-maintenance-window \
--window-id mw-0c50858d01EXAMPLE \
--targets "Key=WindowTargetIds,Values=e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE" \
--task-arn "AWS-RunPatchBaseline" \
--service-role-arn "arn:aws:iam::123456789012:role/MW-Role" \
--task-type "RUN_COMMAND" \
--max-concurrency 2 \
--max-errors 1 \
--priority 1 \
--task-invocation-parameters "RunCommand={Parameters={Operation=Install}}"
- Windows Server
-
aws ssm register-task-with-maintenance-window ^
--window-id mw-0c50858d01EXAMPLE ^
--targets "Key=WindowTargetIds,Values=e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE" ^
--task-arn "AWS-RunPatchBaseline" ^
--service-role-arn "arn:aws:iam::123456789012:role/MW-Role" ^
--task-type "RUN_COMMAND" ^
--max-concurrency 2 ^
--max-errors 1 ^
--priority 1 ^
--task-invocation-parameters "RunCommand={Parameters={Operation=Install}}"
系统将返回类似于以下内容的信息。
{
"WindowTaskId":"4f7ca192-7e9a-40fe-9192-5cb15EXAMPLE"
}
- Linux & macOS
-
aws ssm register-task-with-maintenance-window \
--window-id mw-9a8b7c6d5eEXAMPLE \
--targets "Key=WindowTargetIds,Values=faa01c41-1d57-496c-ba77-ff9caEXAMPLE" \
--task-arn "AWS-RunPatchBaseline" \
--service-role-arn "arn:aws:iam::123456789012:role/MW-Role" \
--task-type "RUN_COMMAND" \
--max-concurrency 2 \
--max-errors 1 \
--priority 1 \
--task-invocation-parameters "RunCommand={Parameters={Operation=Install}}"
- Windows Server
-
aws ssm register-task-with-maintenance-window ^
--window-id mw-9a8b7c6d5eEXAMPLE ^
--targets "Key=WindowTargetIds,Values=faa01c41-1d57-496c-ba77-ff9caEXAMPLE" ^
--task-arn "AWS-RunPatchBaseline" ^
--service-role-arn "arn:aws:iam::123456789012:role/MW-Role" ^
--task-type "RUN_COMMAND" ^
--max-concurrency 2 ^
--max-errors 1 ^
--priority 1 ^
--task-invocation-parameters "RunCommand={Parameters={Operation=Install}}"
系统将返回类似于以下内容的信息。
{
"WindowTaskId":"8a5c4629-31b0-4edd-8aea-33698EXAMPLE"
}
-
运行以下命令以获取补丁组的高级补丁合规性摘要。概括性补丁合规性摘要包括补丁处于相应状态的托管式节点的数量。
在第一个维护时段内,在补丁任务运行之前,预计会在摘要中看到托管式节点数量为零。
- Linux & macOS
-
aws ssm describe-patch-group-state \
--patch-group "Database Servers"
- Windows Server
-
aws ssm describe-patch-group-state ^
--patch-group "Database Servers"
系统将返回类似于以下内容的信息。
{
"Instances": number
,
"InstancesWithFailedPatches": number
,
"InstancesWithInstalledOtherPatches": number
,
"InstancesWithInstalledPatches": number
,
"InstancesWithInstalledPendingRebootPatches": number
,
"InstancesWithInstalledRejectedPatches": number
,
"InstancesWithMissingPatches": number
,
"InstancesWithNotApplicablePatches": number
,
"InstancesWithUnreportedNotApplicablePatches": number
}
-
运行以下命令以获取补丁组的每个托管式节点的补丁摘要状态。每个托管式节点摘要包括处于相应补丁状态的许多补丁(按补丁组的每个托管式节点划分)。
- Linux & macOS
-
aws ssm describe-instance-patch-states-for-patch-group \
--patch-group "Database Servers"
- Windows Server
-
aws ssm describe-instance-patch-states-for-patch-group ^
--patch-group "Database Servers"
系统将返回类似于以下内容的信息。
{
"InstancePatchStates": [
{
"BaselineId": "string
",
"FailedCount": number
,
"InstalledCount": number
,
"InstalledOtherCount": number
,
"InstalledPendingRebootCount": number
,
"InstalledRejectedCount": number
,
"InstallOverrideList": "string
",
"InstanceId": "string
",
"LastNoRebootInstallOperationTime": number
,
"MissingCount": number
,
"NotApplicableCount": number
,
"Operation": "string
",
"OperationEndTime": number
,
"OperationStartTime": number
,
"OwnerInformation": "string
",
"PatchGroup": "string
",
"RebootOption": "string
",
"SnapshotId": "string
",
"UnreportedNotApplicableCount": number
}
]
}