id
stringlengths 8
78
| source
stringclasses 743
values | chunk_id
int64 1
5.05k
| text
stringlengths 593
49.7k
|
---|---|---|---|
systems-manager-ug-188
|
systems-manager-ug.pdf
| 188 |
check before patching is performed on the managed node. (For a list of actions, see Command document plugin reference). The default SSM document name is AWS-Noop, which doesn't perform any operation on the managed node. For information about creating a custom SSM document, see Creating SSM document content. Parameter name: PostInstallHookDocName Usage: Optional. Default: AWS-Noop. The value to provide for the PostInstallHookDocName parameter is the name or Amazon Resource Name (ARN) of an SSM document of your choice. You can provide the name of an AWS managed document or the name or ARN of a custom SSM document that you have created Patch Manager 579 AWS Systems Manager User Guide or that has been shared with you. (For an SSM document that has been shared with you from a different AWS account, you must specify the full resource ARN, such as arn:aws:ssm:us- east-2:123456789012:document/MySharedDocument.) The SSM document you specify is run after the Install with NoReboot operation and performs any actions supported by SSM Agent, such as a shell script for installing third party updates before reboot. (For a list of actions, see Command document plugin reference). The default SSM document name is AWS-Noop, which doesn't perform any operation on the managed node. For information about creating a custom SSM document, see Creating SSM document content. Parameter name: OnExitHookDocName Usage: Optional. Default: AWS-Noop. The value to provide for the OnExitHookDocName parameter is the name or Amazon Resource Name (ARN) of an SSM document of your choice. You can provide the name of an AWS managed document or the name or ARN of a custom SSM document that you have created or that has been shared with you. (For an SSM document that has been shared with you from a different AWS account, you must specify the full resource ARN, such as arn:aws:ssm:us- east-2:123456789012:document/MySharedDocument.) The SSM document you specify is run after the managed node reboot operation and performs any actions supported by SSM Agent, such as a shell script to verify node health after the patching operation is complete. (For a list of actions, see Command document plugin reference). The default SSM document name is AWS-Noop, which doesn't perform any operation on the managed node. For information about creating a custom SSM document, see Creating SSM document content. Sample scenario for using the InstallOverrideList parameter in AWS-RunPatchBaseline or AWS-RunPatchBaselineAssociation You can use the InstallOverrideList parameter when you want to override the patches specified by the current default patch baseline in Patch Manager, a tool in AWS Systems Manager. This topic provides examples that show how to use this parameter to achieve the following: • Apply different sets of patches to a target group of managed nodes. Patch Manager 580 AWS Systems Manager User Guide • Apply these patch sets on different frequencies. • Use the same patch baseline for both operations. Say that you want to install two different categories of patches on your Amazon Linux 2 managed nodes. You want to install these patches on different schedules using maintenance windows. You want one maintenance window to run every week and install all Security patches. You want another maintenance window to run once a month and install all available patches, or categories of patches other than Security. However, only one patch baseline at a time can be defined as the default for an operating system. This requirement helps avoid situations where one patch baseline approves a patch while another blocks it, which can lead to issues between conflicting versions. With the following strategy, you use the InstallOverrideList parameter to apply different types of patches to a target group, on different schedules, while still using the same patch baseline: 1. In the default patch baseline, ensure that only Security updates are specified. 2. Create a maintenance window that runs AWS-RunPatchBaseline or AWS- RunPatchBaselineAssociation each week. Don't specify an override list. 3. Create an override list of the patches of all types that you want to apply on a monthly basis and store it in an Amazon Simple Storage Service (Amazon S3) bucket. 4. Create a second maintenance window that runs once a month. However, for the Run Command task you register for this maintenance window, specify the location of your override list. The result: Only Security patches, as defined in your default patch baseline, are installed each week. All available patches, or whatever subset of patches you define, are installed each month. For more information and sample lists, see Parameter name: InstallOverrideList. Using the BaselineOverride parameter You can define patching preferences at runtime using the baseline override feature in Patch Manager, a tool in AWS Systems Manager. Do this by specifying an Amazon Simple Storage Service (Amazon S3) bucket containing a JSON object with a list of patch baselines. The patching operation uses the baselines provided in the JSON object that match
|
systems-manager-ug-189
|
systems-manager-ug.pdf
| 189 |
The result: Only Security patches, as defined in your default patch baseline, are installed each week. All available patches, or whatever subset of patches you define, are installed each month. For more information and sample lists, see Parameter name: InstallOverrideList. Using the BaselineOverride parameter You can define patching preferences at runtime using the baseline override feature in Patch Manager, a tool in AWS Systems Manager. Do this by specifying an Amazon Simple Storage Service (Amazon S3) bucket containing a JSON object with a list of patch baselines. The patching operation uses the baselines provided in the JSON object that match the host operating system instead of applying the rules from the default patch baseline. Patch Manager 581 AWS Systems Manager Important User Guide The BaselineOverride file name can't contain the following characters: backtick (`), single quote ('), double quote ("), and dollar sign ($). Except when a patching operation uses a patch policy, using the BaselineOverride parameter doesn't overwrite the patch compliance of the baseline provided in the parameter. The output results are recorded in the Stdout logs from Run Command, a tool in AWS Systems Manager. The results only print out packages that are marked as NON_COMPLIANT. This means the package is marked as Missing, Failed, InstalledRejected, or InstalledPendingReboot. When a patch operation uses a patch policy, however, the system passes the override parameter from the associated S3 bucket, and the compliance value is updated for the managed node. For more information about patch policy behaviors, see Patch policy configurations in Quick Setup. Using the patch baseline override with Snapshot Id or Install Override List parameters There are two cases where the patch baseline override has noteworthy behavior. Using baseline override and Snapshot Id at the same time Snapshot Ids ensure that all managed nodes in a particular patching command all apply the same thing. For example, if you patch 1,000 nodes at one time, the patches will be the same. When using both a Snapshot Id and a patch baseline override, the Snapshot Id takes precedence over the patch baseline override. The baseline override rules will still be used, but they will only be evaluated once. In the earlier example, the patches across your 1,000 managed nodes will still always be the same. If, midway through the patching operation, you changed the JSON file in the referenced S3 bucket to be something different, the patches applied will still be the same. This is because the Snapshot Id was provided. Using baseline override and Install Override List at the same time You can't use these two parameters at the same time. The patching document fails if both parameters are supplied, and it doesn't perform any scans or installs on the managed node. Code examples The following code example for Python shows how to generate the patch baseline override. Patch Manager 582 AWS Systems Manager import boto3 import json User Guide ssm = boto3.client('ssm') s3 = boto3.resource('s3') s3_bucket_name = 'my-baseline-override-bucket' s3_file_name = 'MyBaselineOverride.json' baseline_ids_to_export = ['pb-0000000000000000', 'pb-0000000000000001'] baseline_overrides = [] for baseline_id in baseline_ids_to_export: baseline_overrides.append(ssm.get_patch_baseline( BaselineId=baseline_id )) json_content = json.dumps(baseline_overrides, indent=4, sort_keys=True, default=str) s3.Object(bucket_name=s3_bucket_name, key=s3_file_name).put(Body=json_content) This produces a patch baseline override like the following. [ { "ApprovalRules": { "PatchRules": [ { "ApproveAfterDays": 0, "ComplianceLevel": "UNSPECIFIED", "EnableNonSecurity": false, "PatchFilterGroup": { "PatchFilters": [ { "Key": "PRODUCT", "Values": [ "*" ] }, { "Key": "CLASSIFICATION", "Values": [ "*" ] }, { Patch Manager 583 AWS Systems Manager User Guide "Key": "SEVERITY", "Values": [ "*" ] } ] } } ] }, "ApprovedPatches": [], "ApprovedPatchesComplianceLevel": "UNSPECIFIED", "ApprovedPatchesEnableNonSecurity": false, "GlobalFilters": { "PatchFilters": [] }, "OperatingSystem": "AMAZON_LINUX_2", "RejectedPatches": [], "RejectedPatchesAction": "ALLOW_AS_DEPENDENCY", "Sources": [] }, { "ApprovalRules": { "PatchRules": [ { "ApproveUntilDate": "2021-01-06", "ComplianceLevel": "UNSPECIFIED", "EnableNonSecurity": true, "PatchFilterGroup": { "PatchFilters": [ { "Key": "PRODUCT", "Values": [ "*" ] }, { "Key": "CLASSIFICATION", "Values": [ "*" ] }, { "Key": "SEVERITY", Patch Manager 584 AWS Systems Manager User Guide "Values": [ "*" ] } ] } } ] }, "ApprovedPatches": [ "open-ssl*" ], "ApprovedPatchesComplianceLevel": "UNSPECIFIED", "ApprovedPatchesEnableNonSecurity": false, "GlobalFilters": { "PatchFilters": [] }, "OperatingSystem": "CENTOS", "RejectedPatches": [ "python*" ], "RejectedPatchesAction": "ALLOW_AS_DEPENDENCY", "Sources": [] } ] Patch baselines The topics in this section provide information about how patch baselines work in Patch Manager, a tool in AWS Systems Manager, when you run a Scan or Install operation on your managed nodes. Topics • Predefined and custom patch baselines • Package name formats for approved and rejected patch lists • Patch groups • Patching applications released by Microsoft on Windows Server Patch Manager 585 AWS Systems Manager User Guide Predefined and custom patch baselines Patch Manager, a tool in AWS Systems Manager, provides predefined patch baselines for each of the operating systems supported by Patch Manager. You can use these baselines as they are currently configured (you can't customize them) or you can create your own custom patch baselines. Custom patch
|
systems-manager-ug-190
|
systems-manager-ug.pdf
| 190 |
you run a Scan or Install operation on your managed nodes. Topics • Predefined and custom patch baselines • Package name formats for approved and rejected patch lists • Patch groups • Patching applications released by Microsoft on Windows Server Patch Manager 585 AWS Systems Manager User Guide Predefined and custom patch baselines Patch Manager, a tool in AWS Systems Manager, provides predefined patch baselines for each of the operating systems supported by Patch Manager. You can use these baselines as they are currently configured (you can't customize them) or you can create your own custom patch baselines. Custom patch baselines allows you greater control over which patches are approved or rejected for your environment. Also, the predefined baselines assign a compliance level of Unspecified to all patches installed using those baselines. For compliance values to be assigned, you can create a copy of a predefined baseline and specify the compliance values you want to assign to patches. For more information, see Custom baselines and Working with custom patch baselines. Note The information in this topic applies no matter which method or type of configuration you are using for your patching operations: • A patch policy configured in Quick Setup • A Host Management option configured in Quick Setup • A maintenance window to run a patch Scan or Install task • An on-demand Patch now operation Topics • Predefined baselines • Custom baselines Predefined baselines The following table describes the predefined patch baselines provided with Patch Manager. For information about which versions of each operating system Patch Manager supports, see Patch Manager prerequisites. Name Supported operating system Details AWS-AlmaLinuxDefau AlmaLinux ltPatchBaseline Approves all operating system patches that are classified Patch Manager 586 AWS Systems Manager User Guide Name Supported operating system Details AWS-AmazonLinuxDef Amazon Linux 1 aultPatchBaseline AWS-AmazonLinux2De Amazon Linux 2 faultPatchBaseline as "Security" and that have a severity level of "Critical" or "Important". Also approves all patches that are classified as "Bugfix". Patches are auto- approved 7 days after they are released or updated.¹ Approves all operating system patches that are classified as "Security" and that have a severity level of "Critical " or "Important". Also auto- approves all patches with a classification of "Bugfix". Patches are auto-approved 7 days after they are released or updated.¹ Approves all operating system patches that are classified as "Security" and that have a severity level of "Critical" or "Important". Also approves all patches with a classific ation of "Bugfix". Patches are auto-approved 7 days after release.¹ Patch Manager 587 AWS Systems Manager User Guide Name Supported operating system Details AWS-AmazonLinux202 Amazon Linux 2022 2DefaultPatchBasel ine AWS-AmazonLinux202 Amazon Linux 2023 3DefaultPatchBasel ine AWS-CentOSDefaultP CentOS and CentOS Stream atchBaseline Approves all operating system patches that are classified as "Security" and that have a severity level of "Critical" or "Important". Patches are auto-approved seven days after release. Also approves all patches with a classific ation of "Bugfix" seven days after release. Approves all operating system patches that are classified as "Security" and that have a severity level of "Critical" or "Important". Patches are auto-approved seven days after release. Also approves all patches with a classific ation of "Bugfix" seven days after release. Approves all updates 7 days after they become available , including nonsecurity updates. Patch Manager 588 AWS Systems Manager User Guide Name Supported operating system Details AWS-DebianDefaultP Debian Server atchBaseline AWS-MacOSDefaultPa macOS tchBaseline AWS-OracleLinuxDef Oracle Linux aultPatchBaseline Immediately approves all operating system security- related patches that have a priority of "Required", "Important", "Standard," "Optional," or "Extra." There is no wait before approval because reliable release dates aren't available in the repositories. Approves all operating system patches that are classified as "Security". Also approves all packages with a current update. Approves all operating system patches that are classified as "Security" and that have a severity level of "Important" or "Moderate". Also approves all patches that are classifie d as "Bugfix" 7 days after release. Patches are auto-appr oved 7 days after they are released or updated.¹ Patch Manager 589 AWS Systems Manager User Guide Name Supported operating system Details AWS-DefaultRaspbia Raspberry Pi OS nPatchBaseline Immediately approves all operating system security- related patches that have a priority of "Required", "Important", "Standard," "Optional," or "Extra." There is no wait before approval because reliable release dates aren't available in the repositories. AWS-RedHatDefaultP atchBaseline Red Hat Enterprise Linux (RHEL) Approves all operating system patches that are classified AWS-RockyLinuxDefa Rocky Linux ultPatchBaseline as "Security" and that have a severity level of "Critical" or "Important". Also approves all patches that are classified as "Bugfix". Patches are auto- approved 7 days after they are released or updated.¹ Approves all operating system patches that are classified as "Security" and that have a severity level of "Critical" or "Important". Also approves all patches that are classified as "Bugfix". Patches are auto- approved
|
systems-manager-ug-191
|
systems-manager-ug.pdf
| 191 |
There is no wait before approval because reliable release dates aren't available in the repositories. AWS-RedHatDefaultP atchBaseline Red Hat Enterprise Linux (RHEL) Approves all operating system patches that are classified AWS-RockyLinuxDefa Rocky Linux ultPatchBaseline as "Security" and that have a severity level of "Critical" or "Important". Also approves all patches that are classified as "Bugfix". Patches are auto- approved 7 days after they are released or updated.¹ Approves all operating system patches that are classified as "Security" and that have a severity level of "Critical" or "Important". Also approves all patches that are classified as "Bugfix". Patches are auto- approved 7 days after they are released or updated.¹ Patch Manager 590 AWS Systems Manager User Guide Name Supported operating system Details AWS-SuseDefaultPat chBaseline SUSE Linux Enterprise Server (SLES) Approves all operating system patches that are classified as AWS-UbuntuDefaultP Ubuntu Server atchBaseline AWS-DefaultPatchBa Windows Server seline "Security" and with a severity of "Critical" or "Important". Patches are auto-approved 7 days after they are released or updated.¹ Immediately approves all operating system security- related patches that have a priority of "Required", "Important", "Standard," "Optional," or "Extra." There is no wait before approval because reliable release dates aren't available in the repositories. Approves all Windows Server operating system patches that are classified as "CriticalUpdates" or "Security Updates" and that have an MSRC severity of "Critical" or "Important". Patches are auto-approved 7 days after they are released or updated.² Patch Manager 591 AWS Systems Manager User Guide Name Supported operating system Details AWS-WindowsPredefi Windows Server nedPatchBaseline-OS AWS-WindowsPredefi Windows Server nedPatchBaseline-O S-Applications Approves all Windows Server operating system patches that are classified as "CriticalUpdates" or "Security Updates" and that have an MSRC severity of "Critical" or "Important". Patches are auto-approved 7 days after they are released or updated.² For the Windows Server operating system, approves all patches that are classifie d as "CriticalUpdates" or "SecurityUpdates" and that have an MSRC severity of "Critical" or "Important". For applications released by Microsoft, approves all patches. Patches for both OS and applications are auto- approved 7 days after they are released or updated.² ¹ For Amazon Linux 1 and Amazon Linux 2, the 7-day wait before patches are auto-approved is calculated from an Updated Date value in updateinfo.xml, not a Release Date value. Various factors can affect the Updated Date value. Other operating systems handle release and update dates differently. For information to help you avoid unexpected results with auto-approval delays, see How package release dates and update dates are calculated. ² For Windows Server, default baselines include a 7-day auto-approval delay. To install a patch within 7 days after release, you must create a custom baseline. Patch Manager 592 AWS Systems Manager Custom baselines User Guide Use the following information to help you create custom patch baselines to meet your patching goals. Topics • Using auto-approvals in custom baselines • Additional information for creating patch baselines Using auto-approvals in custom baselines If you create your own patch baseline, you can choose which patches to auto-approve by using the following categories. • Operating system: Windows Server, Amazon Linux, Ubuntu Server, and so on. • Product name (for operating systems): For example, RHEL 6.5, Amazon Linux 2014.09, Windows Server 2012, Windows Server 2012 R2, and so on. • Product name (for applications released by Microsoft on Windows Server only): For example, Word 2016, BizTalk Server, and so on. • Classification: For example, Critical updates, Security updates, and so on. • Severity: For example, Critical, Important, and so on. For each approval rule that you create, you can choose to specify an auto-approval delay or specify a patch approval cutoff date. Note Because it's not possible to reliably determine the release dates of update packages for Ubuntu Server, the auto-approval options aren't supported for this operating system. An auto-approval delay is the number of days to wait after the patch was released or last updated, before the patch is automatically approved for patching. For example, if you create a rule using the CriticalUpdates classification and configure it for 7 days auto-approval delay, then a new critical patch released on July 7 is automatically approved on July 14. Patch Manager 593 AWS Systems Manager User Guide If a Linux repository does not provide release date information for packages, Patch Manager uses the build time of the package as the date for auto-approval date specifications for Amazon Linux 1, Amazon Linux 2, SUSE Linux Enterprise Server (SLES), Red Hat Enterprise Linux (RHEL), and CentOS. If the build time of the package can't be determined, Patch Manager uses a default date of January 1st, 1970. This results in Patch Manager bypassing any auto-approval date specifications in patch baselines that are configured to approve patches for any date after January 1st, 1970. When you specify an auto-approval cutoff date, Patch Manager automatically applies all
|
systems-manager-ug-192
|
systems-manager-ug.pdf
| 192 |
not provide release date information for packages, Patch Manager uses the build time of the package as the date for auto-approval date specifications for Amazon Linux 1, Amazon Linux 2, SUSE Linux Enterprise Server (SLES), Red Hat Enterprise Linux (RHEL), and CentOS. If the build time of the package can't be determined, Patch Manager uses a default date of January 1st, 1970. This results in Patch Manager bypassing any auto-approval date specifications in patch baselines that are configured to approve patches for any date after January 1st, 1970. When you specify an auto-approval cutoff date, Patch Manager automatically applies all patches released or last updated on or before that date. For example, if you specify July 7, 2023 as the cutoff date, no patches released or last updated on or after July 8, 2023 are installed automatically. When you create a custom patch baseline, you can specify a compliance severity level for patches approved by that patch baseline, such as Critical or High. If the patch state of any approved patch is reported as Missing, then the patch baseline's overall reported compliance severity is the severity level you specified. Additional information for creating patch baselines Keep the following in mind when you create a patch baseline: • Patch Manager provides one predefined patch baseline for each supported operating system. These predefined patch baselines are used as the default patch baselines for each operating system type unless you create your own patch baseline and designate it as the default for the corresponding operating system type. Note For Windows Server, three predefined patch baselines are provided. The patch baselines AWS-DefaultPatchBaseline and AWS-WindowsPredefinedPatchBaseline- OS support only operating system updates on the Windows operating system itself. AWS-DefaultPatchBaseline is used as the default patch baseline for Windows Server managed nodes unless you specify a different patch baseline. The configuration settings in these two patch baselines are the same. The newer of the two, AWS- WindowsPredefinedPatchBaseline-OS, was created to distinguish it from the third predefined patch baseline for Windows Server. That patch baseline, AWS- WindowsPredefinedPatchBaseline-OS-Applications, can be used to apply patches to both the Windows Server operating system and supported applications released by Microsoft. Patch Manager 594 AWS Systems Manager User Guide • By default, Windows Server 2019 and Windows Server 2022 remove updates that are replaced by later updates. As a result, if you use the ApproveUntilDate parameter in a Windows Server patch baseline, but the date selected in the ApproveUntilDate parameter is before the date of the latest patch, then the new patch isn't installed when the patching operation runs. For more information about Windows Server patching rules, see the Windows Server tab in How security patches are selected. This means that the managed node is compliant in terms of Systems Manager operations, even though a critical patch from the previous month might not be installed. This same scenario can occur when using the ApproveAfterDays parameter. Because of the Microsoft superseded patch behavior, it is possible to set a number (generally greater than 30 days) so that patches for Windows Server are never installed if the latest available patch from Microsoft is released before the number of days in ApproveAfterDays has elapsed. • For Windows Server only, an available security update patch that is not approved by the patch baseline can have a compliance value or Compliant or Non-Compliant, as defined in a custom patch baseline. When you create or update a patch baseline, you choose the status you want to assign to security patches that are available but not approved because they don't meet the installation criteria specified in the patch baseline. For example, security patches that you might want installed can be skipped if you have specified a long period to wait after a patch is released before installation. If an update to the patch is released during your specified waiting period, the waiting period for installing the patch starts over. If the waiting period is too long, multiple versions of the patch could be released but never installed. Using the console to create or update a patch baseline, you specify this option in the Available security updates compliance status field. Using the AWS CLI to run the create-patch-baseline or update-patch-baseline command, you specify this option in the available-security- updates-compliance-status parameter. • For on-premises servers and virtual machines (VMs), Patch Manager attempts to use your custom default patch baseline. If no custom default patch baseline exists, the system uses the predefined patch baseline for the corresponding operating system. • If a patch is listed as both approved and rejected in the same patch baseline, the patch is rejected. • A managed node can have only one patch baseline defined for it. Patch Manager 595 AWS Systems Manager User Guide • The formats of package names you can add to lists of approved
|
systems-manager-ug-193
|
systems-manager-ug.pdf
| 193 |
you specify this option in the available-security- updates-compliance-status parameter. • For on-premises servers and virtual machines (VMs), Patch Manager attempts to use your custom default patch baseline. If no custom default patch baseline exists, the system uses the predefined patch baseline for the corresponding operating system. • If a patch is listed as both approved and rejected in the same patch baseline, the patch is rejected. • A managed node can have only one patch baseline defined for it. Patch Manager 595 AWS Systems Manager User Guide • The formats of package names you can add to lists of approved patches and rejected patches for a patch baseline depend on the type of operating system you're patching. For information about accepted formats for lists of approved patches and rejected patches, see Package name formats for approved and rejected patch lists. • If you are using a patch policy configuration in Quick Setup, updates you make to custom patch baselines are synchronized with Quick Setup once an hour. If a custom patch baseline that was referenced in a patch policy is deleted, a banner displays on the Quick Setup Configuration details page for your patch policy. The banner informs you that the patch policy references a patch baseline that no longer exists, and that subsequent patching operations will fail. In this case, return to the Quick Setup Configurations page, select the Patch Manager configuration , and choose Actions, Edit configuration. The deleted patch baseline name is highlighted, and you must select a new patch baseline for the affected operating system. For information about creating a patch baseline, see Working with custom patch baselines and Tutorial: Patch a server environment using the AWS CLI. Package name formats for approved and rejected patch lists The formats of package names you can add to lists of approved patches and rejected patches depend on the type of operating system you're patching. Package name formats for Linux operating systems The formats you can specify for approved and rejected patches in your patch baseline vary by Linux type. More specifically, the formats that are supported depend on the package manager used by the type of Linux operating system. Topics • Amazon Linux 1, Amazon Linux 2, Amazon Linux 2022, Amazon Linux 2023, CentOS, Oracle Linux, and Red Hat Enterprise Linux (RHEL) • Debian Server, Raspberry Pi OS (formerly Raspbian), and Ubuntu Server • SUSE Linux Enterprise Server (SLES) Patch Manager 596 AWS Systems Manager User Guide Amazon Linux 1, Amazon Linux 2, Amazon Linux 2022, Amazon Linux 2023, CentOS, Oracle Linux, and Red Hat Enterprise Linux (RHEL) Package manager: YUM, except for Amazon Linux 2022, Amazon Linux 2023, RHEL 8, and CentOS 8, which use DNF as the package manager Approved patches: For approved patches, you can specify any of the following: • Bugzilla IDs, in the format 1234567 (The system processes numbers-only strings as Bugzilla IDs.) • CVE IDs, in the format CVE-2018-1234567 • Advisory IDs, in formats such as RHSA-2017:0864 and ALAS-2018-123 • Package names that are constructed using one or more of the available components for package naming. To illustrate, for the package named dbus.x86_64:1:1.12.28-1.amzn2023.0.1, the components are as follows: • name: dbus • architecture: x86_64 • epoch: 1 • version: 1.12.28 • release: 1.amzn2023.0.1 Package names with the following constructions are supported: • name • name.arch • name-version • name-version-release • name-version-release.arch • version • version-release • epoch:version-release • name-epoch:version-release • name-epoch:version-release.arch • epoch:name-version-release.arch Patch Manager • name.arch:epoch:version-release 597 AWS Systems Manager Some examples: • dbus.x86_64 • dbus-1.12.28 User Guide • dbus-1.12.28-1.amzn2023.0.1 • dbus-1:1.12.28-1.amzn2023.0.1.x86_64 • We also support package name components with a single wild card in the above formats, such as the following: • dbus* • dbus-1.12.2* • dbus-*:1.12.28-1.amzn2023.0.1.x86_64 Rejected patches: For rejected patches, you can specify any of the following: • Package names that are constructed using one or more of the available components for package naming. To illustrate, for the package named dbus.x86_64:1:1.12.28-1.amzn2023.0.1, the components are as follows: • name: dbus • architecture; x86_64 • epoch: 1 • version: 1.12.28 • release: 1.amzn2023.0.1 Package names with the following constructions are supported: • name • name.arch • name-version • name-version-release • name-version-release.arch • version • version-release • epoch:version-release Patch Manager 598 AWS Systems Manager User Guide • name-epoch:version-release • name-epoch:version-release.arch • epoch:name-version-release.arch • name.arch:epoch:version-release Some examples: • dbus.x86_64 • dbus-1.12.28 • dbus-1.12.28-1.amzn2023.0.1 • dbus-1:1.12.28-1.amzn2023.0.1.x86_64 • We also support package name components with a single wild card in the above formats, such as the following: • dbus* • dbus-1.12.2* • dbus-*:1.12.28-1.amzn2023.0.1.x86_64 Debian Server, Raspberry Pi OS (formerly Raspbian), and Ubuntu Server Package manager: APT Approved patches and rejected patches: For both approved and rejected patches, specify the following: • Package names, in the format ExamplePkg33 Note For Debian Server lists, Raspberry Pi OS lists, and Ubuntu Server lists, don't include elements such
|
systems-manager-ug-194
|
systems-manager-ug.pdf
| 194 |
AWS Systems Manager User Guide • name-epoch:version-release • name-epoch:version-release.arch • epoch:name-version-release.arch • name.arch:epoch:version-release Some examples: • dbus.x86_64 • dbus-1.12.28 • dbus-1.12.28-1.amzn2023.0.1 • dbus-1:1.12.28-1.amzn2023.0.1.x86_64 • We also support package name components with a single wild card in the above formats, such as the following: • dbus* • dbus-1.12.2* • dbus-*:1.12.28-1.amzn2023.0.1.x86_64 Debian Server, Raspberry Pi OS (formerly Raspbian), and Ubuntu Server Package manager: APT Approved patches and rejected patches: For both approved and rejected patches, specify the following: • Package names, in the format ExamplePkg33 Note For Debian Server lists, Raspberry Pi OS lists, and Ubuntu Server lists, don't include elements such as architecture or versions. For example, you specify the package name ExamplePkg33 to include all the following in a patch list: • ExamplePkg33.x86.1 • ExamplePkg33.x86.2 • ExamplePkg33.x64.1 • ExamplePkg33.3.2.5-364.noarch Patch Manager 599 AWS Systems Manager User Guide SUSE Linux Enterprise Server (SLES) Package manager: Zypper Approved patches and rejected patches: For both approved and rejected patch lists, you can specify any of the following: • Full package names, in formats such as: • SUSE-SLE-Example-Package-12-2018-123 • example-pkg-2018.11.4-46.17.1.x86_64.rpm • Package names with a single wildcard, such as: • SUSE-SLE-Example-Package-12-2018-* • example-pkg-2018.11.4-46.17.1.*.rpm Package name formats for macOS Supported package managers: softwareupdate, installer, Brew, Brew Cask Approved patches and rejected patches: For both approved and rejected patch lists, you specify full package names, in formats such as: • XProtectPlistConfigData • MRTConfigData Wildcards aren't supported in approved and rejected patch lists for macOS. Package name formats for Windows operating systems For Windows operating systems, specify patches using Microsoft Knowledge Base IDs and Microsoft Security Bulletin IDs; for example: KB2032276,KB2124261,MS10-048 Patch Manager 600 AWS Systems Manager Patch groups Note User Guide Patch groups are not used in patching operations that are based on patch policies. For information about working with patch policies, see Patch policy configurations in Quick Setup. Patch group functionality is not supported in the console for account-Region pairs that did not already use patch groups before patch policy support was released on December 22, 2022. Patch group functionality is still available in account-Region pairs that began using patch groups before this date. You can use a patch group to associate managed nodes with a specific patch baseline in Patch Manager, a tool in AWS Systems Manager. Patch groups help ensure that you're deploying the appropriate patches, based on the associated patch baseline rules, to the correct set of nodes. Patch groups can also help you avoid deploying patches before they have been adequately tested. For example, you can create patch groups for different environments (such as Development, Test, and Production) and register each patch group to an appropriate patch baseline. When you run AWS-RunPatchBaseline or other SSM Command documents for patching, you can target managed nodes using their ID or tags. SSM Agent and Patch Manager then evaluate which patch baseline to use based on the patch group value that you added to the managed node. Using tags to define patch groups You create a patch group by using tags applied to your Amazon Elastic Compute Cloud (Amazon EC2) instances and non-EC2 nodes in a hybrid and multicloud environment. Note the following details about using tags for patch groups: • A patch group must be defined using either the tag key Patch Group or PatchGroup applied to your managed nodes. When registering a patch group for a patch baseline, any identical values specified for these two keys are interpreted to be part of the same group. For instance, say that you have tagged five nodes with the first of the following key-value pairs, and five with the second: • key=PatchGroup,value=DEV • key=Patch Group,value=DEV Patch Manager 601 AWS Systems Manager User Guide The Patch Manager command to create a baseline combines these 10 managed nodes into a single group based on the value DEV. The AWS CLI equivalent for the command to create a patch baseline for patch groups is as follows: aws ssm register-patch-baseline-for-patch-group \ --baseline-id pb-0c10e65780EXAMPLE \ --patch-group DEV Combining values from different keys into a single target is unique to this Patch Manager command for creating a new patch group and not supported by other API actions. For example, if you run send-command actions using PatchGroup and Patch Group keys with the same values, you are targeting two completely different sets of nodes: aws ssm send-command \ --document-name AWS-RunPatchBaseline \ --targets "Key=tag:PatchGroup,Values=DEV" aws ssm send-command \ --document-name AWS-RunPatchBaseline \ --targets "Key=tag:Patch Group,Values=DEV" • There are limits on tag-based targeting. Each array of targets for SendCommand can contain a maximum of five key-value pairs. • We recommend that you choose only one of these tag key conventions, either PatchGroup (without a space) or Patch Group (with a space). However, if you have allowed tags in EC2 instance metadata on an instance, you must use PatchGroup. • The key is case-sensitive. You can
|
systems-manager-ug-195
|
systems-manager-ug.pdf
| 195 |
the same values, you are targeting two completely different sets of nodes: aws ssm send-command \ --document-name AWS-RunPatchBaseline \ --targets "Key=tag:PatchGroup,Values=DEV" aws ssm send-command \ --document-name AWS-RunPatchBaseline \ --targets "Key=tag:Patch Group,Values=DEV" • There are limits on tag-based targeting. Each array of targets for SendCommand can contain a maximum of five key-value pairs. • We recommend that you choose only one of these tag key conventions, either PatchGroup (without a space) or Patch Group (with a space). However, if you have allowed tags in EC2 instance metadata on an instance, you must use PatchGroup. • The key is case-sensitive. You can specify any value to help you identify and target the resources in that group, for example "web servers" or "US-EAST-PROD", but the key must be Patch Group or PatchGroup. After you create a patch group and tag managed nodes, you can register the patch group with a patch baseline. Registering the patch group with a patch baseline ensures that the nodes within the patch group use the rules defined in the associated patch baseline. For more information about how to create a patch group and associate the patch group to a patch baseline, see Creating and managing patch groups and Add a patch group to a patch baseline. Patch Manager 602 AWS Systems Manager User Guide To view an example of creating a patch baseline and patch groups by using the AWS Command Line Interface (AWS CLI), see Tutorial: Patch a server environment using the AWS CLI. For more information about Amazon EC2 tags, see Tag your Amazon EC2 resources in the Amazon EC2 User Guide. How it works When the system runs the task to apply a patch baseline to a managed node, SSM Agent verifies that a patch group value is defined for the node. If the node is assigned to a patch group, Patch Manager then verifies which patch baseline is registered to that group. If a patch baseline is found for that group, Patch Manager notifies SSM Agent to use the associated patch baseline. If a node isn't configured for a patch group, Patch Manager automatically notifies SSM Agent to use the currently configured default patch baseline. Important A managed node can only be in one patch group. A patch group can be registered with only one patch baseline for each operating system type. You can't apply the Patch Group tag (with a space) to an Amazon EC2 instance if the Allow tags in instance metadata option is enabled on the instance. Allowing tags in instance metadata prevents tag key names from containing spaces. If you have allowed tags in EC2 instance metadata, you must use the tag key PatchGroup (without a space). Diagram 1: General example of patching operations process flow The following illustration shows a general example of the processes that Systems Manager performs when sending a Run Command task to your fleet of servers to patch using Patch Manager. These processes determine which patch baselines to use in patching operations. (A similar process is used when a maintenance window is configured to send a command to patch using Patch Manager.) The full process is explained below the illustration. Patch Manager 603 AWS Systems Manager User Guide In this example, we have three groups of EC2 instances for Windows Server with the following tags applied: Patch Manager 604 AWS Systems Manager User Guide EC2 instances group Tags Group 1 Group 2 Group 3 key=OS,value=Windows key=PatchGroup,value=DEV key=OS,value=Windows key=OS,value=Windows key=PatchGroup,value=QA For this example, we also have these two Windows Server patch baselines: Patch baseline ID Default Associated patch group pb-0123456789abcdef0 pb-9876543210abcdef0 Yes No Default DEV The general process to scan or install patches using Run Command, a tool in AWS Systems Manager, and Patch Manager is as follows: 1. Send a command to patch: Use the Systems Manager console, SDK, AWS Command Line Interface (AWS CLI), or AWS Tools for Windows PowerShell to send a Run Command task using the document AWS-RunPatchBaseline. The diagram shows a Run Command task to patch managed instances by targeting the tag key=OS,value=Windows. 2. Patch baseline determination: SSM Agent verifies the patch group tags applied to the EC2 instance and queries Patch Manager for the corresponding patch baseline. • Matching patch group value associated with patch baseline: 1. SSM Agent, which is installed on EC2 instances in group one, receives the command issued in Step 1 to begin a patching operation. SSM Agent validates that the EC2 instances have the patch group tag-value DEV applied and queries Patch Manager for an associated patch baseline. Patch Manager 605 AWS Systems Manager User Guide 2. Patch Manager verifies that patch baseline pb-9876543210abcdef0 has the patch group DEV associated and notifies SSM Agent. 3. SSM Agent retrieves a patch baseline snapshot from Patch Manager based on the approval rules and exceptions configured in pb-9876543210abcdef0
|
systems-manager-ug-196
|
systems-manager-ug.pdf
| 196 |
group value associated with patch baseline: 1. SSM Agent, which is installed on EC2 instances in group one, receives the command issued in Step 1 to begin a patching operation. SSM Agent validates that the EC2 instances have the patch group tag-value DEV applied and queries Patch Manager for an associated patch baseline. Patch Manager 605 AWS Systems Manager User Guide 2. Patch Manager verifies that patch baseline pb-9876543210abcdef0 has the patch group DEV associated and notifies SSM Agent. 3. SSM Agent retrieves a patch baseline snapshot from Patch Manager based on the approval rules and exceptions configured in pb-9876543210abcdef0 and proceeds to the next step. • No patch group tag added to instance: 1. SSM Agent, which is installed on EC2 instances in group two, receives the command issued in Step 1 to begin a patching operation. SSM Agent validates that the EC2 instances don't have a Patch Group or PatchGroup tag applied and as a result, SSM Agent queries Patch Manager for the default Windows patch baseline. 2. Patch Manager verifies that the default Windows Server patch baseline is pb-0123456789abcdef0 and notifies SSM Agent. 3. SSM Agent retrieves a patch baseline snapshot from Patch Manager based on the approval rules and exceptions configured in the default patch baseline pb-0123456789abcdef0 and proceeds to the next step. • No matching patch group value associated with a patch baseline: 1. SSM Agent, which is installed on EC2 instances in group three, receives the command issued in Step 1 to begin a patching operation. SSM Agent validates that the EC2 instances have the patch group tag-value QA applied and queries Patch Manager for an associated patch baseline. 2. Patch Manager doesn't find a patch baseline that has the patch group QA associated. 3. Patch Manager notifies SSM Agent to use the default Windows patch baseline pb-0123456789abcdef0. 4. SSM Agent retrieves a patch baseline snapshot from Patch Manager based on the approval rules and exceptions configured in the default patch baseline pb-0123456789abcdef0 and proceeds to the next step. 3. Patch scan or install: After determining the appropriate patch baseline to use, SSM Agent begins either scanning for or installing patches based on the operation value specified in Step 1. The patches that are scanned for or installed are determined by the approval rules and patch exceptions defined in the patch baseline snapshot provided by Patch Manager. Patch Manager 606 AWS Systems Manager More info • Patch compliance state values User Guide Patching applications released by Microsoft on Windows Server Use the information in this topic to help you prepare to patch applications on Windows Server using Patch Manager, a tool in AWS Systems Manager. Microsoft application patching Patching support for applications on Windows Server managed nodes is limited to applications released by Microsoft. Note In some cases, Microsoft releases patches for applications that don't specify an updated date and time. In these cases, an updated date and time of 01/01/1970 is supplied by default. Patch baselines to patch applications released by Microsoft For Windows Server, three predefined patch baselines are provided. The patch baselines AWS- DefaultPatchBaseline and AWS-WindowsPredefinedPatchBaseline-OS support only operating system updates on the Windows operating system itself. AWS-DefaultPatchBaseline is used as the default patch baseline for Windows Server managed nodes unless you specify a different patch baseline. The configuration settings in these two patch baselines are the same. The newer of the two, AWS-WindowsPredefinedPatchBaseline-OS, was created to distinguish it from the third predefined patch baseline for Windows Server. That patch baseline, AWS- WindowsPredefinedPatchBaseline-OS-Applications, can be used to apply patches to both the Windows Server operating system and supported applications released by Microsoft. You can also create a custom patch baseline to update applications released by Microsoft on Windows Server machines. Support for patching applications released by Microsoft on on-premises servers, edge devices, VMs, and other non-EC2 nodes To patch applications released by Microsoft on virtual machines (VMs) and other non-EC2 managed nodes, you must turn on the advanced-instances tier. There is a charge to use the advanced- Patch Manager 607 AWS Systems Manager User Guide instances tier. However, there is no additional charge to patch applications released by Microsoft on Amazon Elastic Compute Cloud (Amazon EC2) instances. For more information, see Configuring instance tiers. Windows update option for "other Microsoft products" In order for Patch Manager to be able to patch applications released by Microsoft on your Windows Server managed nodes, the Windows Update option Give me updates for other Microsoft products when I update Windows must be activated on the managed node. For information about allowing this option on a single managed node, see Update Office with Microsoft Update on the Microsoft Support website. For a fleet of managed nodes running Windows Server 2016 and later, you can use a Group Policy Object (GPO) to turn on the setting. In
|
systems-manager-ug-197
|
systems-manager-ug.pdf
| 197 |
Configuring instance tiers. Windows update option for "other Microsoft products" In order for Patch Manager to be able to patch applications released by Microsoft on your Windows Server managed nodes, the Windows Update option Give me updates for other Microsoft products when I update Windows must be activated on the managed node. For information about allowing this option on a single managed node, see Update Office with Microsoft Update on the Microsoft Support website. For a fleet of managed nodes running Windows Server 2016 and later, you can use a Group Policy Object (GPO) to turn on the setting. In the Group Policy Management Editor, go to Computer Configuration, Administrative Templates, Windows Components, Windows Updates, and choose Install updates for other Microsoft products. We also recommend configuring the GPO with additional parameters that prevent unplanned automatic updates and reboots outside of Patch Manager. For more information, see Configuring Automatic Updates in a Non-Active Directory Environment on the Microsoft technical documentation website. For a fleet of managed nodes running Windows Server 2012 or 2012 R2 , you can turn on the option by using a script, as described in Enabling and Disabling Microsoft Update in Windows 7 via Script on the Microsoft Docs Blog website. For example, you could do the following: 1. Save the script from the blog post in a file. 2. Upload the file to an Amazon Simple Storage Service (Amazon S3) bucket or other accessible location. 3. Use Run Command, a tool in AWS Systems Manager, to run the script on your managed nodes using the Systems Manager document (SSM document) AWS-RunPowerShellScript with a command similar to the following. Invoke-WebRequest ` -Uri "https://s3.aws-api-domain/amzn-s3-demo-bucket/script.vbs" ` -Outfile "C:\script.vbs" cscript c:\script.vbs Minimum parameter requirements Patch Manager 608 AWS Systems Manager User Guide To include applications released by Microsoft in your custom patch baseline, you must, at a minimum, specify the product that you want to patch. The following AWS Command Line Interface (AWS CLI) command demonstrates the minimal requirements to patch a product, such as Microsoft Office 2016. Linux & macOS aws ssm create-patch-baseline \ --name "My-Windows-App-Baseline" \ --approval-rules "PatchRules=[{PatchFilterGroup={PatchFilters=[{Key=PRODUCT,Values='Office 2016'}, {Key=PATCH_SET,Values='APPLICATION'}]},ApproveAfterDays=5}]" Windows Server aws ssm create-patch-baseline ^ --name "My-Windows-App-Baseline" ^ --approval-rules "PatchRules=[{PatchFilterGroup={PatchFilters=[{Key=PRODUCT,Values='Office 2016'}, {Key=PATCH_SET,Values='APPLICATION'}]},ApproveAfterDays=5}]" If you specify the Microsoft application product family, each product you specify must be a supported member of the selected product family. For example, to patch the product "Active Directory Rights Management Services Client 2.0," you must specify its product family as "Active Directory" and not, for example, "Office" or "SQL Server." The following AWS CLI command demonstrates a matched pairing of product family and product. Linux & macOS aws ssm create-patch-baseline \ --name "My-Windows-App-Baseline" \ --approval-rules "PatchRules=[{PatchFilterGroup={PatchFilters=[{Key=PRODUCT_FAMILY,Values='Active Directory'},{Key=PRODUCT,Values='Active Directory Rights Management Services Client 2.0'},{Key=PATCH_SET,Values='APPLICATION'}]},ApproveAfterDays=5}]" Windows Server aws ssm create-patch-baseline ^ --name "My-Windows-App-Baseline" ^ Patch Manager 609 AWS Systems Manager User Guide --approval-rules "PatchRules=[{PatchFilterGroup={PatchFilters=[{Key=PRODUCT_FAMILY,Values='Active Directory'},{Key=PRODUCT,Values='Active Directory Rights Management Services Client 2.0'},{Key=PATCH_SET,Values='APPLICATION'}]},ApproveAfterDays=5}]" Note If you receive an error message about a mismatched product and family pairing, see Issue: mismatched product family/product pairs for help resolving the issue. Using Kernel Live Patching on Amazon Linux 2 managed nodes Kernel Live Patching for Amazon Linux 2 allows you to apply security vulnerability and critical bug patches to a running Linux kernel without reboots or disruptions to running applications. This allows you to benefit from improved service and application availability, while keeping your infrastructure secure and up to date. Kernel Live Patching is supported on Amazon EC2 instances, AWS IoT Greengrass core devices, and on-premises virtual machines running Amazon Linux 2. For general information about Kernel Live Patching, see Kernel Live Patching on AL2 in the Amazon Linux 2 User Guide. After you turn on Kernel Live Patching on an Amazon Linux 2 managed node, you can use Patch Manager, a tool in AWS Systems Manager, to apply kernel live patches to the managed node. Using Patch Manager is an alternative to using existing yum workflows on the node to apply the updates. Before you begin To use Patch Manager to apply kernel live patches to your Amazon Linux 2 managed nodes, ensure your nodes are based on the correct architecture and kernel version. For information, see Supported configurations and prerequisites in the Amazon EC2 User Guide. Topics • Kernel Live Patching using Patch Manager • How Kernel Live Patching using Patch Manager works • Turning on Kernel Live Patching using Run Command • Applying kernel live patches using Run Command Patch Manager 610 AWS Systems Manager User Guide • Turning off Kernel Live Patching using Run Command Kernel Live Patching using Patch Manager Updating the kernel version You don't need to reboot a managed node after applying a kernel live patch update. However, AWS provides kernel live patches for an Amazon Linux 2 kernel version for up to three months after its release. After the three-month period, you
|
systems-manager-ug-198
|
systems-manager-ug.pdf
| 198 |
Kernel Live Patching using Patch Manager • How Kernel Live Patching using Patch Manager works • Turning on Kernel Live Patching using Run Command • Applying kernel live patches using Run Command Patch Manager 610 AWS Systems Manager User Guide • Turning off Kernel Live Patching using Run Command Kernel Live Patching using Patch Manager Updating the kernel version You don't need to reboot a managed node after applying a kernel live patch update. However, AWS provides kernel live patches for an Amazon Linux 2 kernel version for up to three months after its release. After the three-month period, you must update to a later kernel version to continue to receive kernel live patches. We recommend using a maintenance window to schedule a reboot of your node at least once every three months to prompt the kernel version update. Uninstalling kernel live patches Kernel live patches can't be uninstalled using Patch Manager. Instead, you can turn off Kernel Live Patching, which removes the RPM packages for the applied kernel live patches. For more information, see Turning off Kernel Live Patching using Run Command. Kernel compliance In some cases, installing all CVE fixes from live patches for the current kernel version can bring that kernel into the same compliance state that a newer kernel version would have. When that happens, the newer version is reported as Installed, and the managed node reported as Compliant. No installation time is reported for newer kernel version, however. One kernel live patch, multiple CVEs If a kernel live patch addresses multiple CVEs, and those CVEs have various classification and severity values, only the highest classification and severity from among the CVEs is reported for the patch. The remainder of this section describes how to use Patch Manager to apply kernel live patches to managed nodes that meet these requirements. How Kernel Live Patching using Patch Manager works AWS releases two types of kernel live patches for Amazon Linux 2: security updates and bug fixes. To apply those types of patches, you use a patch baseline document that targets only the classifications and severities listed in the following table. Patch Manager 611 AWS Systems Manager Classification Security Bugfix User Guide Severity Critical, Important All You can create a custom patch baseline that targets only these patches, or use the predefined AWS-AmazonLinux2DefaultPatchBaseline patch baseline. In other words, you can use AWS- AmazonLinux2DefaultPatchBaseline with Amazon Linux 2 managed nodes on which Kernel Live Patching is turned on, and kernel live updates will be applied. Note The AWS-AmazonLinux2DefaultPatchBaseline configuration specifies a 7-day waiting period after a patch is released or last updated before it's installed automatically. If you don't want to wait 7 days for kernel live patches to be auto-approved, you can create and use a custom patch baseline. In your patch baseline, you can specify no auto-approval waiting period, or specify a shorter or longer one. For more information, see Working with custom patch baselines. We recommend the following strategy to patch your managed nodes with kernel live updates: 1. Turn on Kernel Live Patching on your Amazon Linux 2 managed nodes. 2. Use Run Command, a tool in AWS Systems Manager, to run a Scan operation on your managed nodes using the predefined AWS-AmazonLinux2DefaultPatchBaseline or a custom patch baseline that also targets only Security updates with severity classified as Critical and Important, and the Bugfix severity of All. 3. Use Compliance, a tool in AWS Systems Manager, to review whether non-compliance for patching is reported for any of the managed nodes that were scanned. If so, view the node compliance details to determine whether any kernel live patches are missing from the managed node. 4. To install missing kernel live patches, use Run Command with the same patch baseline you specified before, but this time run an Install operation instead of a Scan operation. Patch Manager 612 AWS Systems Manager User Guide Because kernel live patches are installed without the need to reboot, you can choose the NoReboot reboot option for this operation. Note You can still reboot the managed node if required for other types of patches installed on it, or if you want to update to a newer kernel. In these cases, choose the RebootIfNeeded reboot option instead. 5. Return to Compliance to verify that the kernel live patches were installed. Turning on Kernel Live Patching using Run Command To turn on Kernel Live Patching, you can either run yum commands on your managed nodes or use Run Command and a custom Systems Manager document (SSM document) that you create. For information about turning on Kernel Live Patching by running yum commands directly on the managed node, see Enable Kernel Live Patching in the Amazon EC2 User Guide. Note When you turn on Kernel Live Patching, if the kernel already running on the managed
|
systems-manager-ug-199
|
systems-manager-ug.pdf
| 199 |
RebootIfNeeded reboot option instead. 5. Return to Compliance to verify that the kernel live patches were installed. Turning on Kernel Live Patching using Run Command To turn on Kernel Live Patching, you can either run yum commands on your managed nodes or use Run Command and a custom Systems Manager document (SSM document) that you create. For information about turning on Kernel Live Patching by running yum commands directly on the managed node, see Enable Kernel Live Patching in the Amazon EC2 User Guide. Note When you turn on Kernel Live Patching, if the kernel already running on the managed node is earlier than kernel-4.14.165-131.185.amzn2.x86_64 (the minimum supported version), the process installs the latest available kernel version and reboots the managed node. If the node is already running kernel-4.14.165-131.185.amzn2.x86_64 or later, the process doesn't install a newer version and doesn't reboot the node. To turn on Kernel Live Patching using Run Command (console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Run Command. 3. Choose Run command. 4. In the Command document list, choose the custom SSM document AWS- ConfigureKernelLivePatching. Patch Manager 613 AWS Systems Manager User Guide 5. In the Command parameters section, specify whether you want managed nodes to reboot as part of this operation. 6. For information about working with the remaining controls on this page, see Running commands from the console. 7. Choose Run. To turn on Kernel Live Patching (AWS CLI) • Run the following command on your local machine. Linux & macOS aws ssm send-command \ --document-name "AWS-ConfigureKernelLivePatching" \ --parameters "EnableOrDisable=Enable" \ --targets "Key=instanceids,Values=instance-id" Windows Server aws ssm send-command ^ --document-name "AWS-ConfigureKernelLivePatching" ^ --parameters "EnableOrDisable=Enable" ^ --targets "Key=instanceids,Values=instance-id" Replace instance-id with the ID of the Amazon Linux 2 managed node on which you want to turn on the feature, such as i-02573cafcfEXAMPLE. To turn on the feature on multiple managed nodes, you can use either of the following formats. • --targets "Key=instanceids,Values=instance-id1,instance-id2" • --targets "Key=tag:tag-key,Values=tag-value" For information about other options you can use in the command, see send-command in the AWS CLI Command Reference. Patch Manager 614 AWS Systems Manager User Guide Applying kernel live patches using Run Command To apply kernel live patches, you can either run yum commands on your managed nodes or use Run Command and the SSM document AWS-RunPatchBaseline. For information about applying kernel live patches by running yum commands directly on the managed node, see Apply kernel live patches in the Amazon EC2 User Guide. To apply kernel live patches using Run Command (console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Run Command. 3. Choose Run command. 4. 5. In the Command document list, choose the SSM document AWS-RunPatchBaseline. In the Command parameters section, do one of the following: • If you're checking whether new kernel live patches are available, for Operation, choose Scan. For Reboot Option, if don't want your managed nodes to reboot after this operation, choose NoReboot. After the operation is complete, you can check for new patches and compliance status in Compliance. • If you checked patch compliance already and are ready to apply available kernel live patches, for Operation, choose Install. For Reboot Option, if you don't want your managed nodes to reboot after this operation, choose NoReboot. 6. For information about working with the remaining controls on this page, see Running commands from the console. 7. Choose Run. To apply kernel live patches using Run Command (AWS CLI) 1. To perform a Scan operation before checking your results in Compliance, run the following command from your local machine. Linux & macOS aws ssm send-command \ --document-name "AWS-RunPatchBaseline" \ Patch Manager 615 AWS Systems Manager User Guide --targets "Key=InstanceIds,Values=instance-id" \ --parameters '{"Operation":["Scan"],"RebootOption":["RebootIfNeeded"]}' Windows Server aws ssm send-command ^ --document-name "AWS-RunPatchBaseline" ^ --targets "Key=InstanceIds,Values=instance-id" ^ --parameters {\"Operation\":[\"Scan\"],\"RebootOption\":[\"RebootIfNeeded \"]} For information about other options you can use in the command, see send-command in the AWS CLI Command Reference. 2. To perform an Install operation after checking your results in Compliance, run the following command from your local machine. Linux & macOS aws ssm send-command \ --document-name "AWS-RunPatchBaseline" \ --targets "Key=InstanceIds,Values=instance-id" \ --parameters '{"Operation":["Install"],"RebootOption":["NoReboot"]}' Windows Server aws ssm send-command ^ --document-name "AWS-RunPatchBaseline" ^ --targets "Key=InstanceIds,Values=instance-id" ^ --parameters {\"Operation\":[\"Install\"],\"RebootOption\":[\"NoReboot\"]} In both of the preceding commands, replace instance-id with the ID of the Amazon Linux 2 managed node on which you want to apply kernel live patches, such as i-02573cafcfEXAMPLE. To turn on the feature on multiple managed nodes, you can use either of the following formats. • --targets "Key=instanceids,Values=instance-id1,instance-id2" • --targets "Key=tag:tag-key,Values=tag-value" Patch Manager 616 AWS Systems Manager User Guide For information about other options you can use in these commands, see send-command in the AWS CLI Command Reference. Turning off Kernel Live Patching using Run Command To turn off Kernel
|
systems-manager-ug-200
|
systems-manager-ug.pdf
| 200 |
--document-name "AWS-RunPatchBaseline" ^ --targets "Key=InstanceIds,Values=instance-id" ^ --parameters {\"Operation\":[\"Install\"],\"RebootOption\":[\"NoReboot\"]} In both of the preceding commands, replace instance-id with the ID of the Amazon Linux 2 managed node on which you want to apply kernel live patches, such as i-02573cafcfEXAMPLE. To turn on the feature on multiple managed nodes, you can use either of the following formats. • --targets "Key=instanceids,Values=instance-id1,instance-id2" • --targets "Key=tag:tag-key,Values=tag-value" Patch Manager 616 AWS Systems Manager User Guide For information about other options you can use in these commands, see send-command in the AWS CLI Command Reference. Turning off Kernel Live Patching using Run Command To turn off Kernel Live Patching, you can either run yum commands on your managed nodes or use Run Command and the custom SSM document AWS-ConfigureKernelLivePatching. Note If you no longer need to use Kernel Live Patching, you can turn it off at any time. In most cases, turning off the feature isn't necessary. For information about turning off Kernel Live Patching by running yum commands directly on the managed node, see Enable Kernel Live Patching in the Amazon EC2 User Guide. Note When you turn off Kernel Live Patching, the process uninstalls the Kernel Live Patching plugin and then reboots the managed node. To turn off Kernel Live Patching using Run Command (console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Run Command. 3. Choose Run command. 4. 5. 6. In the Command document list, choose the SSM document AWS- ConfigureKernelLivePatching. In the Command parameters section, specify values for required parameters. For information about working with the remaining controls on this page, see Running commands from the console. 7. Choose Run. Patch Manager 617 AWS Systems Manager User Guide To turn off Kernel Live Patching (AWS CLI) • Run a command similar to the following. Linux & macOS aws ssm send-command \ --document-name "AWS-ConfigureKernelLivePatching" \ --targets "Key=instanceIds,Values=instance-id" \ --parameters "EnableOrDisable=Disable" Windows Server aws ssm send-command ^ --document-name "AWS-ConfigureKernelLivePatching" ^ --targets "Key=instanceIds,Values=instance-id" ^ --parameters "EnableOrDisable=Disable" Replace instance-id with the ID of the Amazon Linux 2 managed node on which you want to turn off the feature, such as i-02573cafcfEXAMPLE. To turn off the feature on multiple managed nodes, you can use either of the following formats. • --targets "Key=instanceids,Values=instance-id1,instance-id2" • --targets "Key=tag:tag-key,Values=tag-value" For information about other options you can use in the command, see send-command in the AWS CLI Command Reference. Working with Patch Manager resources and compliance using the console To use Patch Manager, a tool in AWS Systems Manager, complete the following tasks. These tasks are described in more detail in this section. 1. Verify that the AWS predefined patch baseline for each operating system type that you use meets your needs. If it doesn't, create a patch baseline that defines a standard set of patches for that managed node type and set it as the default instead. Patch Manager 618 AWS Systems Manager User Guide 2. Organize managed nodes into patch groups by using Amazon Elastic Compute Cloud (Amazon EC2) tags (optional, but recommended). 3. Do one of the following: • (Recommended) Configure a patch policy in Quick Setup, a tool in Systems Manager, that lets you install missing patches on a schedule for an entire organization, a subset of organizational units, or a single AWS account. For more information, see Configure patching for instances in an organization using a Quick Setup patch policy. • Create a maintenance window that uses the Systems Manager document (SSM document) AWS-RunPatchBaseline in a Run Command task type. For more information, see Tutorial: Create a maintenance window for patching using the console. • Manually run AWS-RunPatchBaseline in a Run Command operation. For more information, see Running commands from the console. • Manually patch nodes on demand using the Patch now feature. For more information, see Patching managed nodes on demand. 4. Monitor patching to verify compliance and investigate failures. Topics • Creating a patch policy • Viewing patch Dashboard summaries • Working with patch compliance reports • Patching managed nodes on demand • Working with patch baselines • Viewing available patches • Creating and managing patch groups • Integrating Patch Manager with AWS Security Hub Creating a patch policy A patch policy is a configuration you set up using Quick Setup, a tool in AWS Systems Manager. Patch policies provide more extensive and more centralized control over your patching operations than is available with other methods of configuring patching. A patch policy defines the schedule and baseline to use when automatically patching your nodes and applications. For more information, see the following topics: Patch Manager 619 AWS Systems Manager User Guide • Patch policy configurations in Quick Setup • Configure patching for instances in an organization using a Quick Setup patch policy Viewing patch Dashboard summaries The Dashboard tab in Patch Manager provides you with a summary
|
systems-manager-ug-201
|
systems-manager-ug.pdf
| 201 |
up using Quick Setup, a tool in AWS Systems Manager. Patch policies provide more extensive and more centralized control over your patching operations than is available with other methods of configuring patching. A patch policy defines the schedule and baseline to use when automatically patching your nodes and applications. For more information, see the following topics: Patch Manager 619 AWS Systems Manager User Guide • Patch policy configurations in Quick Setup • Configure patching for instances in an organization using a Quick Setup patch policy Viewing patch Dashboard summaries The Dashboard tab in Patch Manager provides you with a summary view in the console that you can use to monitor your patching operations in a consolidated view. Patch Manager is a tool in AWS Systems Manager. On the Dashboard tab, you can view the following: • A snapshot of how many managed nodes are compliant and noncompliant with patching rules. • A snapshot of the age of patch compliance results for your managed nodes. • A linked count of how many noncompliant managed nodes there are for each of the most common reasons for noncompliance. • A linked list of the most recent patching operations. • A linked list of the recurring patching tasks that have been set up. To view patch Dashboard summaries 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Patch Manager. 3. Choose the Dashboard tab. 4. Scroll to the section containing summary data that you want to view: • Amazon EC2 instance management • Compliance summary • Noncompliance counts • Compliance reports • Non-patch policy-based operations • Non-patch policy-based recurring tasks Working with patch compliance reports Use the information in the following topics to help you generate and work with patch compliance reports in Patch Manager, a tool in AWS Systems Manager. Patch Manager 620 AWS Systems Manager User Guide The information in the following topics apply no matter which method or type of configuration you're using for your patching operations: • A patch policy configured in Quick Setup • A Host Management option configured in Quick Setup • A maintenance window to run a patch Scan or Install task • An on-demand Patch now operation Important If you have multiple types of operations in place to scan your instances for patch compliance, note that each scan overwrites the patch compliance data of previous scans. As a result, you might end up with unexpected results in your patch compliance data. For more information, see Avoiding unintentional patch compliance data overwrites. To verify which patch baseline was used to generate the latest compliance information, navigate to the Compliance reporting tab in Patch Manager, locate the row for the managed node you want information about, and then choose the baseline ID in the Baseline ID used column. Topics • Viewing patch compliance results • Generating .csv patch compliance reports • Remediating noncompliant managed nodes with Patch Manager • Avoiding unintentional patch compliance data overwrites Viewing patch compliance results Use these procedures to view patch compliance information about your managed nodes. This procedure applies to patch operations that use the AWS-RunPatchBaseline document. For information about viewing patch compliance information for patch operations that use the AWS- RunPatchBaselineAssociation document, see Identifying noncompliant managed nodes. Patch Manager 621 AWS Systems Manager Note User Guide The patch scanning operations for Quick Setup and Explorer use the AWS- RunPatchBaselineAssociation document. Quick Setup and Explorer are both tools in AWS Systems Manager. Identify the patch solution for a specific CVE issue (Linux) For many Linux-based operating systems, patch compliance results indicate which Common Vulnerabilities and Exposure (CVE) bulletin issues are resolved by which patches. This information can help you determine how urgently you need to install a missing or failed patch. CVE details are included for supported versions of the following operating system types: • AlmaLinux • Amazon Linux 1 • Amazon Linux 2 • Amazon Linux 2022 • Amazon Linux 2023 • Oracle Linux • Red Hat Enterprise Linux (RHEL) • Rocky Linux • SUSE Linux Enterprise Server (SLES) Note By default, CentOS and CentOS Stream don't provide CVE information about updates. You can, however, allow this support by using third-party repositories such as the Extra Packages for Enterprise Linux (EPEL) repository published by Fedora. For information, see EPEL on the Fedora Wiki. Currently, CVE ID values are reported only for patches with a status of Missing or Failed. You can also add CVE IDs to your lists of approved or rejected patches in your patch baselines, as the situation and your patching goals warrant. Patch Manager 622 AWS Systems Manager User Guide For information about working with approved and rejected patch lists, see the following topics: • Working with custom patch baselines • Package name formats for approved and rejected patch lists • How
|
systems-manager-ug-202
|
systems-manager-ug.pdf
| 202 |
Extra Packages for Enterprise Linux (EPEL) repository published by Fedora. For information, see EPEL on the Fedora Wiki. Currently, CVE ID values are reported only for patches with a status of Missing or Failed. You can also add CVE IDs to your lists of approved or rejected patches in your patch baselines, as the situation and your patching goals warrant. Patch Manager 622 AWS Systems Manager User Guide For information about working with approved and rejected patch lists, see the following topics: • Working with custom patch baselines • Package name formats for approved and rejected patch lists • How patch baseline rules work on Linux-based systems • How patches are installed Note In some cases, Microsoft releases patches for applications that don't specify an updated date and time. In these cases, an updated date and time of 01/01/1970 is supplied by default. Viewing patching compliance results Use the following procedures to view patch compliance results in the AWS Systems Manager console. Note For information about generating patch compliance reports that are downloaded to an Amazon Simple Storage Service (Amazon S3) bucket, see Generating .csv patch compliance reports. To view patch compliance results 1. Do one of the following. Option 1 (recommended) – Navigate from Patch Manager, a tool in AWS Systems Manager: • In the navigation pane, choose Patch Manager. • Choose the Compliance reporting tab. • In the Node patching details area, choose the node ID of the managed node for which you want to review patch compliance results. • In the Details area, in the Properties list, choose Patches. Patch Manager 623 AWS Systems Manager User Guide Option 2 – Navigate from Compliance, a tool in AWS Systems Manager: • In the navigation pane, choose Compliance. • For Compliance resources summary, choose a number in the column for the types of patch resources you want to review, such as Non-Compliant resources. • Below, in the Resource list, choose the ID of the managed node for which you want to review patch compliance results. • In the Details area, in the Properties list, choose Patches. Option 3 – Navigate from Fleet Manager, a tool in AWS Systems Manager. • In the navigation pane, choose Fleet Manager. • In the Managed instances area, choose the ID of the managed node for which you want to review patch compliance results. • In the Details area, in the Properties list, choose Patches. 2. (Optional) In the Search box ( choose from the available filters. ), For example, for Red Hat Enterprise Linux (RHEL), choose from the following: • Name • Classification • State • Severity For Windows Server, choose from the following: • KB • Classification • State • Severity Patch Manager 624 AWS Systems Manager User Guide 3. Choose one of the available values for the filter type you chose. For example, if you chose State, now choose a compliance state such as InstalledPendingReboot, Failed or Missing. Note Currently, CVE ID values are reported only for patches with a status of Missing or Failed. 4. Depending on the compliance state of the managed node, you can choose what action to take to remedy any noncompliant nodes. For example, you can choose to patch your noncompliant managed nodes immediately. For information about patching your managed nodes on demand, see Patching managed nodes on demand. For information about patch compliance states, see Patch compliance state values. Generating .csv patch compliance reports You can use the AWS Systems Manager console to generate patch compliance reports that are saved as a .csv file to an Amazon Simple Storage Service (Amazon S3) bucket of your choice. You can generate a single on-demand report or specify a schedule for generating the reports automatically. Reports can be generated for a single managed node or for all managed nodes in your selected AWS account and AWS Region. For a single node, a report contains comprehensive details, including the IDs of patches related to a node being noncompliant. For a report on all managed nodes, only summary information and counts of noncompliant nodes' patches are provided. After a report is generated, you can use a tool like Amazon QuickSight to import and analyze the data. QuickSight is a business intelligence (BI) service you can use to explore and interpret information in an interactive visual environment. For more information, see the Amazon QuickSight User Guide. Note When you create a custom patch baseline, you can specify a compliance severity level for patches approved by that patch baseline, such as Critical or High. If the patch state Patch Manager 625 AWS Systems Manager User Guide of any approved patch is reported as Missing, then the patch baseline's overall reported compliance severity is the severity level you specified. You can also specify an Amazon Simple Notification Service (Amazon SNS) topic to use
|
systems-manager-ug-203
|
systems-manager-ug.pdf
| 203 |
intelligence (BI) service you can use to explore and interpret information in an interactive visual environment. For more information, see the Amazon QuickSight User Guide. Note When you create a custom patch baseline, you can specify a compliance severity level for patches approved by that patch baseline, such as Critical or High. If the patch state Patch Manager 625 AWS Systems Manager User Guide of any approved patch is reported as Missing, then the patch baseline's overall reported compliance severity is the severity level you specified. You can also specify an Amazon Simple Notification Service (Amazon SNS) topic to use for sending notifications when a report is generated. Service roles for generating patch compliance reports The first time you generate a report, Systems Manager creates an Automation assume role named AWS-SystemsManager-PatchSummaryExportRole to use for the export process to S3. Note If you are exporting compliance data to an encrypted S3 bucket, you must update its associated AWS KMS key policy to provide the necessary permissions for AWS- SystemsManager-PatchSummaryExportRole. For instance, add a permission similar to this to your S3 bucket's AWS KMS policy: { "Effect": "Allow", "Action": [ "kms:GenerateDataKey" ], "Resource": "role-arn" } Replace role-arn with the Amazon Resource Name (ARN) of the created in your account, in the format arn:aws:iam::111222333444:role/service-role/AWS- SystemsManager-PatchSummaryExportRole. For more information, see Key policies in AWS KMS in the AWS Key Management Service Developer Guide. The first time you generate a report on a schedule, Systems Manager creates another service role named AWS-EventBridge-Start-SSMAutomationRole, along with the service role AWS- SystemsManager-PatchSummaryExportRole (if not created already) to use for the export process. AWS-EventBridge-Start-SSMAutomationRole enables Amazon EventBridge to start an automation using the runbook AWS-ExportPatchReportToS3. Patch Manager 626 AWS Systems Manager User Guide We recommend against attempting to modify these policies and roles. Doing so could cause patch compliance report generation to fail. For more information, see Troubleshooting patch compliance report generation. Topics • What's in a generated patch compliance report? • Generating patch compliance reports for a single managed node • Generating patch compliance reports for all managed nodes • Viewing patch compliance reporting history • Viewing patch compliance reporting schedules • Troubleshooting patch compliance report generation What's in a generated patch compliance report? This topic provides information about the types of content included in the patch compliance reports that are generated and downloaded to a specified S3 bucket. Report format for a single managed node A report generated for a single managed node provides both summary and detailed information. Download a sample report (single node) Summary information for a single managed node includes the following: • Index • Instance ID • Instance name • Instance IP • Platform name • Platform version • SSM Agent version • Patch baseline • Patch group • Compliance status Patch Manager 627 User Guide AWS Systems Manager • Compliance severity • Noncompliant Critical severity patch count • Noncompliant High severity patch count • Noncompliant Medium severity patch count • Noncompliant Low severity patch count • Noncompliant Informational severity patch count • Noncompliant Unspecified severity patch count Detailed information for a single managed node includes the following: • Index • Instance ID • Instance name • Patch name • KB ID/Patch ID • Patch state • Last report time • Compliance level • Patch severity • Patch classification • CVE ID • Patch baseline • Logs URL • Instance IP • Platform name • Platform version • SSM Agent version Note When you create a custom patch baseline, you can specify a compliance severity level for patches approved by that patch baseline, such as Critical or High. If the patch state Patch Manager 628 AWS Systems Manager User Guide of any approved patch is reported as Missing, then the patch baseline's overall reported compliance severity is the severity level you specified. Report format for all managed nodes A report generated for all managed nodes provides only summary information. Download a sample report (all managed nodes) Summary information for all managed nodes includes the following: • Index • Instance ID • Instance name • Instance IP • Platform name • Platform version • SSM Agent version • Patch baseline • Patch group • Compliance status • Compliance severity • Noncompliant Critical severity patch count • Noncompliant High severity patch count • Noncompliant Medium severity patch count • Noncompliant Low severity patch count • Noncompliant Informational severity patch count • Noncompliant Unspecified severity patch count Generating patch compliance reports for a single managed node Use the following procedure to generate a patch summary report for a single managed node in your AWS account. The report for a single managed node provides details about each patch that is out of compliance, including patch names and IDs. Patch Manager 629 AWS Systems Manager User Guide To generate patch compliance reports for a single managed node 1.
|
systems-manager-ug-204
|
systems-manager-ug.pdf
| 204 |
count • Noncompliant High severity patch count • Noncompliant Medium severity patch count • Noncompliant Low severity patch count • Noncompliant Informational severity patch count • Noncompliant Unspecified severity patch count Generating patch compliance reports for a single managed node Use the following procedure to generate a patch summary report for a single managed node in your AWS account. The report for a single managed node provides details about each patch that is out of compliance, including patch names and IDs. Patch Manager 629 AWS Systems Manager User Guide To generate patch compliance reports for a single managed node 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Patch Manager. 3. Choose the Compliance reporting tab. 4. Choose the button for the row of the managed node for which you want to generate a report, 5. 6. 7. and then choose View detail. In the Patch summary section, choose Export to S3. For Report name, enter a name to help you identify the report later. For Reporting frequency, choose one of the following: • On demand – Create a one-time report. Skip to Step 9. • On a schedule – Specify a recurring schedule for automatically generating reports. Continue to Step 8. 8. For Schedule type, specify either a rate expression, such as every 3 days, or provide a cron expression to set the report frequency. For information about cron expressions, see Reference: Cron and rate expressions for Systems Manager. 9. For Bucket name, select the name of an S3 bucket where you want to store the .csv report files. Important If you're working in an AWS Region that was launched after March 20, 2019, you must select an S3 bucket in that same Region. Regions launched after that date were turned off by default. For more information and a list of these Regions, see Enabling a Region in the Amazon Web Services General Reference. 10. (Optional) To send notifications when the report is generated, expend the SNS topic section, and then choose an existing Amazon SNS topic from SNS topic Amazon Resource Name (ARN). 11. Choose Submit. Patch Manager 630 AWS Systems Manager User Guide For information about viewing a history of generated reports, see Viewing patch compliance reporting history. For information about viewing details of reporting schedules you have created, see Viewing patch compliance reporting schedules. Generating patch compliance reports for all managed nodes Use the following procedure to generate a patch summary report for all managed nodes in your AWS account. The report for all managed nodes indicates which nodes are out of compliance and the numbers of noncompliant patches. It doesn't provide the names or other identifiers of the patches. For these additional details, you can generate a patch compliance report for a single managed node. For information, see Generating patch compliance reports for a single managed node earlier in this topic. To generate patch compliance reports for all managed nodes 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Patch Manager. 3. Choose the Compliance reporting tab. 4. Choose Export to S3. (Don't select a node ID first.) 5. 6. For Report name, enter a name to help you identify the report later. For Reporting frequency, choose one of the following: • On demand – Create a one-time report. Skip to Step 8. • On a schedule – Specify a recurring schedule for automatically generating reports. Continue to Step 7. 7. For Schedule type, specify either a rate expression, such as every 3 days, or provide a cron expression to set the report frequency. For information about cron expressions, see Reference: Cron and rate expressions for Systems Manager. 8. For Bucket name, select the name of an S3 bucket where you want to store the .csv report files. Patch Manager 631 AWS Systems Manager User Guide Important If you're working in an AWS Region that was launched after March 20, 2019, you must select an S3 bucket in that same Region. Regions launched after that date were turned off by default. For more information and a list of these Regions, see Enabling a Region in the Amazon Web Services General Reference. 9. (Optional) To send notifications when the report is generated, expend the SNS topic section, and then choose an existing Amazon SNS topic from SNS topic Amazon Resource Name (ARN). 10. Choose Submit. For information about viewing a history of generated reports, see Viewing patch compliance reporting history. For information about viewing details of reporting schedules you have created, see Viewing patch compliance reporting schedules. Viewing patch compliance reporting history Use the information in this topic to help you view details about the patch compliance reports generated in your AWS account. To view patch compliance reporting history 1. Open the
|
systems-manager-ug-205
|
systems-manager-ug.pdf
| 205 |
9. (Optional) To send notifications when the report is generated, expend the SNS topic section, and then choose an existing Amazon SNS topic from SNS topic Amazon Resource Name (ARN). 10. Choose Submit. For information about viewing a history of generated reports, see Viewing patch compliance reporting history. For information about viewing details of reporting schedules you have created, see Viewing patch compliance reporting schedules. Viewing patch compliance reporting history Use the information in this topic to help you view details about the patch compliance reports generated in your AWS account. To view patch compliance reporting history 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Patch Manager. 3. Choose the Compliance reporting tab. 4. Choose View all S3 exports, and then choose the Export history tab. Viewing patch compliance reporting schedules Use the information in this topic to help you view details about the patch compliance reporting schedules created in your AWS account. Patch Manager 632 AWS Systems Manager User Guide To view patch compliance reporting history 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Patch Manager. 3. Choose the Compliance reporting tab. 4. Choose View all S3 exports, and then choose the Report schedule rules tab. Troubleshooting patch compliance report generation Use the following information to help you troubleshoot problems with generating patch compliance report generation in Patch Manager, a tool in AWS Systems Manager. Topics • A message reports that the AWS-SystemsManager-PatchManagerExportRolePolicy policy is corrupted • After deleting patch compliance policies or roles, scheduled reports aren't generated successfully A message reports that the AWS-SystemsManager-PatchManagerExportRolePolicy policy is corrupted Problem: You receive an error message similar to the following, indicating the AWS- SystemsManager-PatchManagerExportRolePolicy is corrupted: An error occurred while updating the AWS-SystemsManager-PatchManagerExportRolePolicy policy. If you have edited the policy, you might need to delete the policy, and any role that uses it, then try again. Systems Manager recreates the roles and policies you have deleted. • Solution: Use the Patch Manager console or AWS CLI to delete the affected roles and policies before generating a new patch compliance report. To delete the corrupt policy using the console 1. Open the IAM console at https://console.aws.amazon.com/iam/. 2. Do one of the following: Patch Manager 633 AWS Systems Manager User Guide On-demand reports – If the problem occurred while generating a one-time on-demand report, in the left navigation, choose Policies, search for AWS-SystemsManager- PatchManagerExportRolePolicy, then delete the policy. Next, choose Roles, search for AWS-SystemsManager-PatchSummaryExportRole, then delete the role. Scheduled reports – If the problem occurred while generating a report on a schedule, in the left navigation, choose Policies, search one at a time for AWS- EventBridge-Start-SSMAutomationRolePolicy and AWS-SystemsManager- PatchManagerExportRolePolicy, and delete each policy. Next, choose Roles, search one at a time for AWS-EventBridge-Start-SSMAutomationRole and AWS- SystemsManager-PatchSummaryExportRole, and delete each role. To delete the corrupt policy using the AWS CLI Replace the placeholder values with your account ID. • If the problem occurred while generating a one-time on-demand report, run the following commands: aws iam delete-policy --policy-arn arn:aws:iam::account-id:policy/AWS- SystemsManager-PatchManagerExportRolePolicy aws iam delete-role --role-name AWS-SystemsManager-PatchSummaryExportRole If the problem occurred while generating a report on a schedule, run the following commands: aws iam delete-policy --policy-arn arn:aws:iam::account-id:policy/AWS- EventBridge-Start-SSMAutomationRolePolicy aws iam delete-policy --policy-arn arn:aws:iam::account-id:policy/AWS- SystemsManager-PatchManagerExportRolePolicy aws iam delete-role --role-name AWS-EventBridge-Start-SSMAutomationRole Patch Manager 634 AWS Systems Manager User Guide aws iam delete-role --role-name AWS-SystemsManager-PatchSummaryExportRole After completing either procedure, follow the steps to generate or schedule a new patch compliance report. After deleting patch compliance policies or roles, scheduled reports aren't generated successfully Problem: The first time you generate a report, Systems Manager creates a service role and a policy to use for the export process (AWS-SystemsManager-PatchSummaryExportRole and AWS-SystemsManager-PatchManagerExportRolePolicy). The first time you generate a report on a schedule, Systems Manager creates another service role and a policy (AWS-EventBridge-Start-SSMAutomationRole and AWS-EventBridge-Start- SSMAutomationRolePolicy). These let Amazon EventBridge start an automation using the runbook AWS-ExportPatchReportToS3 . If you delete any of these policies or roles, the connections between your schedule and your specified S3 bucket and Amazon SNS topic might be lost. • Solution: To work around this problem, we recommend deleting the previous schedule and creating a new schedule to replace the one that was experiencing issues. Remediating noncompliant managed nodes with Patch Manager The topics in this section provide overviews of how to identify managed nodes that are out of patch compliance and how to bring nodes into compliance. Topics • Identifying noncompliant managed nodes • Patch compliance state values • Patching noncompliant managed nodes Identifying noncompliant managed nodes Out-of-compliance managed nodes are identified when either of two AWS Systems Manager documents (SSM documents) are run. These SSM documents reference the appropriate patch Patch Manager 635 AWS Systems Manager User Guide baseline for each managed node in Patch Manager, a tool in AWS Systems
|
systems-manager-ug-206
|
systems-manager-ug.pdf
| 206 |
experiencing issues. Remediating noncompliant managed nodes with Patch Manager The topics in this section provide overviews of how to identify managed nodes that are out of patch compliance and how to bring nodes into compliance. Topics • Identifying noncompliant managed nodes • Patch compliance state values • Patching noncompliant managed nodes Identifying noncompliant managed nodes Out-of-compliance managed nodes are identified when either of two AWS Systems Manager documents (SSM documents) are run. These SSM documents reference the appropriate patch Patch Manager 635 AWS Systems Manager User Guide baseline for each managed node in Patch Manager, a tool in AWS Systems Manager. They then evaluate the patch state of the managed node and then make compliance results available to you. There are two SSM documents that are used to identify or update noncompliant managed nodes: AWS-RunPatchBaseline and AWS-RunPatchBaselineAssociation. Each one is used by different processes, and their compliance results are available through different channels. The following table outlines the differences between these documents. Note Patch compliance data from Patch Manager can be sent to AWS Security Hub. Security Hub gives you a comprehensive view of your high-priority security alerts and compliance status. It also monitors the patching status of your fleet. For more information, see Integrating Patch Manager with AWS Security Hub. Processes that use the document AWS-RunPatchBaseline AWS-RunPatchBaseli neAssociation Patch on demand - You can scan or patch managed nodes on demand using the Patch now option. For information, see Patching managed nodes Systems Manager Quick Setup Host Managemen t – You can enable a Host Management configuration option in Quick Setup to on demand. scan your managed instances Systems Manager Quick Setup patch policies – You can create a patching for patch compliance each day. For information, see Set up Amazon EC2 host management using Quick configuration in Quick Setup, a tool in AWS Systems Setup. Manager, that can scan for or install missing patches on separate schedules for an Systems Manager Explorer – When you allow Explorer, a tool in AWS Systems entire organization, a subset Manager, it regularly scans of organizational units, or your managed instances a single AWS account. For for patch compliance and information, see Configure Patch Manager 636 AWS Systems Manager User Guide AWS-RunPatchBaseline AWS-RunPatchBaseli neAssociation patching for instances in an reports results in the Explorer organization using a Quick Setup patch policy. dashboard. Run a command – You can manually run AWS-RunPa tchBaseline in an operation in Run Command, a tool in AWS Systems Manager. For information, see Running commands from the console. Maintenance window – You can create a maintenan ce window that uses the SSM document AWS-RunPa tchBaseline in a Run Command task type. For information, see Tutorial: Create a maintenance window for patching using the console. Format of the patch scan result data After AWS-RunPa tchBaseline runs, Patch Manager sends an AWS:PatchSummary object to Inventory, a tool in AWS Systems Manager. After AWS-RunPa tchBaselineAssocia tion runs, Patch Manager sends an AWS:Compl ianceItem object to Systems Manager Inventory. Patch Manager 637 AWS Systems Manager User Guide AWS-RunPatchBaseline AWS-RunPatchBaseli neAssociation Viewing patch compliance reports in the console You can view patch complianc e information for processes If you use Quick Setup to scan your managed instances for that use AWS-RunPa tchBaseline in Systems Manager Configuration patch compliance, you can see the compliance report in Systems Manager Fleet Compliance and Working with Manager. In the Fleet managed nodes. For more Manager console, choose the AWS CLI commands for viewing patch compliance results information, see Viewing patch compliance results. node ID of your managed node. In the General menu, choose Configuration compliance. If you use Explorer to scan your managed instances for patch compliance, you can see the compliance report in both Explorer and Systems Manager OpsCenter. For processes that use AWS- For processes that use RunPatchBaseline you can use the following AWS CLI commands to view , AWS-RunPatchBaseli neAssociation use the following AWS CLI , you can summary information about command to view summary patches on a managed node. information about patches on • describe-instance-patch-sta an instance. tes • list-compliance-items • describe-instance-patch-sta tes-for-patch-group • describe-patch-group-state Patch Manager 638 AWS Systems Manager User Guide AWS-RunPatchBaseline AWS-RunPatchBaseli neAssociation Quick Setup and Explorer processes, which use AWS-RunPatchBaseli neAssociation a Scan operation. , run only Patching operations For processes that use AWS- RunPatchBaseline specify whether you want , you the operation to run a Scan operation only, or a Scan and install operation. If your goal is to identify noncompliant managed nodes and not remediate them, run only a Scan operation. More info SSM Command document SSM Command document for patching: AWS-RunPa for patching: AWS-RunPa tchBaseline tchBaselineAssocia tion For information about the various patch compliance states you might see reported, see Patch compliance state values For information about remediating managed nodes that are out of patch compliance,
|
systems-manager-ug-207
|
systems-manager-ug.pdf
| 207 |
AWS-RunPatchBaseli neAssociation a Scan operation. , run only Patching operations For processes that use AWS- RunPatchBaseline specify whether you want , you the operation to run a Scan operation only, or a Scan and install operation. If your goal is to identify noncompliant managed nodes and not remediate them, run only a Scan operation. More info SSM Command document SSM Command document for patching: AWS-RunPa for patching: AWS-RunPa tchBaseline tchBaselineAssocia tion For information about the various patch compliance states you might see reported, see Patch compliance state values For information about remediating managed nodes that are out of patch compliance, see Patching noncompliant managed nodes. Patch compliance state values The information about patches for a managed node include a report of the state, or status, of each individual patch. Tip If you want to assign a specific patch compliance state to a managed node, you can use the put-compliance-items AWS Command Line Interface (AWS CLI) command or the Patch Manager 639 AWS Systems Manager User Guide PutComplianceItems API operation. Assigning compliance state isn't supported in the console. Use the information in the following tables to help you identify why a managed node might be out of patch compliance. Patch compliance values for Debian Server, Raspberry Pi OS, and Ubuntu Server For Debian Server, Raspberry Pi OS, and Ubuntu Server, the rules for package classification into the different compliance states are described in the following table. Note Keep the following in mind when you're evaluating the INSTALLED, INSTALLED_OTHER, and MISSING status values: If you don't select the Include nonsecurity updates check box when creating or updating a patch baseline, patch candidate versions are limited to patches included in trusty-security (Ubuntu Server 14.04 LTS), xenial-security (Ubuntu Server 16.04 LTS), bionic-security (Ubuntu Server 18.04 LTS), focal-security (Ubuntu Server 20.04 LTS), groovy-security (Ubuntu Server 20.10 STR), jammy- security (Ubuntu Server 22.04 LTS), or debian-security (Debian Server and Raspberry Pi OS). If you do select the Include nonsecurity updates check box, patches from other repositories are considered as well. Patch state INSTALLED Description Compliance status Compliant The patch is listed in the patch baseline and is installed on the managed node. It could have been installed either manually by an individual or automatically by Patch Manager when the AWS-RunPatchBaseline document was run on the managed node. Patch Manager 640 AWS Systems Manager User Guide Patch state Description Compliance status INSTALLED_OTHER Compliant The patch isn't included in the baseline or isn't approved by the baseline but is installed on the managed node. The patch might have been installed manually, the package could be a required dependency of another approved patch, or the patch might have been included in an InstallOv errideList operation. If you don't specify Block as the Rejected patches action, INSTALLED_OTHER patches also includes installed but rejected patches. Patch Manager 641 AWS Systems Manager User Guide Patch state Description Compliance status INSTALLED_PENDING_ REBOOT Non-Compliant INSTALLED_PENDING_ REBOOT can mean either of two things: • The Patch Manager Install operation applied the patch to the managed node, but the node has not been rebooted since the patch was applied. This typically means the NoReboot option was selected for the RebootOption parameter when the AWS- RunPatchBaseline document was last run on the managed node. For more information, see Parameter name: RebootOption . • A patch was installed outside of Patch Manager since the last time the managed node was rebooted. In neither case does it mean that a patch with this status requires a reboot, only that the node hasn't been rebooted since the patch was installed. Patch Manager 642 AWS Systems Manager User Guide Patch state Description Compliance status INSTALLED_REJECTED MISSING FAILED The patch is installed on the managed node but is specified in a Rejected patches list. This typically means the patch was installed before it was added to a list of rejected patches. Packages that are filtered through the baseline and not already installed. Non-Compliant Non-Compliant Packages that failed to install during the patch operation. Non-Compliant Patch compliance values for other operating systems For all operating systems besides Debian Server, Raspberry Pi OS, and Ubuntu Server, the rules for package classification into the different compliance states are described in the following table. Patch state INSTALLED Description Compliance value The patch is listed in the patch baseline and is installed Compliant on the managed node. It could have been installed either manually by an individual or automatically by Patch Manager when the AWS-RunPatchBaseline document was run on the node. INSTALLED_OTHER ¹ The patch isn't in the baseline, but it is installed on Compliant Patch Manager 643 AWS Systems Manager User Guide Patch state Description Compliance value the managed node. There are two possible reasons for this: 1. The patch might have been installed manually. 2. Linux only: The package might have been installed as a
|
systems-manager-ug-208
|
systems-manager-ug.pdf
| 208 |
INSTALLED Description Compliance value The patch is listed in the patch baseline and is installed Compliant on the managed node. It could have been installed either manually by an individual or automatically by Patch Manager when the AWS-RunPatchBaseline document was run on the node. INSTALLED_OTHER ¹ The patch isn't in the baseline, but it is installed on Compliant Patch Manager 643 AWS Systems Manager User Guide Patch state Description Compliance value the managed node. There are two possible reasons for this: 1. The patch might have been installed manually. 2. Linux only: The package might have been installed as a required dependenc y of a different, approved patch. If you specify Allow as dependency as the Rejected patches action, patches that are installed as dependencies are given the reporting status INSTALLED_OTHER . Note Windows Server doesn't support the concept of patch dependenc ies. For information about how Patch Manager handles patches in the Rejected patches list on Windows Server, see Rejected patch list options in custom patch baselines. Patch Manager 644 AWS Systems Manager User Guide Patch state Description Compliance value INSTALLED_REJECTED Non-Compliant The patch is installed on the managed node but is specified in a rejected patches list. This typically means the patch was installed before it was added to a list of rejected patches. Patch Manager 645 AWS Systems Manager User Guide Patch state Description Compliance value INSTALLED_PENDING_ REBOOT Non-Compliant INSTALLED_PENDING_ REBOOT can mean either of two things: • The Patch Manager Install operation applied the patch to the managed node, but the node has not been rebooted since the patch was applied. This typically means the NoReboot option was selected for the RebootOption parameter when the AWS- RunPatchBaseline document was last run on the managed node. For more information, see Parameter name: RebootOption . • A patch was installed outside of Patch Manager since the last time the managed node was rebooted. In neither case does it mean that a patch with this status requires a reboot, only that the node hasn't been rebooted since the patch was installed. Patch Manager 646 AWS Systems Manager Patch state MISSING FAILED Description Compliance value User Guide Non-Compliant Non-Compliant The patch is approved in the baseline, but it isn't installed on the managed node. If you configure the AWS-RunPa tchBaseline document task to scan (instead of install), the system reports this status for patches that were located during the scan but haven't been installed. The patch is approved in the baseline, but it couldn't be installed. To troublesh oot this situation, review the command output for information that might help you understand the problem. Patch Manager 647 AWS Systems Manager User Guide Patch state Description Compliance value NOT_APPLICABLE ¹ Not applicable This compliance state is reported only for Windows Server operating systems. The patch is approved in the baseline, but the service or feature that uses the patch isn't installed on the managed node. For example, a patch for a web server service such as Internet Informati on Services (IIS) would show NOT_APPLICABLE if it was approved in the baseline, but the web service isn't installed on the managed node. A patch can also be marked NOT_APPLICABLE if it has been superseded by a subsequent update. This means that the later update is installed and the NOT_APPLI CABLE update is no longer required. Patch Manager 648 AWS Systems Manager User Guide Patch state Description Compliance value AVAILABLE_SECURITY _UPDATES This compliance state is reported only for Windows Compliant or Non-Compl iant, depending on the option Server operating systems. selected for available security updates. Note Using the console to create or update a patch baseline, you specify this option in the Available security updates compliance status field. Using the AWS CLI to run the create-patch-baseline or update-patch-basel ine command, you specify this option in the available -security -updates- compliance- status parameter. An available security update patch that is not approved by the patch baseline can have a compliance value or Compliant or Non-Compl iant , as defined in a custom patch baseline. When you create or update a patch baseline, you choose the status you want to assign to security patches that are available but not approved because they don't meet the installation criteria specified in the patch baseline. For example, security patches that you might want installed can be skipped if you have specified a long period to wait after a patch is released before installation. If an update to the patch is released during your specified waiting period, the waiting period for installing the patch starts over. If the waiting period is too long, multiple versions of the patch could be released but never installed. Patch Manager 649 AWS Systems Manager User Guide Patch state Description Compliance value For patch summary counts, when a patch is reported as AvailableSecurityU pdate
|
systems-manager-ug-209
|
systems-manager-ug.pdf
| 209 |
installation criteria specified in the patch baseline. For example, security patches that you might want installed can be skipped if you have specified a long period to wait after a patch is released before installation. If an update to the patch is released during your specified waiting period, the waiting period for installing the patch starts over. If the waiting period is too long, multiple versions of the patch could be released but never installed. Patch Manager 649 AWS Systems Manager User Guide Patch state Description Compliance value For patch summary counts, when a patch is reported as AvailableSecurityU pdate , it will always be included in Available SecurityUpdateCoun t . If the baseline is configure d to report these patches as NonCompliant , it is also included in SecurityN onCompliantCount If the baseline is configure . d to report these patches as Compliant , they are not included in SecurityN onCompliantCount These patches are always . reported with an unspecifi ed severity and are never included in the CriticalN onCompliantCount . ¹ For patches with the state INSTALLED_OTHER and NOT_APPLICABLE, Patch Manager omits some data from query results based on the describe-instance-patches command, such as the values for Classification and Severity. This is done to help prevent exceeding the data limit for individual nodes in Inventory, a tool in AWS Systems Manager. To view all patch details, you can use the describe-available-patches command. Patching noncompliant managed nodes Many of the same AWS Systems Manager tools and processes you can use to check managed nodes for patch compliance can be used to bring nodes into compliance with the patch rules that currently apply to them. To bring managed nodes into patch compliance, Patch Manager, a tool in AWS Systems Manager, must run a Scan and install operation. (If your goal is only to identify Patch Manager 650 AWS Systems Manager User Guide noncompliant managed nodes and not remediate them, run a Scan operation instead. For more information, see Identifying noncompliant managed nodes.) Install patches using Systems Manager You can choose from several tools to run a Scan and install operation: • (Recommended) Configure a patch policy in Quick Setup, a tool in Systems Manager, that lets you install missing patches on a schedule for an entire organization, a subset of organizational units, or a single AWS account. For more information, see Configure patching for instances in an organization using a Quick Setup patch policy. • Create a maintenance window that uses the Systems Manager document (SSM document) AWS-RunPatchBaseline in a Run Command task type. For information, see Tutorial: Create a maintenance window for patching using the console. • Manually run AWS-RunPatchBaseline in a Run Command operation. For information, see Running commands from the console. • Install patches on demand using the Patch now option. For information, see Patching managed nodes on demand. Avoiding unintentional patch compliance data overwrites If you have multiple types of operations in place to scan your instances for patch compliance, each scan overwrites the patch compliance data of previous scans. As a result, you might end up with unexpected results in your patch compliance data. For example, suppose you create a patch policy that scans for patch compliance each day at 2 AM local time. That patch policy uses a patch baseline that targets patches with severity marked as Critical, Important, and Moderate. This patch baseline also specifies a few specifically rejected patches. Also suppose that you already had a maintenance window set up to scan the same set of managed nodes each day at 4 AM local time, which you don't delete or deactivate. That maintenance window’s task uses a different patch baseline, one that targets only patches with a Critical severity and doesn’t exclude any specific patches. When this second scan is performed by the maintenance window, the patch compliance data from the first scan is deleted and replaced with patch compliance from the second scan. Patch Manager 651 AWS Systems Manager User Guide Therefore, we strongly recommend using only one automated method for scanning and installing in your patching operations. If you're setting up patch policies, you should delete or deactivate other methods of scanning for patch compliance. For more information, see the following topics: • To remove a patching operation task from a maintenance window – Updating or deregistering maintenance window tasks using the console • To delete a State Manager association – Deleting associations. To deactivate daily patch compliance scans in a Host Management configuration, do the following in Quick Setup: 1. 2. In the navigation pane, choose Quick Setup. Select the Host Management configuration to update. 3. Choose Actions, Edit configuration. 4. Clear the Scan instances for missing patches daily check box. 5. Choose Update. Note Using the Patch now option to scan a managed node for compliance also results
|
systems-manager-ug-210
|
systems-manager-ug.pdf
| 210 |
following topics: • To remove a patching operation task from a maintenance window – Updating or deregistering maintenance window tasks using the console • To delete a State Manager association – Deleting associations. To deactivate daily patch compliance scans in a Host Management configuration, do the following in Quick Setup: 1. 2. In the navigation pane, choose Quick Setup. Select the Host Management configuration to update. 3. Choose Actions, Edit configuration. 4. Clear the Scan instances for missing patches daily check box. 5. Choose Update. Note Using the Patch now option to scan a managed node for compliance also results in an overwrite of patch compliance data. Patching managed nodes on demand Using the Patch now option in Patch Manager, a tool in AWS Systems Manager, you can run on- demand patching operations from the Systems Manager console. This means you don’t have to create a schedule in order to update the compliance status of your managed nodes or to install patches on noncompliant nodes. You also don’t need to switch the Systems Manager console between Patch Manager and Maintenance Windows, a tool in AWS Systems Manager, in order to set up or modify a scheduled patching window. Patch now is especially useful when you must apply zero-day updates or install other critical patches on your managed nodes as soon as possible. Patch Manager 652 AWS Systems Manager Note User Guide Patching on demand is supported for a single AWS account-AWS Region pair at a time. It can't be used with patching operations that are based on patch policies. We recommend using patch policies for keeping all your managed nodes in compliance. For more information about working with patch policies, see Patch policy configurations in Quick Setup. Topics • How 'Patch now' works • Running 'Patch now' How 'Patch now' works To run Patch now, you specify just two required settings: • Whether to scan for missing patches only, or to scan and install patches on your managed nodes • Which managed nodes to run the operation on When the Patch now operation runs, it determines which patch baseline to use in the same way one is selected for other patching operations. If a managed node is associated with a patch group, the patch baseline specified for that group is used. If the managed node isn't associated with a patch group, the operation uses the patch baseline that is currently set as the default for the operating system type of the managed node. This can be a predefined baseline, or the custom baseline you have set as the default. For more information about patch baseline selection, see Patch groups. Options you can specify for Patch now include choosing when, or whether, to reboot managed nodes after patching, specifying an Amazon Simple Storage Service (Amazon S3) bucket to store log data for the patching operation, and running Systems Manager documents (SSM documents) as lifecycle hooks during patching. Concurrency and error thresholds for 'Patch now' For Patch now operations, concurrency and error threshold options are handled by Patch Manager. You don't need to specify how many managed nodes to patch at once, nor how many errors are Patch Manager 653 AWS Systems Manager User Guide permitted before the operation fails. Patch Manager applies the concurrency and error threshold settings described in the following tables when you patch on demand. Important The following thresholds apply to Scan and install operations only. For Scan operations, Patch Manager attempts to scan up to 1,000 nodes concurrently, and continue scanning until it has encountered up to 1,000 errors. Concurrency: Install operations Total number of managed nodes in the Patch now operation Number of managed nodes scanned or patched at a time Fewer than 25 25-100 101 to 1,000 More than 1,000 1 5% 8% 10% Error threshold: Install operations Total number of managed nodes in the Patch now operation Number of errors permitted before the operation fails Fewer than 25 25-100 101 to 1,000 More than 1,000 1 5 10 10 Patch Manager 654 AWS Systems Manager User Guide Using 'Patch now' lifecycle hooks Patch now provides you with the ability to run SSM Command documents as lifecycle hooks during an Install patching operation. You can use these hooks for tasks such as shutting down applications before patching or running health checks on your applications after patching or after a reboot. For more information about using lifecycle hooks, see SSM Command document for patching: AWS-RunPatchBaselineWithHooks. The following table lists the lifecycle hooks available for each of the three Patch now reboot options, in addition to sample uses for each hook. Lifecycle hooks and sample uses Reboot option Hook: Before installation Hook: After installation Hook: On exit Reboot if needed Run an SSM document Run an SSM document at Run an SSM document after Hook: After scheduled
|
systems-manager-ug-211
|
systems-manager-ug.pdf
| 211 |
use these hooks for tasks such as shutting down applications before patching or running health checks on your applications after patching or after a reboot. For more information about using lifecycle hooks, see SSM Command document for patching: AWS-RunPatchBaselineWithHooks. The following table lists the lifecycle hooks available for each of the three Patch now reboot options, in addition to sample uses for each hook. Lifecycle hooks and sample uses Reboot option Hook: Before installation Hook: After installation Hook: On exit Reboot if needed Run an SSM document Run an SSM document at Run an SSM document after Hook: After scheduled reboot Not available before patching the end of the patching begins. the patching operation is Example use: Safely shut down applicati operation and complete and before managed instances are node reboot. rebooted. ons before the Example use: Example use: patching process Run operations Ensure that begins. such as installin applications g third-par ty applicati ons before a potential reboot. are running as expected after patching. Do not reboot my instances Same as above. Run an SSM document at the end of the patching operation. Not available Not available Patch Manager 655 AWS Systems Manager Reboot option Hook: Before installation Hook: After installation Hook: On exit User Guide Hook: After scheduled reboot Example use: Ensure that applications are running as expected after patching. Same as for Do not reboot my instances. Not available Schedule a reboot time Same as above. Run an SSM document immediate ly after a scheduled reboot is complete. Example use: Ensure that applications are running as expected after the reboot. Running 'Patch now' Use the following procedure to patch your managed nodes on demand. To run 'Patch now' 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Patch Manager. 3. Choose Patch now. 4. For Patching operation, choose one of the following: Patch Manager 656 AWS Systems Manager User Guide • Scan: Patch Manager finds which patches are missing from your managed nodes but doesn't install them. You can view the results in the Compliance dashboard or in other tools you use for viewing patch compliance. • Scan and install: Patch Manager finds which patches are missing from your managed nodes and installs them. 5. Use this step only if you chose Scan and install in the previous step. For Reboot option, choose one of the following: • Reboot if needed: After installation, Patch Manager reboots managed nodes only if needed to complete a patch installation. • Don't reboot my instances: After installation, Patch Manager doesn't reboot managed nodes. You can reboot nodes manually when you choose or manage reboots outside of Patch Manager. • Schedule a reboot time: Specify the date, time, and UTC time zone for Patch Manager to reboot your managed nodes. After you run the Patch now operation, the scheduled reboot is listed as an association in State Manager with the name AWS- PatchRebootAssociation. 6. For Instances to patch, choose one of the following: • Patch all instances: Patch Manager runs the specified operation on all managed nodes in your AWS account in the current AWS Region. • Patch only the target instances I specify: You specify which managed nodes to target in the next step. 7. Use this step only if you chose Patch only the target instances I specify in the previous step. In the Target selection section, identify the nodes on which you want to run this operation by specifying tags, selecting nodes manually, or specifying a resource group. Note If a managed node you expect to see isn't listed, see Troubleshooting managed node availability for troubleshooting tips. If you choose to target a resource group, note that resource groups that are based on an AWS CloudFormation stack must still be tagged with the default aws:cloudformation:stack-id tag. If it has been removed, Patch Manager might be unable to determine which managed nodes belong to the resource group. Patch Manager 657 AWS Systems Manager User Guide 8. (Optional) For Patching log storage, if you want to create and save logs from this patching operation, select the S3 bucket for storing the logs. Note The S3 permissions that grant the ability to write the data to an S3 bucket are those of the instance profile (for EC2 instances) or IAM service role (hybrid-activated machines) assigned to the instance, not those of the IAM user performing this task. For more information, see Configure instance permissions required for Systems Manager or Create the IAM service role required for Systems Manager in hybrid and multicloud environments. In addition, if the specified S3 bucket is in a different AWS account, make sure that the instance profile or IAM service role associated with the managed node has the necessary permissions to write to that bucket. 9. (Optional) If you want
|
systems-manager-ug-212
|
systems-manager-ug.pdf
| 212 |
to an S3 bucket are those of the instance profile (for EC2 instances) or IAM service role (hybrid-activated machines) assigned to the instance, not those of the IAM user performing this task. For more information, see Configure instance permissions required for Systems Manager or Create the IAM service role required for Systems Manager in hybrid and multicloud environments. In addition, if the specified S3 bucket is in a different AWS account, make sure that the instance profile or IAM service role associated with the managed node has the necessary permissions to write to that bucket. 9. (Optional) If you want to run SSM documents as lifecycle hooks during specific points of the patching operation, do the following: • Choose Use lifecycle hooks. • For each available hook, select the SSM document to run at the specified point of the operation: • Before installation • After installation • On exit • After scheduled reboot Note The default document, AWS-Noop, runs no operations. 10. Choose Patch now. The Association execution summary page opens. (Patch now uses associations in State Manager, a tool in AWS Systems Manager, for its operations.) In the Operation summary area, you can monitor the status of scanning or patching on the managed nodes you specified. Patch Manager 658 AWS Systems Manager Working with patch baselines User Guide A patch baseline in Patch Manager, a tool in AWS Systems Manager, defines which patches are approved for installation on your managed nodes. You can specify approved or rejected patches one by one. You can also create auto-approval rules to specify that certain types of updates (for example, critical updates) should be automatically approved. The rejected list overrides both the rules and the approve list. To use a list of approved patches to install specific packages, you first remove all auto-approval rules. If you explicitly identify a patch as rejected, it won't be approved or installed, even if it matches all of the criteria in an auto-approval rule. Also, a patch is installed on a managed node only if it applies to the software on the node, even if the patch has otherwise been approved for the managed node. Topics • Viewing AWS predefined patch baselines • Working with custom patch baselines • Setting an existing patch baseline as the default More info • Patch baselines Viewing AWS predefined patch baselines Patch Manager, a tool in AWS Systems Manager, includes a predefined patch baseline for each operating system supported by Patch Manager. You can use these patch baselines (you can't customize them), or you can create your own. The following procedure describes how to view a predefined patch baseline to see if it meets your needs. To learn more about patch baselines, see Predefined and custom patch baselines. To view AWS predefined patch baselines 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. In the navigation pane, choose Patch Manager. In the patch baselines list, choose the baseline ID of one of the predefined patch baselines. 2. 3. -or- Patch Manager 659 AWS Systems Manager User Guide If you are accessing Patch Manager for the first time in the current AWS Region, choose Start with an overview, choose the Patch baselines tab, and then choose the baseline ID of one of the predefined patch baselines. Note For Windows Server, three predefined patch baselines are provided. The patch baselines AWS-DefaultPatchBaseline and AWS- WindowsPredefinedPatchBaseline-OS support only operating system updates on the Windows operating system itself. AWS-DefaultPatchBaseline is used as the default patch baseline for Windows Server managed nodes unless you specify a different patch baseline. The configuration settings in these two patch baselines are the same. The newer of the two, AWS-WindowsPredefinedPatchBaseline-OS, was created to distinguish it from the third predefined patch baseline for Windows Server. That patch baseline, AWS-WindowsPredefinedPatchBaseline-OS- Applications, can be used to apply patches to both the Windows Server operating system and supported applications released by Microsoft. For more information, see Setting an existing patch baseline as the default. 4. 5. In the Approval rules section, review the patch baseline configuration. If the configuration is acceptable for your managed nodes, you can skip ahead to the procedure Creating and managing patch groups. -or- To create your own default patch baseline, continue to the topic Working with custom patch baselines. Working with custom patch baselines Patch Manager, a tool in AWS Systems Manager, includes a predefined patch baseline for each operating system supported by Patch Manager. You can use these patch baselines (you can't customize them), or you can create your own. The following procedures describe how to create, update, and delete your own custom patch baselines. To learn more about patch baselines, see Predefined and custom patch baselines. Topics Patch Manager 660 AWS Systems Manager User Guide • Creating a custom patch baseline for Linux • Creating a custom
|
systems-manager-ug-213
|
systems-manager-ug.pdf
| 213 |
baseline, continue to the topic Working with custom patch baselines. Working with custom patch baselines Patch Manager, a tool in AWS Systems Manager, includes a predefined patch baseline for each operating system supported by Patch Manager. You can use these patch baselines (you can't customize them), or you can create your own. The following procedures describe how to create, update, and delete your own custom patch baselines. To learn more about patch baselines, see Predefined and custom patch baselines. Topics Patch Manager 660 AWS Systems Manager User Guide • Creating a custom patch baseline for Linux • Creating a custom patch baseline for macOS • Creating a custom patch baseline for Windows Server • Updating or deleting a custom patch baseline Creating a custom patch baseline for Linux Use the following procedure to create a custom patch baseline for Linux managed nodes in Patch Manager, a tool in AWS Systems Manager. For information about creating a patch baseline for macOS managed nodes, see Creating a custom patch baseline for macOS. For information about creating a patch baseline for Windows managed nodes, see Creating a custom patch baseline for Windows Server. To create a custom patch baseline for Linux managed nodes 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Patch Manager. 3. Choose the Patch baselines tab, and then choose Create patch baseline. -or- 4. 5. 6. 7. If you are accessing Patch Manager for the first time in the current AWS Region, choose Start with an overview, choose the Patch baselines tab, and then choose Create patch baseline. For Name, enter a name for your new patch baseline, for example, MyRHELPatchBaseline. (Optional) For Description, enter a description for this patch baseline. For Operating system, choose an operating system, for example, Red Hat Enterprise Linux. If you want to begin using this patch baseline as the default for the selected operating system as soon as you create it, check the box next to Set this patch baseline as the default patch baseline for operating system name instances. Note This option is available only if you first accessed Patch Manager before the patch policies release on December 22, 2022. Patch Manager 661 AWS Systems Manager User Guide For information about setting an existing patch baseline as the default, see Setting an existing patch baseline as the default. 8. In the Approval rules for operating-systems section, use the fields to create one or more auto-approval rules. • Products: The version of the operating systems the approval rule applies to, such as RedhatEnterpriseLinux7.4. The default selection is All. • Classification: The type of patches the approval rule applies to, such as Security or Enhancement. The default selection is All. Tip You can configure a patch baseline to control whether minor version upgrades for Linux are installed, such as RHEL 7.8. Minor version upgrades can be installed automatically by Patch Manager provided that the update is available in the appropriate repository. For Linux operating systems, minor version upgrades aren't classified consistently. They can be classified as bug fixes or security updates, or not classified, even within the same kernel version. Here are a few options for controlling whether a patch baseline installs them. • Option 1: The broadest approval rule to ensure minor version upgrades are installed when available is to specify Classification as All (*) and choose the Include nonsecurity updates option. • Option 2: To ensure patches for an operating system version are installed, you can use a wildcard (*) to specify its kernel format in the Patch exceptions section of the baseline. For example, the kernel format for RHEL 7.* is kernel-3.10.0- *.el7.x86_64. Enter kernel-3.10.0-*.el7.x86_64 in the Approved patches list in your patch baseline to ensure all patches, including minor version upgrades, are applied to your RHEL 7.* managed nodes. (If you know the exact package name of a minor version patch, you can enter that instead.) • Option 3: You can have the most control over which patches are applied to your managed nodes, including minor version upgrades, by using the InstallOverrideList Patch Manager 662 AWS Systems Manager User Guide parameter in the AWS-RunPatchBaseline document. For more information, see SSM Command document for patching: AWS-RunPatchBaseline. • Severity: The severity value of patches the rule is to apply to, such as Critical. The default selection is All. • Auto-approval: The method for selecting patches for automatic approval. Note Because it's not possible to reliably determine the release dates of update packages for Ubuntu Server, the auto-approval options aren't supported for this operating system. • Approve patches after a specified number of days: The number of days for Patch Manager to wait after a patch is released or last updated before a patch is automatically approved. You can enter any integer from zero (0) to
|
systems-manager-ug-214
|
systems-manager-ug.pdf
| 214 |
patching: AWS-RunPatchBaseline. • Severity: The severity value of patches the rule is to apply to, such as Critical. The default selection is All. • Auto-approval: The method for selecting patches for automatic approval. Note Because it's not possible to reliably determine the release dates of update packages for Ubuntu Server, the auto-approval options aren't supported for this operating system. • Approve patches after a specified number of days: The number of days for Patch Manager to wait after a patch is released or last updated before a patch is automatically approved. You can enter any integer from zero (0) to 360. For most scenarios, we recommend waiting no more than 100 days. • Approve patches released up to a specific date: The patch release date for which Patch Manager automatically applies all patches released or updated on or before that date. For example, if you specify July 7, 2023, no patches released or last updated on or after July 8, 2023, are installed automatically. • (Optional) Compliance reporting: The severity level you want to assign to patches approved by the baseline, such as Critical or High. Note If you specify a compliance reporting level and the patch state of any approved patch is reported as Missing, then the patch baseline's overall reported compliance severity is the severity level you specified. • Include non-security updates: Select the check box to install nonsecurity Linux operating system patches made available in the source repository, in addition to the security-related patches. Patch Manager 663 AWS Systems Manager Note User Guide For SUSE Linux Enterprise Server, (SLES) it isn't necessary to select the check box because patches for security and nonsecurity issues are installed by default on SLES managed nodes. For more information, see the content for SLES in How security patches are selected. For more information about working with approval rules in a custom patch baseline, see Custom baselines. 9. If you want to explicitly approve any patches in addition to those meeting your approval rules, do the following in the Patch exceptions section: • For Approved patches, enter a comma-separated list of the patches you want to approve. For information about accepted formats for lists of approved patches and rejected patches, see Package name formats for approved and rejected patch lists. • (Optional) For Approved patches compliance level, assign a compliance level to the patches in the list. • If any approved patches you specify aren't related to security, select the Include non- security updates check box for these patches to be installed on your Linux operating system as well. 10. If you want to explicitly reject any patches that otherwise meet your approval rules, do the following in the Patch exceptions section: • For Rejected patches, enter a comma-separated list of the patches you want to reject. For information about accepted formats for lists of approved patches and rejected patches, see Package name formats for approved and rejected patch lists. • For Rejected patches action, select the action for Patch Manager to take on patches included in the Rejected patches list. • Allow as dependency: A package in the Rejected patches list is installed only if it's a dependency of another package. It's considered compliant with the patch baseline and its status is reported as InstalledOther. This is the default action if no option is specified. • Block: Packages in the Rejected patches list, and packages that include them as dependencies, aren't installed by Patch Manager under any circumstances. If a package Patch Manager 664 AWS Systems Manager User Guide was installed before it was added to the Rejected patches list, or is installed outside of Patch Manager afterward, it's considered noncompliant with the patch baseline and its status is reported as InstalledRejected. Note Patch Manager searches for patch dependencies recursively. 11. (Optional) If you want to specify alternative patch repositories for different versions of an operating system, such as AmazonLinux2016.03 and AmazonLinux2017.09, do the following for each product in the Patch sources section: • In Name, enter a name to help you identify the source configuration. • In Product, select the version of the operating systems the patch source repository is for, such as RedhatEnterpriseLinux7.4. • In Configuration, enter the value of the yum repository configuration to use in the following format: [main] name=MyCustomRepository baseurl=https://my-custom-repository enabled=1 Tip For information about other options available for your yum repository configuration, see dnf.conf(5). Choose Add another source to specify a source repository for each additional operating system version, up to a maximum of 20. For more information about alternative source patch repositories, see How to specify an alternative patch source repository (Linux). 12. (Optional) For Manage tags, apply one or more tag key name/value pairs to the patch baseline. Patch Manager 665 AWS Systems Manager User Guide Tags are optional metadata that you assign
|
systems-manager-ug-215
|
systems-manager-ug.pdf
| 215 |
of the yum repository configuration to use in the following format: [main] name=MyCustomRepository baseurl=https://my-custom-repository enabled=1 Tip For information about other options available for your yum repository configuration, see dnf.conf(5). Choose Add another source to specify a source repository for each additional operating system version, up to a maximum of 20. For more information about alternative source patch repositories, see How to specify an alternative patch source repository (Linux). 12. (Optional) For Manage tags, apply one or more tag key name/value pairs to the patch baseline. Patch Manager 665 AWS Systems Manager User Guide Tags are optional metadata that you assign to a resource. Tags allow you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag a patch baseline to identify the severity level of patches it specifies, the operating system family it applies to, and the environment type. In this case, you could specify tags similar to the following key name/value pairs: • Key=PatchSeverity,Value=Critical • Key=OS,Value=RHEL • Key=Environment,Value=Production 13. Choose Create patch baseline. Creating a custom patch baseline for macOS Use the following procedure to create a custom patch baseline for macOS managed nodes in Patch Manager, a tool in AWS Systems Manager. For information about creating a patch baseline for Windows Server managed nodes, see Creating a custom patch baseline for Windows Server. For information about creating a patch baseline for Linux managed nodes, see Creating a custom patch baseline for Linux. Note macOS is not supported in all AWS Regions. For more information about Amazon EC2 support for macOS, see Amazon EC2 Mac instances in the Amazon EC2 User Guide. To create a custom patch baseline for macOS managed nodes 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Patch Manager. 3. Choose the Patch baselines tab, and then choose Create patch baseline. -or- If you are accessing Patch Manager for the first time in the current AWS Region, choose Start with an overview, choose the Patch baselines tab, and then choose Create patch baseline. Patch Manager 666 AWS Systems Manager User Guide 4. 5. 6. 7. For Name, enter a name for your new patch baseline, for example, MymacOSPatchBaseline. (Optional) For Description, enter a description for this patch baseline. For Operating system, choose macOS. If you want to begin using this patch baseline as the default for macOS as soon as you create it, check the box next to Set this patch baseline as the default patch baseline for macOS instances. Note This option is available only if you first accessed Patch Manager before the patch policies release on December 22, 2022. For information about setting an existing patch baseline as the default, see Setting an existing patch baseline as the default. 8. In the Approval rules for operating-systems section, use the fields to create one or more auto-approval rules. • Products: The version of the operating systems the approval rule applies to, such as Mojave10.14.1 or Catalina10.15.1. The default selection is All. Note The Homebrew open-source software package management system has discontinued support for macOS 10.14.x (Mojave) and 10.15.x (Catalina). As a result, patching operations using Patch Manager are not supported for these versions. • Classification: The package manager or package managers that you want to apply packages during the patching process. You can choose from the following: • softwareupdate • installer • brew • brew cask The default selection is All. • (Optional) Compliance reporting: The severity level you want to assign to patches approved by the baseline, such as Critical or High. Patch Manager 667 AWS Systems Manager Note User Guide If you specify a compliance reporting level and the patch state of any approved patch is reported as Missing, then the patch baseline's overall reported compliance severity is the severity level you specified. For more information about working with approval rules in a custom patch baseline, see Custom baselines. 9. If you want to explicitly approve any patches in addition to those meeting your approval rules, do the following in the Patch exceptions section: • For Approved patches, enter a comma-separated list of the patches you want to approve. For information about accepted formats for lists of approved patches and rejected patches, see Package name formats for approved and rejected patch lists. • (Optional) For Approved patches compliance level, assign a compliance level to the patches in the list. 10. If you want to explicitly reject any patches that otherwise meet your approval rules, do the following in the Patch exceptions section: • For Rejected patches, enter a comma-separated list of the patches you want to reject. For information about accepted formats for lists of approved patches and rejected patches, see Package name formats for approved and rejected patch lists. • For Rejected patches
|
systems-manager-ug-216
|
systems-manager-ug.pdf
| 216 |
for lists of approved patches and rejected patches, see Package name formats for approved and rejected patch lists. • (Optional) For Approved patches compliance level, assign a compliance level to the patches in the list. 10. If you want to explicitly reject any patches that otherwise meet your approval rules, do the following in the Patch exceptions section: • For Rejected patches, enter a comma-separated list of the patches you want to reject. For information about accepted formats for lists of approved patches and rejected patches, see Package name formats for approved and rejected patch lists. • For Rejected patches action, select the action for Patch Manager to take on patches included in the Rejected patches list. • Allow as dependency: A package in the Rejected patches list is installed only if it's a dependency of another package. It's considered compliant with the patch baseline and its status is reported as InstalledOther. This is the default action if no option is specified. • Block: Packages in the Rejected patches list, and packages that include them as dependencies, aren't installed by Patch Manager under any circumstances. If a package was installed before it was added to the Rejected patches list, or is installed outside of Patch Manager afterward, it's considered noncompliant with the patch baseline and its status is reported as InstalledRejected. Patch Manager 668 AWS Systems Manager User Guide 11. (Optional) For Manage tags, apply one or more tag key name/value pairs to the patch baseline. Tags are optional metadata that you assign to a resource. Tags allow you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag a patch baseline to identify the severity level of patches it specifies, the package manager it applies to, and the environment type. In this case, you could specify tags similar to the following key name/value pairs: • Key=PatchSeverity,Value=Critical • Key=PackageManager,Value=softwareupdate • Key=Environment,Value=Production 12. Choose Create patch baseline. Creating a custom patch baseline for Windows Server Use the following procedure to create a custom patch baseline for Windows managed nodes in Patch Manager, a tool in AWS Systems Manager. For information about creating a patch baseline for Linux managed nodes, see Creating a custom patch baseline for Linux. Fo information about creating a patch baseline for macOS managed nodes, see Creating a custom patch baseline for macOS. For an example of creating a patch baseline that is limited to installing Windows Service Packs only, see Tutorial: Create a patch baseline for installing Windows Service Packs using the console. To create a custom patch baseline (Windows) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Patch Manager. 3. Choose the Patch baselines tab, and then choose Create patch baseline. -or- If you are accessing Patch Manager for the first time in the current AWS Region, choose Start with an overview, choose the Patch baselines tab, and then choose Create patch baseline. Patch Manager 669 AWS Systems Manager User Guide 4. For Name, enter a name for your new patch baseline, for example, MyWindowsPatchBaseline. 5. 6. 7. (Optional) For Description, enter a description for this patch baseline. For Operating system, choose Windows. For Available security updates compliance status, choose the status you want to assign to security patches that are available but not approved because they don't meet the installation criteria specified in the patch baseline, Non-Compliant or Compliant. Example scenario: Security patches that you might want installed can be skipped if you have specified a long period to wait after a patch is released before installation. If an update to the patch is released during your specified waiting period, the waiting period for installing the patch starts over. If the waiting period is too long, multiple versions of the patch could be released but never installed. 8. If you want to begin using this patch baseline as the default for Windows as soon as you create it, select Set this patch baseline as the default patch baseline for Windows Server instances . Note This option is available only if you first accessed Patch Manager before the patch policies release on December 22, 2022. For information about setting an existing patch baseline as the default, see Setting an existing patch baseline as the default. 9. In the Approval rules for operating systems section, use the fields to create one or more auto-approval rules. • Products: The version of the operating systems the approval rule applies to, such as WindowsServer2012. The default selection is All. • Classification: The type of patches the approval rule applies to, such as CriticalUpdates, Drivers, and Tools. The default selection is All. Tip You can include Windows Service Pack installations in your approval rules by including ServicePacks or by choosing All in
|
systems-manager-ug-217
|
systems-manager-ug.pdf
| 217 |
about setting an existing patch baseline as the default, see Setting an existing patch baseline as the default. 9. In the Approval rules for operating systems section, use the fields to create one or more auto-approval rules. • Products: The version of the operating systems the approval rule applies to, such as WindowsServer2012. The default selection is All. • Classification: The type of patches the approval rule applies to, such as CriticalUpdates, Drivers, and Tools. The default selection is All. Tip You can include Windows Service Pack installations in your approval rules by including ServicePacks or by choosing All in your Classification list. For an Patch Manager 670 AWS Systems Manager User Guide example, see Tutorial: Create a patch baseline for installing Windows Service Packs using the console. • Severity: The severity value of patches the rule is to apply to, such as Critical. The default selection is All. • Auto-approval: The method for selecting patches for automatic approval. • Approve patches after a specified number of days: The number of days for Patch Manager to wait after a patch is released or updated before a patch is automatically approved. You can enter any integer from zero (0) to 360. For most scenarios, we recommend waiting no more than 100 days. • Approve patches released up to a specific date: The patch release date for which Patch Manager automatically applies all patches released or updated on or before that date. For example, if you specify July 7, 2023, no patches released or last updated on or after July 8, 2023, are installed automatically. • (Optional) Compliance reporting: The severity level you want to assign to patches approved by the baseline, such as High. Note If you specify a compliance reporting level and the patch state of any approved patch is reported as Missing, then the patch baseline's overall reported compliance severity is the severity level you specified. 10. (Optional) In the Approval rules for applications section, use the fields to create one or more auto-approval rules. Note Instead of specifying approval rules, you can specify lists of approved and rejected patches as patch exceptions. See steps 10 and 11. • Product family: The general Microsoft product family for which you want to specify a rule, such as Office or Exchange Server. Patch Manager 671 AWS Systems Manager User Guide • Products: The version of the application the approval rule applies to, such as Office 2016 or Active Directory Rights Management Services Client 2.0 2016. The default selection is All. • Classification: The type of patches the approval rule applies to, such as CriticalUpdates. The default selection is All. • Severity: The severity value of patches the rule applies to, such as Critical. The default selection is All. • Auto-approval: The method for selecting patches for automatic approval. • Approve patches after a specified number of days: The number of days for Patch Manager to wait after a patch is released or updated before a patch is automatically approved. You can enter any integer from zero (0) to 360. For most scenarios, we recommend waiting no more than 100 days. • Approve patches released up to a specific date: The patch release date for which Patch Manager automatically applies all patches released or updated on or before that date. For example, if you specify July 7, 2023, no patches released or last updated on or after July 8, 2023, are installed automatically. • (Optional) Compliance reporting: The severity level you want to assign to patches approved by the baseline, such as Critical or High. Note If you specify a compliance reporting level and the patch state of any approved patch is reported as Missing, then the patch baseline's overall reported compliance severity is the severity level you specified. 11. (Optional) If you want to explicitly approve any patches instead of letting patches be selected according to approval rules, do the following in the Patch exceptions section: • For Approved patches, enter a comma-separated list of the patches you want to approve. For information about accepted formats for lists of approved patches and rejected patches, see Package name formats for approved and rejected patch lists. • (Optional) For Approved patches compliance level, assign a compliance level to the patches in the list. 12. If you want to explicitly reject any patches that otherwise meet your approval rules, do the following in the Patch exceptions section: Patch Manager 672 AWS Systems Manager User Guide • For Rejected patches, enter a comma-separated list of the patches you want to reject. For information about accepted formats for lists of approved patches and rejected patches, see Package name formats for approved and rejected patch lists. • For Rejected patches action, select the action for Patch Manager to take on patches included in the Rejected patches list.
|
systems-manager-ug-218
|
systems-manager-ug.pdf
| 218 |
assign a compliance level to the patches in the list. 12. If you want to explicitly reject any patches that otherwise meet your approval rules, do the following in the Patch exceptions section: Patch Manager 672 AWS Systems Manager User Guide • For Rejected patches, enter a comma-separated list of the patches you want to reject. For information about accepted formats for lists of approved patches and rejected patches, see Package name formats for approved and rejected patch lists. • For Rejected patches action, select the action for Patch Manager to take on patches included in the Rejected patches list. • Allow as dependency: Windows Server doesn't support the concept of package dependencies. If a package in the Rejected patches list and already installed on the node, its status is reported as INSTALLED_OTHER. Any package not already installed on the node is skipped. • Block: Packages in the Rejected patches list aren't installed by Patch Manager under any circumstances. If a package was installed before it was added to the Rejected patches list, or is installed outside of Patch Manager afterward, it's considered noncompliant with the patch baseline and its status is reported as INSTALLED_REJECTED. For more information about rejected package actions, see Rejected patch list options in custom patch baselines. 13. (Optional) For Manage tags, apply one or more tag key name/value pairs to the patch baseline. Tags are optional metadata that you assign to a resource. Tags allow you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag a patch baseline to identify the severity level of patches it specifies, the operating system family it applies to, and the environment type. In this case, you could specify tags similar to the following key name/value pairs: • Key=PatchSeverity,Value=Critical • Key=OS,Value=RHEL • Key=Environment,Value=Production 14. Choose Create patch baseline. Updating or deleting a custom patch baseline You can update or delete a custom patch baseline that you have created in Patch Manager, a tool in AWS Systems Manager. When you update a patch baseline, you can change its name or description, its approval rules, and its exceptions for approved and rejected patches. You can also update the Patch Manager 673 AWS Systems Manager User Guide tags that are applied to the patch baseline. You can't change the operating system type that a patch baseline has been created for, and you can't make changes to a predefined patch baseline provided by AWS. Updating or deleting a patch baseline Follow these steps to update or delete a patch baseline. Important Use caution when deleting a custom patch baseline that might be used by a patch policy configuration in Quick Setup. If you are using a patch policy configuration in Quick Setup, updates you make to custom patch baselines are synchronized with Quick Setup once an hour. If a custom patch baseline that was referenced in a patch policy is deleted, a banner displays on the Quick Setup Configuration details page for your patch policy. The banner informs you that the patch policy references a patch baseline that no longer exists, and that subsequent patching operations will fail. In this case, return to the Quick Setup Configurations page, select the Patch Manager configuration , and choose Actions, Edit configuration. The deleted patch baseline name is highlighted, and you must select a new patch baseline for the affected operating system. To update or delete a patch baseline 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Patch Manager. 3. Choose the patch baseline that you want to update or delete, and then do one of the following: • To remove the patch baseline from your AWS account, choose Delete. The system prompts you to confirm your actions. • To make changes to the patch baseline name or description, approval rules, or patch exceptions, choose Edit. On the Edit patch baseline page, change the values and options that you want, and then choose Save changes. Patch Manager 674 AWS Systems Manager User Guide • To add, change, or delete tags applied to the patch baseline, choose the Tags tab, and then choose Edit tags. On the Edit patch baseline tags page, make updates to the patch baseline tags, and then choose Save changes. For information about the configuration choices you can make, see Working with custom patch baselines. Setting an existing patch baseline as the default Important Any default patch baseline selections you make here do not apply to patching operations that are based on a patch policy. Patch policies use their own patch baseline specifications. For more information about patch policies, see Patch policy configurations in Quick Setup. When you create a custom patch baseline in Patch Manager, a tool in AWS Systems Manager, you can
|
systems-manager-ug-219
|
systems-manager-ug.pdf
| 219 |
patch baseline tags page, make updates to the patch baseline tags, and then choose Save changes. For information about the configuration choices you can make, see Working with custom patch baselines. Setting an existing patch baseline as the default Important Any default patch baseline selections you make here do not apply to patching operations that are based on a patch policy. Patch policies use their own patch baseline specifications. For more information about patch policies, see Patch policy configurations in Quick Setup. When you create a custom patch baseline in Patch Manager, a tool in AWS Systems Manager, you can set the baseline as the default for the associated operating system type as soon as you create it. For information, see Working with custom patch baselines. You can also set an existing patch baseline as the default for an operating system type. Note The steps you follow depend on whether you first accessed Patch Manager before or after the patch policies release on December 22, 2022. If you used Patch Manager before that date, you can use the console procedure. Otherwise, use the AWS CLI procedure. The Actions menu referenced in the console procedure is not displayed in Regions where Patch Manager wasn't used before the patch policies release. To set a patch baseline as the default 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Patch Manager. 3. Choose the Patch baselines tab. Patch Manager 675 AWS Systems Manager User Guide 4. In the patch baselines list, choose the button of a patch baseline that isn't currently set as the default for an operating system type. The Default baseline column indicates which baselines are currently set as the defaults. 5. In the Actions menu, choose Set default patch baseline. Important The Actions menu is not available if you didn't work with Patch Manager in the current AWS account and Region before December 22, 2022. See the Note earlier in this topic for more information. 6. In the confirmation dialog box, choose Set default. To set a patch baseline as the default (AWS CLI) 1. Run the describe-patch-baselines command to view a list of available patch baselines and their IDs and Amazon Resource Names (ARNs). aws ssm describe-patch-baselines 2. Run the register-default-patch-baseline command to set a baseline as the default for the operating system it's associated with. Replace baseline-id-or-ARN with the ID of the custom patch baseline or predefined baseline to use. Linux & macOS aws ssm register-default-patch-baseline \ --baseline-id baseline-id-or-ARN The following is an example of a setting a custom baseline as the default. aws ssm register-default-patch-baseline \ --baseline-id pb-abc123cf9bEXAMPLE The following is an example of a setting a predefined baseline managed by AWS as the default. Patch Manager 676 AWS Systems Manager User Guide aws ssm register-default-patch-baseline \ --baseline-id arn:aws:ssm:us-east-2:733109147000:patchbaseline/ pb-0574b43a65ea646e Windows Server aws ssm register-default-patch-baseline ^ --baseline-id baseline-id-or-ARN The following is an example of a setting a custom baseline as the default. aws ssm register-default-patch-baseline ^ --baseline-id pb-abc123cf9bEXAMPLE The following is an example of a setting a predefined baseline managed by AWS as the default. aws ssm register-default-patch-baseline ^ --baseline-id arn:aws:ssm:us-east-2:733109147000:patchbaseline/ pb-071da192df1226b63 Viewing available patches With Patch Manager, a tool in AWS Systems Manager, you can view all available patches for a specified operating system and, optionally, a specific operating system version. Tip To generate a list of available patches and save them to a file, you can use the describe- available-patches command and specify your preferred output. To view available patches 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Patch Manager. Patch Manager 677 AWS Systems Manager 3. Choose the Patches tab. -or- User Guide If you are accessing Patch Manager for the first time in the current AWS Region, choose Start with an overview, and then choose the Patches tab. Note For Windows Server, the Patches tab displays updates that are available from Windows Server Update Service (WSUS). 4. For Operating system, choose the operating system for which you want to view available patches, such as Windows or Amazon Linux. 5. (Optional) For Product, choose an OS version, such as WindowsServer2019 or AmazonLinux2018.03. 6. (Optional) To add or remove information columns for your results, choose the configure button ( at the top right of the Patches list. (By default, the Patches tab displays columns for only some of the available patch metadata.) ) For information about the types of metadata you can add to your view, see Patch in the AWS Systems Manager API Reference. Creating and managing patch groups If you are not using patch policies in your operations, you can organize your patching efforts by adding managed nodes to patch groups by using tags. Note Patch groups are not used in patching operations that are based on patch
|
systems-manager-ug-220
|
systems-manager-ug.pdf
| 220 |
columns for your results, choose the configure button ( at the top right of the Patches list. (By default, the Patches tab displays columns for only some of the available patch metadata.) ) For information about the types of metadata you can add to your view, see Patch in the AWS Systems Manager API Reference. Creating and managing patch groups If you are not using patch policies in your operations, you can organize your patching efforts by adding managed nodes to patch groups by using tags. Note Patch groups are not used in patching operations that are based on patch policies. For information about working with patch policies, see Patch policy configurations in Quick Setup. Patch group functionality is not supported in the console for account-Region pairs that did not already use patch groups before patch policy support was released on December 22, Patch Manager 678 AWS Systems Manager User Guide 2022. Patch group functionality is still available in account-Region pairs that began using patch groups before this date. To use tags in patching operations, you must apply the tag key Patch Group or PatchGroup to your managed nodes. You must also specify the name that you want to give the patch group as the value of the tag. You can specify any tag value, but the tag key must be Patch Group or PatchGroup. PatchGroup (without a space) is required if you have allowed tags in EC2 instance metadata. After you group your managed nodes using tags, you add the patch group value to a patch baseline. By registering the patch group with a patch baseline, you ensure that the correct patches are installed during the patching operation. For more information about patch groups, see Patch groups. Complete the tasks in this topic to prepare your managed nodes for patching using tags with your nodes and patch baseline. Task 1 is required only if you are patching Amazon EC2 instances. Task 2 is required only if you are patching non-EC2 instances in a hybrid and multicloud environment. Task 3 is required for all managed nodes. Tip You can also add tags to managed nodes using the AWS CLI command add-tags-to- resource or the Systems Manager API operation ssm-agent-minimum-s3-permissions- requiredAddTagsToResource. Tasks • Task 1: Add EC2 instances to a patch group using tags • Task 2: Add managed nodes to a patch group using tags • Task 3: Add a patch group to a patch baseline Task 1: Add EC2 instances to a patch group using tags You can add tags to EC2 instances using the Systems Manager console or the Amazon EC2 console. This task is required only if you are patching Amazon EC2 instances. Patch Manager 679 AWS Systems Manager Important User Guide You can't apply the Patch Group tag (with a space) to an Amazon EC2 instance if the Allow tags in instance metadata option is enabled on the instance. Allowing tags in instance metadata prevents tag key names from containing spaces. If you have allowed tags in EC2 instance metadata, you must use the tag key PatchGroup (without a space). Option 1: To add EC2 instances to a patch group (Systems Manager console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- 2. 3. manager/. In the navigation pane, choose Fleet Manager. In the Managed nodes list, choose the ID of a managed EC2 instance that you want to configure for patching. Node IDs for EC2 instances begin with i-. Note When using the Amazon EC2 console and AWS CLI, it's possible to apply Key = Patch Group or Key = PatchGroup tags to instances that aren't yet configured for use with Systems Manager. If a managed node you expect to see isn't listed, see Troubleshooting managed node availability for troubleshooting tips. 4. Choose the Tags tab, then choose Edit. 5. In the left column, enter Patch Group or PatchGroup. If you have allowed tags in EC2 instance metadata, you must use PatchGroup (without a space). 6. In the right column, enter a tag value to serve as the name for the patch group. 7. Choose Save. 8. Repeat this procedure to add other EC2 instances to the same patch group. Option 2: To add EC2 instances to a patch group (Amazon EC2 console) 1. Open the Amazon EC2 console, and then choose Instances in the navigation pane. 2. 3. In the list of instances, choose an instance that you want to configure for patching. In the Actions menu, choose Instance settings, Manage tags. Patch Manager 680 AWS Systems Manager 4. Choose Add new tag. User Guide 5. For Key, enter Patch Group or PatchGroup. If you have allowed tags in EC2 instance metadata, you must use PatchGroup (without a space). 6. For Value, enter a value to serve as the name for the patch group.
|
systems-manager-ug-221
|
systems-manager-ug.pdf
| 221 |
instances to a patch group (Amazon EC2 console) 1. Open the Amazon EC2 console, and then choose Instances in the navigation pane. 2. 3. In the list of instances, choose an instance that you want to configure for patching. In the Actions menu, choose Instance settings, Manage tags. Patch Manager 680 AWS Systems Manager 4. Choose Add new tag. User Guide 5. For Key, enter Patch Group or PatchGroup. If you have allowed tags in EC2 instance metadata, you must use PatchGroup (without a space). 6. For Value, enter a value to serve as the name for the patch group. 7. Choose Save. 8. Repeat this procedure to add other instances to the same patch group. Task 2: Add managed nodes to a patch group using tags Follow the steps in this topic to add tags to AWS IoT Greengrass core devices and non-EC2 hybrid- activated managed nodes (mi-*). This task is required only if you are patching non-EC2 instances in a hybrid and multicloud environment. Note You can't add tags for non-EC2 managed nodes using the Amazon EC2 console. To add non-EC2 managed nodes to a patch group (Systems Manager console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- 2. 3. manager/. In the navigation pane, choose Fleet Manager. In the Managed nodes list, choose the name of the managed node that you want to configure for patching. Note If a managed node you expect to see isn't listed, see Troubleshooting managed node availability for troubleshooting tips. 4. Choose the Tags tab, then choose Edit. 5. In the left column, enter Patch Group or PatchGroup. If you have allowed tags in EC2 instance metadata, you must use PatchGroup (without a space). 6. In the right column, enter a tag value to serve as the name for the patch group. 7. Choose Save. Patch Manager 681 AWS Systems Manager User Guide 8. Repeat this procedure to add other managed nodes to the same patch group. Task 3: Add a patch group to a patch baseline To associate a specific patch baseline with your managed nodes, you must add the patch group value to the patch baseline. By registering the patch group with a patch baseline, you can ensure that the correct patches are installed during a patching operation. This task is required whether you are patching EC2 instances, non-EC2 managed nodes, or both. For more information about patch groups, see Patch groups. Note The steps you follow depend on whether you first accessed Patch Manager before or after the patch policies release on December 22, 2022. To add a patch group to a patch baseline (Systems Manager console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- 2. 3. manager/. In the navigation pane, choose Patch Manager. If you're accessing Patch Manager for the first time in the current AWS Region and the Patch Manager start page opens, choose Start with an overview. 4. Choose the Patch baselines tab, and then in the Patch baselines list, choose the name of the patch baseline that you want to configure for your patch group. If you didn't first access Patch Manager until after the patch policies release, you must choose a custom baseline that you have created. 5. If the Baseline ID details page includes an Actions menu, do the following: • Choose Actions, then Modify patch groups. • Enter the tag value you added to your managed nodes in Task 2: Add managed nodes to a patch group using tags, then choose Add. If the Baseline ID details page does not include an Actions menu, patch groups can't be configured in the console. Instead, you can do either of the following: Patch Manager 682 AWS Systems Manager User Guide • (Recommended) Set up a patch policy in Quick Setup, a tool in AWS Systems Manager, to map a patch baseline to one or more EC2 instances. For more information, see Using Quick Setup patch policies and Automate organization- wide patching using a Quick Setup patch policy. • Use the register-patch-baseline-for-patch-group command in the AWS Command Line Interface (AWS CLI) to configure a patch group. Integrating Patch Manager with AWS Security Hub AWS Security Hub provides you with a comprehensive view of your security state in AWS. Security Hub collects security data from across AWS accounts, AWS services, and supported third-party partner products. With Security Hub, you can check your environment against security industry standards and best practices. Security Hub helps you to analyze your security trends and identify the highest priority security issues. By using the integration between Patch Manager, a tool in AWS Systems Manager, and Security Hub, you can send findings about noncompliant nodes from Patch Manager to Security Hub. A finding is the observable record of a security check or security-related detection. Security Hub can then include
|
systems-manager-ug-222
|
systems-manager-ug.pdf
| 222 |
of your security state in AWS. Security Hub collects security data from across AWS accounts, AWS services, and supported third-party partner products. With Security Hub, you can check your environment against security industry standards and best practices. Security Hub helps you to analyze your security trends and identify the highest priority security issues. By using the integration between Patch Manager, a tool in AWS Systems Manager, and Security Hub, you can send findings about noncompliant nodes from Patch Manager to Security Hub. A finding is the observable record of a security check or security-related detection. Security Hub can then include those patch-related findings in its analysis of your security posture. The information in the following topics applies no matter which method or type of configuration you are using for your patching operations: • A patch policy configured in Quick Setup • A Host Management option configured in Quick Setup • A maintenance window to run a patch Scan or Install task • An on-demand Patch now operation Contents • How Patch Manager sends findings to Security Hub • Types of findings that Patch Manager sends • Latency for sending findings • Retrying when Security Hub isn't available • Viewing findings in Security Hub Patch Manager 683 AWS Systems Manager User Guide • Typical finding from Patch Manager • Turning on and configuring the integration • How to stop sending findings How Patch Manager sends findings to Security Hub In Security Hub, security issues are tracked as findings. Some findings come from issues that are detected by other AWS services or by third-party partners. Security Hub also has a set of rules that it uses to detect security issues and generate findings. Patch Manager is one of the Systems Manager tools that sends findings to Security Hub. After you perform a patching operation by running a SSM document (AWS-RunPatchBaseline, AWS- RunPatchBaselineAssociation, or AWS-RunPatchBaselineWithHooks), the patching information is sent to Inventory or Compliance, tools in AWS Systems Manager, or both. After Inventory, Compliance, or both receive the data, Patch Manager receives a notification. Then, Patch Manager evaluates the data for accuracy, formatting, and compliance. If all conditions are met, Patch Manager forwards the data to Security Hub. Security Hub provides tools to manage findings from across all of these sources. You can view and filter lists of findings and view details for a finding. For more information, see Viewing findings in the AWS Security Hub User Guide. You can also track the status of an investigation into a finding. For more information, see Taking action on findings in the AWS Security Hub User Guide. All findings in Security Hub use a standard JSON format called the AWS Security Finding Format (ASFF). The ASFF includes details about the source of the issue, the affected resources, and the current status of the finding. For more information, see AWS Security Finding Format (ASFF) in the AWS Security Hub User Guide. Types of findings that Patch Manager sends Patch Manager sends the findings to Security Hub using the AWS Security Finding Format (ASFF). In ASFF, the Types field provides the finding type. Findings from Patch Manager have the following value for Types: • Software and Configuration Checks/Patch Management Patch Manager sends one finding per noncompliant managed node. The finding is reported with the resource type AwsEc2Instance so that findings can be correlated with other Security Hub Patch Manager 684 AWS Systems Manager User Guide integrations that report AwsEc2Instance resource types. Patch Manager only forwards a finding to Security Hub if the operation discovered the managed node to be noncompliant. The finding includes the Patch Summary results. Note After reporting a noncompliant node to Security Hub. Patch Manager doesn't send an update to Security Hub after the node is made compliant. You can manually resolve findings in Security Hub after the required patches have been applied to the managed node. For more information about compliance definitions, see Patch compliance state values. For more information about PatchSummary, see PatchSummary in the AWS Security Hub API Reference. Latency for sending findings When Patch Manager creates a new finding, it's usually sent to Security Hub within a few seconds to 2 hours. The speed depends on the traffic in the AWS Region being processed at that time. Retrying when Security Hub isn't available If there is a service outage, an AWS Lambda function is run to put the messages back into the main queue after the service is running again. After the messages are in the main queue, the retry is automatic. If Security Hub isn't available, Patch Manager retries sending the findings until they're received. Viewing findings in Security Hub This procedure describes how to view findings in Security Hub about managed nodes in your fleet that are out of patch compliance. To review Security Hub findings for patch
|
systems-manager-ug-223
|
systems-manager-ug.pdf
| 223 |
AWS Region being processed at that time. Retrying when Security Hub isn't available If there is a service outage, an AWS Lambda function is run to put the messages back into the main queue after the service is running again. After the messages are in the main queue, the retry is automatic. If Security Hub isn't available, Patch Manager retries sending the findings until they're received. Viewing findings in Security Hub This procedure describes how to view findings in Security Hub about managed nodes in your fleet that are out of patch compliance. To review Security Hub findings for patch compliance 1. Sign in to the AWS Management Console and open the AWS Security Hub console at https:// console.aws.amazon.com/securityhub/. 2. In the navigation pane, choose Findings. Patch Manager 685 AWS Systems Manager 3. Choose the Add filters ( box. User Guide ) 4. 5. In the menu, under Filters, choose Product name. In the dialog box that opens, choose is in the first field and then enter Systems Manager Patch Manager in the second field. 6. Choose Apply. 7. Add any additional filters you want to help narrow down your results. 8. In the list of results, choose the title of a finding you want more information about. A pane opens on the right side of the screen with more details about the resource, the issue discovered, and a recommended remediation. Important At this time, Security Hub reports the resource type of all managed nodes as EC2 Instance. This includes on-premises servers and virtual machines (VMs) that you have registered for use with Systems Manager. Severity classifications The list of findings for Systems Manager Patch Manager includes a report of the severity of the finding. Severity levels include the following, from lowest to highest: • INFORMATIONAL – No issue was found. • LOW – The issue does not require remediation. • MEDIUM – The issue must be addressed but is not urgent. • HIGH – The issue must be addressed as a priority. • CRITICAL – The issue must be remediated immediately to avoid escalation. Severity is determined by the most severe noncompliant package on an instance. Because you can have multiple patch baselines with multiple severity levels, the highest severity is reported out of all the noncompliant packages. For example, suppose you have two noncompliant packages where the severity of package A is "Critical" and the severity of package B is "Low". "Critical" will be reported as the severity. Patch Manager 686 AWS Systems Manager User Guide Note that the severity field correlates directly with the Patch Manager Compliance field. This is a field that you set assign to individual patches that match the rule. Because this Compliance field is assigned to individual patches, it is not reflected at the Patch Summary level. Related content • Findings in the AWS Security Hub User Guide • Multi-Account patch compliance with Patch Manager and Security Hub in the AWS Management & Governance Blog Typical finding from Patch Manager Patch Manager sends findings to Security Hub using the AWS Security Finding Format (ASFF). Here is an example of a typical finding from Patch Manager. { "SchemaVersion": "2018-10-08", "Id": "arn:aws:patchmanager:us-east-2:111122223333:instance/i-02573cafcfEXAMPLE/ document/AWS-RunPatchBaseline/run-command/d710f5bd-04e3-47b4-82f6-df4e0EXAMPLE", "ProductArn": "arn:aws:securityhub:us-east-1::product/aws/ssm-patch-manager", "GeneratorId": "d710f5bd-04e3-47b4-82f6-df4e0EXAMPLE", "AwsAccountId": "111122223333", "Types": [ "Software & Configuration Checks/Patch Management/Compliance" ], "CreatedAt": "2021-11-11T22:05:25Z", "UpdatedAt": "2021-11-11T22:05:25Z", "Severity": { "Label": "INFORMATIONAL", "Normalized": 0 }, "Title": "Systems Manager Patch Summary - Managed Instance Non-Compliant", "Description": "This AWS control checks whether each instance that is managed by AWS Systems Manager is in compliance with the rules of the patch baseline that applies to that instance when a compliance Scan runs.", "Remediation": { "Recommendation": { "Text": "For information about bringing instances into patch compliance, see 'Remediating out-of-compliance instances (Patch Manager)'.", "Url": "https://docs.aws.amazon.com/systems-manager/latest/userguide/patch- compliance-remediation.html" Patch Manager 687 AWS Systems Manager } User Guide }, "SourceUrl": "https://us-east-2.console.aws.amazon.com/systems-manager/fleet-manager/ i-02573cafcfEXAMPLE/patch?region=us-east-2", "ProductFields": { "aws/securityhub/FindingId": "arn:aws:securityhub:us-east-2::product/aws/ssm- patch-manager/arn:aws:patchmanager:us-east-2:111122223333:instance/i-02573cafcfEXAMPLE/ document/AWS-RunPatchBaseline/run-command/d710f5bd-04e3-47b4-82f6-df4e0EXAMPLE", "aws/securityhub/ProductName": "Systems Manager Patch Manager", "aws/securityhub/CompanyName": "AWS" }, "Resources": [ { "Type": "AwsEc2Instance", "Id": "i-02573cafcfEXAMPLE", "Partition": "aws", "Region": "us-east-2" } ], "WorkflowState": "NEW", "Workflow": { "Status": "NEW" }, "RecordState": "ACTIVE", "PatchSummary": { "Id": "pb-0c10e65780EXAMPLE", "InstalledCount": 45, "MissingCount": 2, "FailedCount": 0, "InstalledOtherCount": 396, "InstalledRejectedCount": 0, "InstalledPendingReboot": 0, "OperationStartTime": "2021-11-11T22:05:06Z", "OperationEndTime": "2021-11-11T22:05:25Z", "RebootOption": "NoReboot", "Operation": "SCAN" } } Patch Manager 688 AWS Systems Manager User Guide Turning on and configuring the integration To use the Patch Manager integration with Security Hub, you must turn on Security Hub. For information about how to turn on Security Hub, see Setting up Security Hub in the AWS Security Hub User Guide. The following procedure describes how to integrate Patch Manager and Security Hub when Security Hub is already active but Patch Manager integration is turned off. You only need to complete this procedure if integration was manually turned off. To add Patch Manager to Security Hub integration 1. In the navigation pane, choose Patch Manager. 2. Choose
|
systems-manager-ug-224
|
systems-manager-ug.pdf
| 224 |
User Guide Turning on and configuring the integration To use the Patch Manager integration with Security Hub, you must turn on Security Hub. For information about how to turn on Security Hub, see Setting up Security Hub in the AWS Security Hub User Guide. The following procedure describes how to integrate Patch Manager and Security Hub when Security Hub is already active but Patch Manager integration is turned off. You only need to complete this procedure if integration was manually turned off. To add Patch Manager to Security Hub integration 1. In the navigation pane, choose Patch Manager. 2. Choose the Settings tab. -or- If you are accessing Patch Manager for the first time in the current AWS Region, choose Start with an overview, and then choose the Settings tab. 3. Under the Export to Security Hub section, to the right of Patch compliance findings aren't being exported to Security Hub, choose Enable. How to stop sending findings To stop sending findings to Security Hub, you can use either the Security Hub console or the API. For more information, see the following topics in the AWS Security Hub User Guide: • Disabling and enabling the flow of findings from an integration (console) • Disabling the flow of findings from an integration (Security Hub API, AWS CLI) Working with Patch Manager resources using the AWS CLI The section includes examples of AWS Command Line Interface (AWS CLI) commands that you can use to perform configuration tasks for Patch Manager, a tool in AWS Systems Manager. For an illustration of using the AWS CLI to patch a server environment by using a custom patch baseline, see Tutorial: Patch a server environment using the AWS CLI. Patch Manager 689 AWS Systems Manager User Guide For more information about using the AWS CLI for AWS Systems Manager tasks, see the AWS Systems Manager section of the AWS CLI Command Reference. Topics • AWS CLI commands for patch baselines • AWS CLI commands for patch groups • AWS CLI commands for viewing patch summaries and details • AWS CLI commands for scanning and patching managed nodes AWS CLI commands for patch baselines Sample commands for patch baselines • Create a patch baseline • Create a patch baseline with custom repositories for different OS versions • Update a patch baseline • Rename a patch baseline • Delete a patch baseline • List all patch baselines • List all AWS-provided patch baselines • List my patch baselines • Display a patch baseline • Get the default patch baseline • Set a custom patch baseline as the default • Reset an AWS patch baseline as the default • Tag a patch baseline • List the tags for a patch baseline • Remove a tag from a patch baseline Create a patch baseline The following command creates a patch baseline that approves all critical and important security updates for Windows Server 2012 R2 5 days after they're released. Patches have also been Patch Manager 690 AWS Systems Manager User Guide specified for the Approved and Rejected patch lists. In addition, the patch baseline has been tagged to indicate that it's for a production environment. Linux & macOS aws ssm create-patch-baseline \ --name "Windows-Server-2012R2" \ --tags "Key=Environment,Value=Production" \ --description "Windows Server 2012 R2, Important and Critical security updates" \ --approved-patches "KB2032276,MS10-048" \ --rejected-patches "KB2124261" \ --rejected-patches-action "ALLOW_AS_DEPENDENCY" \ --approval-rules "PatchRules=[{PatchFilterGroup={PatchFilters=[{Key=MSRC_SEVERITY,Values=[Important,Critical]}, {Key=CLASSIFICATION,Values=SecurityUpdates}, {Key=PRODUCT,Values=WindowsServer2012R2}]},ApproveAfterDays=5}]" Windows Server aws ssm create-patch-baseline ^ --name "Windows-Server-2012R2" ^ --tags "Key=Environment,Value=Production" ^ --description "Windows Server 2012 R2, Important and Critical security updates" ^ --approved-patches "KB2032276,MS10-048" ^ --rejected-patches "KB2124261" ^ --rejected-patches-action "ALLOW_AS_DEPENDENCY" ^ --approval-rules "PatchRules=[{PatchFilterGroup={PatchFilters=[{Key=MSRC_SEVERITY,Values=[Important,Critical]}, {Key=CLASSIFICATION,Values=SecurityUpdates}, {Key=PRODUCT,Values=WindowsServer2012R2}]},ApproveAfterDays=5}]" The system returns information like the following. { "BaselineId":"pb-0c10e65780EXAMPLE" } Patch Manager 691 AWS Systems Manager User Guide Create a patch baseline with custom repositories for different OS versions Applies to Linux managed nodes only. The following command shows how to specify the patch repository to use for a particular version of the Amazon Linux operating system. This sample uses a source repository allowed by default on Amazon Linux 2017.09, but it could be adapted to a different source repository that you have configured for a managed node. Note To better demonstrate this more complex command, we're using the --cli-input-json option with additional options stored an external JSON file. 1. Create a JSON file with a name like my-patch-repository.json and add the following content to it. { "Description": "My patch repository for Amazon Linux 2017.09", "Name": "Amazon-Linux-2017.09", "OperatingSystem": "AMAZON_LINUX", "ApprovalRules": { "PatchRules": [ { "ApproveAfterDays": 7, "EnableNonSecurity": true, "PatchFilterGroup": { "PatchFilters": [ { "Key": "SEVERITY", "Values": [ "Important", "Critical" ] }, { "Key": "CLASSIFICATION", "Values": [ "Security", "Bugfix" ] }, { Patch Manager 692 AWS Systems Manager User Guide "Key": "PRODUCT", "Values": [ "AmazonLinux2017.09" ] } ] } } ] }, "Sources": [ { "Name": "My-AL2017.09", "Products": [ "AmazonLinux2017.09" ], "Configuration": "[amzn-main]
|
systems-manager-ug-225
|
systems-manager-ug.pdf
| 225 |
additional options stored an external JSON file. 1. Create a JSON file with a name like my-patch-repository.json and add the following content to it. { "Description": "My patch repository for Amazon Linux 2017.09", "Name": "Amazon-Linux-2017.09", "OperatingSystem": "AMAZON_LINUX", "ApprovalRules": { "PatchRules": [ { "ApproveAfterDays": 7, "EnableNonSecurity": true, "PatchFilterGroup": { "PatchFilters": [ { "Key": "SEVERITY", "Values": [ "Important", "Critical" ] }, { "Key": "CLASSIFICATION", "Values": [ "Security", "Bugfix" ] }, { Patch Manager 692 AWS Systems Manager User Guide "Key": "PRODUCT", "Values": [ "AmazonLinux2017.09" ] } ] } } ] }, "Sources": [ { "Name": "My-AL2017.09", "Products": [ "AmazonLinux2017.09" ], "Configuration": "[amzn-main] \nname=amzn-main-Base \nmirrorlist=http://repo./$awsregion./$awsdomain//$releasever/main/ mirror.list //nmirrorlist_expire=300//nmetadata_expire=300 \npriority=10 \nfailovermethod=priority \nfastestmirror_enabled=0 \ngpgcheck=1 \ngpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-ga \nenabled=1 \nretries=3 \ntimeout=5\nreport_instanceid=yes" } ] } 2. In the directory where you saved the file, run the following command. aws ssm create-patch-baseline --cli-input-json file://my-patch-repository.json The system returns information like the following. { "BaselineId": "pb-0c10e65780EXAMPLE" } Update a patch baseline The following command adds two patches as rejected and one patch as approved to an existing patch baseline. Patch Manager 693 AWS Systems Manager User Guide For information about accepted formats for lists of approved patches and rejected patches, see Package name formats for approved and rejected patch lists. Linux & macOS aws ssm update-patch-baseline \ --baseline-id pb-0c10e65780EXAMPLE \ --rejected-patches "KB2032276" "MS10-048" \ --approved-patches "KB2124261" Windows Server aws ssm update-patch-baseline ^ --baseline-id pb-0c10e65780EXAMPLE ^ --rejected-patches "KB2032276" "MS10-048" ^ --approved-patches "KB2124261" The system returns information like the following. { "BaselineId":"pb-0c10e65780EXAMPLE", "Name":"Windows-Server-2012R2", "RejectedPatches":[ "KB2032276", "MS10-048" ], "GlobalFilters":{ "PatchFilters":[ ] }, "ApprovalRules":{ "PatchRules":[ { "PatchFilterGroup":{ "PatchFilters":[ { "Values":[ "Important", "Critical" ], "Key":"MSRC_SEVERITY" Patch Manager 694 AWS Systems Manager User Guide }, { "Values":[ "SecurityUpdates" ], "Key":"CLASSIFICATION" }, { "Values":[ "WindowsServer2012R2" ], "Key":"PRODUCT" } ] }, "ApproveAfterDays":5 } ] }, "ModifiedDate":1481001494.035, "CreatedDate":1480997823.81, "ApprovedPatches":[ "KB2124261" ], "Description":"Windows Server 2012 R2, Important and Critical security updates" } Rename a patch baseline Linux & macOS aws ssm update-patch-baseline \ --baseline-id pb-0c10e65780EXAMPLE \ --name "Windows-Server-2012-R2-Important-and-Critical-Security-Updates" Windows Server aws ssm update-patch-baseline ^ --baseline-id pb-0c10e65780EXAMPLE ^ --name "Windows-Server-2012-R2-Important-and-Critical-Security-Updates" The system returns information like the following. Patch Manager 695 AWS Systems Manager User Guide { "BaselineId":"pb-0c10e65780EXAMPLE", "Name":"Windows-Server-2012-R2-Important-and-Critical-Security-Updates", "RejectedPatches":[ "KB2032276", "MS10-048" ], "GlobalFilters":{ "PatchFilters":[ ] }, "ApprovalRules":{ "PatchRules":[ { "PatchFilterGroup":{ "PatchFilters":[ { "Values":[ "Important", "Critical" ], "Key":"MSRC_SEVERITY" }, { "Values":[ "SecurityUpdates" ], "Key":"CLASSIFICATION" }, { "Values":[ "WindowsServer2012R2" ], "Key":"PRODUCT" } ] }, "ApproveAfterDays":5 } ] }, "ModifiedDate":1481001795.287, Patch Manager 696 AWS Systems Manager User Guide "CreatedDate":1480997823.81, "ApprovedPatches":[ "KB2124261" ], "Description":"Windows Server 2012 R2, Important and Critical security updates" } Delete a patch baseline aws ssm delete-patch-baseline --baseline-id "pb-0c10e65780EXAMPLE" The system returns information like the following. { "BaselineId":"pb-0c10e65780EXAMPLE" } List all patch baselines aws ssm describe-patch-baselines The system returns information like the following. { "BaselineIdentities":[ { "BaselineName":"AWS-DefaultPatchBaseline", "DefaultBaseline":true, "BaselineDescription":"Default Patch Baseline Provided by AWS.", "BaselineId":"arn:aws:ssm:us-east-2:111122223333:patchbaseline/ pb-0c10e65780EXAMPLE" }, { "BaselineName":"Windows-Server-2012R2", "DefaultBaseline":false, "BaselineDescription":"Windows Server 2012 R2, Important and Critical security updates", "BaselineId":"pb-0c10e65780EXAMPLE" } ] } Patch Manager 697 AWS Systems Manager User Guide Here is another command that lists all patch baselines in an AWS Region. Linux & macOS aws ssm describe-patch-baselines \ --region us-east-2 \ --filters "Key=OWNER,Values=[All]" Windows Server aws ssm describe-patch-baselines ^ --region us-east-2 ^ --filters "Key=OWNER,Values=[All]" The system returns information like the following. { "BaselineIdentities":[ { "BaselineName":"AWS-DefaultPatchBaseline", "DefaultBaseline":true, "BaselineDescription":"Default Patch Baseline Provided by AWS.", "BaselineId":"arn:aws:ssm:us-east-2:111122223333:patchbaseline/ pb-0c10e65780EXAMPLE" }, { "BaselineName":"Windows-Server-2012R2", "DefaultBaseline":false, "BaselineDescription":"Windows Server 2012 R2, Important and Critical security updates", "BaselineId":"pb-0c10e65780EXAMPLE" } ] } List all AWS-provided patch baselines Linux & macOS aws ssm describe-patch-baselines \ --region us-east-2 \ Patch Manager 698 AWS Systems Manager User Guide --filters "Key=OWNER,Values=[AWS]" Windows Server aws ssm describe-patch-baselines ^ --region us-east-2 ^ --filters "Key=OWNER,Values=[AWS]" The system returns information like the following. { "BaselineIdentities":[ { "BaselineName":"AWS-DefaultPatchBaseline", "DefaultBaseline":true, "BaselineDescription":"Default Patch Baseline Provided by AWS.", "BaselineId":"arn:aws:ssm:us-east-2:111122223333:patchbaseline/ pb-0c10e65780EXAMPLE" } ] } List my patch baselines Linux & macOS aws ssm describe-patch-baselines \ --region us-east-2 \ --filters "Key=OWNER,Values=[Self]" Windows Server aws ssm describe-patch-baselines ^ --region us-east-2 ^ --filters "Key=OWNER,Values=[Self]" The system returns information like the following. { "BaselineIdentities":[ Patch Manager 699 AWS Systems Manager { User Guide "BaselineName":"Windows-Server-2012R2", "DefaultBaseline":false, "BaselineDescription":"Windows Server 2012 R2, Important and Critical security updates", "BaselineId":"pb-0c10e65780EXAMPLE" } ] } Display a patch baseline aws ssm get-patch-baseline --baseline-id pb-0c10e65780EXAMPLE Note For custom patch baselines, you can specify either the patch baseline ID or the full Amazon Resource Name (ARN). For an AWS-provided patch baseline, you must specify the full ARN. For example, arn:aws:ssm:us-east-2:075727635805:patchbaseline/ pb-0c10e65780EXAMPLE. The system returns information like the following. { "BaselineId":"pb-0c10e65780EXAMPLE", "Name":"Windows-Server-2012R2", "PatchGroups":[ "Web Servers" ], "RejectedPatches":[ ], "GlobalFilters":{ "PatchFilters":[ ] }, "ApprovalRules":{ "PatchRules":[ { Patch Manager 700 AWS Systems Manager User Guide "PatchFilterGroup":{ "PatchFilters":[ { "Values":[ "Important", "Critical" ], "Key":"MSRC_SEVERITY" }, { "Values":[ "SecurityUpdates" ], "Key":"CLASSIFICATION" }, { "Values":[ "WindowsServer2012R2" ], "Key":"PRODUCT" } ] }, "ApproveAfterDays":5 } ] }, "ModifiedDate":1480997823.81, "CreatedDate":1480997823.81, "ApprovedPatches":[ ], "Description":"Windows Server 2012 R2, Important and Critical security updates" } Get the default patch baseline aws ssm get-default-patch-baseline --region us-east-2 The system returns information like the
|
systems-manager-ug-226
|
systems-manager-ug.pdf
| 226 |
patch baseline, you must specify the full ARN. For example, arn:aws:ssm:us-east-2:075727635805:patchbaseline/ pb-0c10e65780EXAMPLE. The system returns information like the following. { "BaselineId":"pb-0c10e65780EXAMPLE", "Name":"Windows-Server-2012R2", "PatchGroups":[ "Web Servers" ], "RejectedPatches":[ ], "GlobalFilters":{ "PatchFilters":[ ] }, "ApprovalRules":{ "PatchRules":[ { Patch Manager 700 AWS Systems Manager User Guide "PatchFilterGroup":{ "PatchFilters":[ { "Values":[ "Important", "Critical" ], "Key":"MSRC_SEVERITY" }, { "Values":[ "SecurityUpdates" ], "Key":"CLASSIFICATION" }, { "Values":[ "WindowsServer2012R2" ], "Key":"PRODUCT" } ] }, "ApproveAfterDays":5 } ] }, "ModifiedDate":1480997823.81, "CreatedDate":1480997823.81, "ApprovedPatches":[ ], "Description":"Windows Server 2012 R2, Important and Critical security updates" } Get the default patch baseline aws ssm get-default-patch-baseline --region us-east-2 The system returns information like the following. { "BaselineId":"arn:aws:ssm:us-east-2:111122223333:patchbaseline/pb-0c10e65780EXAMPLE" Patch Manager 701 User Guide AWS Systems Manager } Set a custom patch baseline as the default Linux & macOS aws ssm register-default-patch-baseline \ --region us-east-2 \ --baseline-id "pb-0c10e65780EXAMPLE" Windows Server aws ssm register-default-patch-baseline ^ --region us-east-2 ^ --baseline-id "pb-0c10e65780EXAMPLE" The system returns information like the following. { "BaselineId":"pb-0c10e65780EXAMPLE" } Reset an AWS patch baseline as the default Linux & macOS aws ssm register-default-patch-baseline \ --region us-east-2 \ --baseline-id "arn:aws:ssm:us-east-2:123456789012:patchbaseline/ pb-0c10e65780EXAMPLE" Windows Server aws ssm register-default-patch-baseline ^ --region us-east-2 ^ --baseline-id "arn:aws:ssm:us-east-2:123456789012:patchbaseline/ pb-0c10e65780EXAMPLE" The system returns information like the following. Patch Manager 702 AWS Systems Manager User Guide { "BaselineId":"pb-0c10e65780EXAMPLE" } Tag a patch baseline Linux & macOS aws ssm add-tags-to-resource \ --resource-type "PatchBaseline" \ --resource-id "pb-0c10e65780EXAMPLE" \ --tags "Key=Project,Value=Testing" Windows Server aws ssm add-tags-to-resource ^ --resource-type "PatchBaseline" ^ --resource-id "pb-0c10e65780EXAMPLE" ^ --tags "Key=Project,Value=Testing" List the tags for a patch baseline Linux & macOS aws ssm list-tags-for-resource \ --resource-type "PatchBaseline" \ --resource-id "pb-0c10e65780EXAMPLE" Windows Server aws ssm list-tags-for-resource ^ --resource-type "PatchBaseline" ^ --resource-id "pb-0c10e65780EXAMPLE" Remove a tag from a patch baseline Linux & macOS aws ssm remove-tags-from-resource \ Patch Manager 703 AWS Systems Manager User Guide --resource-type "PatchBaseline" \ --resource-id "pb-0c10e65780EXAMPLE" \ --tag-keys "Project" Windows Server aws ssm remove-tags-from-resource ^ --resource-type "PatchBaseline" ^ --resource-id "pb-0c10e65780EXAMPLE" ^ --tag-keys "Project" AWS CLI commands for patch groups Sample commands for patch groups • Create a patch group • Register a patch group "web servers" with a patch baseline • Register a patch group "Backend" with the AWS-provided patch baseline • Display patch group registrations • Deregister a patch group from a patch baseline Create a patch group Note Patch groups are not used in patching operations that are based on patch policies. For information about working with patch policies, see Patch policy configurations in Quick Setup. To help you organize your patching efforts, we recommend that you add managed nodes to patch groups by using tags. Patch groups require use of the tag key Patch Group or PatchGroup. If you have allowed tags in EC2 instance metadata, you must use PatchGroup (without a space). You can specify any tag value, but the tag key must be Patch Group or PatchGroup. For more information about patch groups, see Patch groups. Patch Manager 704 AWS Systems Manager User Guide After you group your managed nodes using tags, you add the patch group value to a patch baseline. By registering the patch group with a patch baseline, you ensure that the correct patches are installed during the patching operation. Task 1: Add EC2 instances to a patch group using tags Note When using the Amazon Elastic Compute Cloud (Amazon EC2) console and AWS CLI, it's possible to apply Key = Patch Group or Key = PatchGroup tags to instances that aren't yet configured for use with Systems Manager. If an EC2 instance you expect to see in Patch Manager isn't listed after applying the Patch Group or Key = PatchGroup tag, see Troubleshooting managed node availability for troubleshooting tips. Run the following command to add the PatchGroup tag to an EC2 instance. aws ec2 create-tags --resources "i-1234567890abcdef0" --tags "Key=PatchGroup,Value=GroupValue" Task 2: Add managed nodes to a patch group using tags Run the following command to add the PatchGroup tag to a managed node. Linux & macOS aws ssm add-tags-to-resource \ --resource-type "ManagedInstance" \ --resource-id "mi-0123456789abcdefg" \ --tags "Key=PatchGroup,Value=GroupValue" Windows Server aws ssm add-tags-to-resource ^ --resource-type "ManagedInstance" ^ --resource-id "mi-0123456789abcdefg" ^ --tags "Key=PatchGroup,Value=GroupValue" Patch Manager 705 AWS Systems Manager User Guide Task 3: Add a patch group to a patch baseline Run the following command to associate a PatchGroup tag value to the specified patch baseline. Linux & macOS aws ssm register-patch-baseline-for-patch-group \ --baseline-id "pb-0c10e65780EXAMPLE" \ --patch-group "Development" Windows Server aws ssm register-patch-baseline-for-patch-group ^ --baseline-id "pb-0c10e65780EXAMPLE" ^ --patch-group "Development" The system returns information like the following. { "PatchGroup": "Development", "BaselineId": "pb-0c10e65780EXAMPLE" } Register a patch group "web servers" with a patch baseline Linux & macOS aws ssm register-patch-baseline-for-patch-group \ --baseline-id "pb-0c10e65780EXAMPLE" \ --patch-group "Web Servers" Windows Server aws ssm register-patch-baseline-for-patch-group ^ --baseline-id "pb-0c10e65780EXAMPLE" ^ --patch-group "Web Servers" The system returns information like the following. { Patch Manager 706 AWS Systems Manager User Guide "PatchGroup":"Web Servers", "BaselineId":"pb-0c10e65780EXAMPLE" } Register a patch group "Backend" with the
|
systems-manager-ug-227
|
systems-manager-ug.pdf
| 227 |
patch baseline. Linux & macOS aws ssm register-patch-baseline-for-patch-group \ --baseline-id "pb-0c10e65780EXAMPLE" \ --patch-group "Development" Windows Server aws ssm register-patch-baseline-for-patch-group ^ --baseline-id "pb-0c10e65780EXAMPLE" ^ --patch-group "Development" The system returns information like the following. { "PatchGroup": "Development", "BaselineId": "pb-0c10e65780EXAMPLE" } Register a patch group "web servers" with a patch baseline Linux & macOS aws ssm register-patch-baseline-for-patch-group \ --baseline-id "pb-0c10e65780EXAMPLE" \ --patch-group "Web Servers" Windows Server aws ssm register-patch-baseline-for-patch-group ^ --baseline-id "pb-0c10e65780EXAMPLE" ^ --patch-group "Web Servers" The system returns information like the following. { Patch Manager 706 AWS Systems Manager User Guide "PatchGroup":"Web Servers", "BaselineId":"pb-0c10e65780EXAMPLE" } Register a patch group "Backend" with the AWS-provided patch baseline Linux & macOS aws ssm register-patch-baseline-for-patch-group \ --region us-east-2 \ --baseline-id "arn:aws:ssm:us-east-2:111122223333:patchbaseline/ pb-0c10e65780EXAMPLE" \ --patch-group "Backend" Windows Server aws ssm register-patch-baseline-for-patch-group ^ --region us-east-2 ^ --baseline-id "arn:aws:ssm:us-east-2:111122223333:patchbaseline/ pb-0c10e65780EXAMPLE" ^ --patch-group "Backend" The system returns information like the following. { "PatchGroup":"Backend", "BaselineId":"arn:aws:ssm:us-east-2:111122223333:patchbaseline/pb-0c10e65780EXAMPLE" } Display patch group registrations aws ssm describe-patch-groups --region us-east-2 The system returns information like the following. { "PatchGroupPatchBaselineMappings":[ { "PatchGroup":"Backend", "BaselineIdentity":{ "BaselineName":"AWS-DefaultPatchBaseline", Patch Manager 707 AWS Systems Manager User Guide "DefaultBaseline":false, "BaselineDescription":"Default Patch Baseline Provided by AWS.", "BaselineId":"arn:aws:ssm:us-east-2:111122223333:patchbaseline/ pb-0c10e65780EXAMPLE" } }, { "PatchGroup":"Web Servers", "BaselineIdentity":{ "BaselineName":"Windows-Server-2012R2", "DefaultBaseline":true, "BaselineDescription":"Windows Server 2012 R2, Important and Critical updates", "BaselineId":"pb-0c10e65780EXAMPLE" } } ] } Deregister a patch group from a patch baseline Linux & macOS aws ssm deregister-patch-baseline-for-patch-group \ --region us-east-2 \ --patch-group "Production" \ --baseline-id "arn:aws:ssm:us-east-2:111122223333:patchbaseline/ pb-0c10e65780EXAMPLE" Windows Server aws ssm deregister-patch-baseline-for-patch-group ^ --region us-east-2 ^ --patch-group "Production" ^ --baseline-id "arn:aws:ssm:us-east-2:111122223333:patchbaseline/ pb-0c10e65780EXAMPLE" The system returns information like the following. { "PatchGroup":"Production", "BaselineId":"arn:aws:ssm:us-east-2:111122223333:patchbaseline/pb-0c10e65780EXAMPLE" Patch Manager 708 AWS Systems Manager } User Guide AWS CLI commands for viewing patch summaries and details Sample commands for viewing patch summaries and details • Get all patches defined by a patch baseline • Get all patches for AmazonLinux2018.03 that have a Classification SECURITY and Severity of Critical • Get all patches for Windows Server 2012 that have a MSRC severity of Critical • Get all available patches • Get patch summary states per-managed node • Get patch compliance details for a managed node • View patching compliance results (AWS CLI) Get all patches defined by a patch baseline Note This command is supported for Windows Server patch baselines only. Linux & macOS aws ssm describe-effective-patches-for-patch-baseline \ --region us-east-2 \ --baseline-id "pb-0c10e65780EXAMPLE" Windows Server aws ssm describe-effective-patches-for-patch-baseline ^ --region us-east-2 ^ --baseline-id "pb-0c10e65780EXAMPLE" The system returns information like the following. { "NextToken":"--token string truncated--", Patch Manager 709 AWS Systems Manager "EffectivePatches":[ { "PatchStatus":{ "ApprovalDate":1384711200.0, "DeploymentStatus":"APPROVED" }, "Patch":{ User Guide "ContentUrl":"https://support.microsoft.com/en-us/kb/2876331", "ProductFamily":"Windows", "Product":"WindowsServer2012R2", "Vendor":"Microsoft", "Description":"A security issue has been identified in a Microsoft software product that could affect your system. You can help protect your system by installing this update from Microsoft. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article. After you install this update, you may have to restart your system.", "Classification":"SecurityUpdates", "Title":"Security Update for Windows Server 2012 R2 Preview (KB2876331)", "ReleaseDate":1384279200.0, "MsrcClassification":"Critical", "Language":"All", "KbNumber":"KB2876331", "MsrcNumber":"MS13-089", "Id":"e74ccc76-85f0-4881-a738-59e9fc9a336d" } }, { "PatchStatus":{ "ApprovalDate":1428858000.0, "DeploymentStatus":"APPROVED" }, "Patch":{ "ContentUrl":"https://support.microsoft.com/en-us/kb/2919355", "ProductFamily":"Windows", "Product":"WindowsServer2012R2", "Vendor":"Microsoft", "Description":"Windows Server 2012 R2 Update is a cumulative set of security updates, critical updates and updates. You must install Windows Server 2012 R2 Update to ensure that your computer can continue to receive future Windows Updates, including security updates. For a complete listing of the issues that are included in this update, see the associated Patch Manager 710 AWS Systems Manager User Guide Microsoft Knowledge Base article for more information. After you install this item, you may have to restart your computer.", "Classification":"SecurityUpdates", "Title":"Windows Server 2012 R2 Update (KB2919355)", "ReleaseDate":1428426000.0, "MsrcClassification":"Critical", "Language":"All", "KbNumber":"KB2919355", "MsrcNumber":"MS14-018", "Id":"8452bac0-bf53-4fbd-915d-499de08c338b" } } ---output truncated--- Get all patches for AmazonLinux2018.03 that have a Classification SECURITY and Severity of Critical Linux & macOS aws ssm describe-available-patches \ --region us-east-2 \ --filters Key=PRODUCT,Values=AmazonLinux2018.03 Key=SEVERITY,Values=Critical Windows Server aws ssm describe-available-patches ^ --region us-east-2 ^ --filters Key=PRODUCT,Values=AmazonLinux2018.03 Key=SEVERITY,Values=Critical The system returns information like the following. { "Patches": [ { "AdvisoryIds": ["ALAS-2011-1"], "BugzillaIds": [ "1234567" ], "Classification": "SECURITY", "CVEIds": [ "CVE-2011-3192"], "Name": "zziplib", "Epoch": "0", "Version": "2.71", Patch Manager 711 AWS Systems Manager User Guide "Release": "1.3.amzn1", "Arch": "i686", "Product": "AmazonLinux2018.03", "ReleaseDate": 1590519815, "Severity": "CRITICAL" } ] } ---output truncated--- Get all patches for Windows Server 2012 that have a MSRC severity of Critical Linux & macOS aws ssm describe-available-patches \ --region us-east-2 \ --filters Key=PRODUCT,Values=WindowsServer2012 Key=MSRC_SEVERITY,Values=Critical Windows Server aws ssm describe-available-patches ^ --region us-east-2 ^ --filters Key=PRODUCT,Values=WindowsServer2012 Key=MSRC_SEVERITY,Values=Critical The system returns information like the following. { "Patches":[ { "ContentUrl":"https://support.microsoft.com/en-us/kb/2727528", "ProductFamily":"Windows", "Product":"WindowsServer2012", "Vendor":"Microsoft", "Description":"A security issue has been identified that could allow an unauthenticated remote attacker to compromise your system and gain control over it. You can help protect your system by installing this update from Microsoft. After you install this update, you may have to restart your system.", "Classification":"SecurityUpdates", "Title":"Security Update for Windows
|
systems-manager-ug-228
|
systems-manager-ug.pdf
| 228 |
Windows Server 2012 that have a MSRC severity of Critical Linux & macOS aws ssm describe-available-patches \ --region us-east-2 \ --filters Key=PRODUCT,Values=WindowsServer2012 Key=MSRC_SEVERITY,Values=Critical Windows Server aws ssm describe-available-patches ^ --region us-east-2 ^ --filters Key=PRODUCT,Values=WindowsServer2012 Key=MSRC_SEVERITY,Values=Critical The system returns information like the following. { "Patches":[ { "ContentUrl":"https://support.microsoft.com/en-us/kb/2727528", "ProductFamily":"Windows", "Product":"WindowsServer2012", "Vendor":"Microsoft", "Description":"A security issue has been identified that could allow an unauthenticated remote attacker to compromise your system and gain control over it. You can help protect your system by installing this update from Microsoft. After you install this update, you may have to restart your system.", "Classification":"SecurityUpdates", "Title":"Security Update for Windows Server 2012 (KB2727528)", "ReleaseDate":1352829600.0, Patch Manager 712 AWS Systems Manager User Guide "MsrcClassification":"Critical", "Language":"All", "KbNumber":"KB2727528", "MsrcNumber":"MS12-072", "Id":"1eb507be-2040-4eeb-803d-abc55700b715" }, { "ContentUrl":"https://support.microsoft.com/en-us/kb/2729462", "ProductFamily":"Windows", "Product":"WindowsServer2012", "Vendor":"Microsoft", "Description":"A security issue has been identified that could allow an unauthenticated remote attacker to compromise your system and gain control over it. You can help protect your system by installing this update from Microsoft. After you install this update, you may have to restart your system.", "Classification":"SecurityUpdates", "Title":"Security Update for Microsoft .NET Framework 3.5 on Windows 8 and Windows Server 2012 for x64-based Systems (KB2729462)", "ReleaseDate":1352829600.0, "MsrcClassification":"Critical", "Language":"All", "KbNumber":"KB2729462", "MsrcNumber":"MS12-074", "Id":"af873760-c97c-4088-ab7e-5219e120eab4" } ---output truncated--- Get all available patches aws ssm describe-available-patches --region us-east-2 The system returns information like the following. { "NextToken":"--token string truncated--", "Patches":[ { "ContentUrl":"https://support.microsoft.com/en-us/kb/2032276", "ProductFamily":"Windows", "Product":"WindowsServer2008R2", "Vendor":"Microsoft", Patch Manager 713 AWS Systems Manager User Guide "Description":"A security issue has been identified that could allow an unauthenticated remote attacker to compromise your system and gain control over it. You can help protect your system by installing this update from Microsoft. After you install this update, you may have to restart your system.", "Classification":"SecurityUpdates", "Title":"Security Update for Windows Server 2008 R2 x64 Edition (KB2032276)", "ReleaseDate":1279040400.0, "MsrcClassification":"Important", "Language":"All", "KbNumber":"KB2032276", "MsrcNumber":"MS10-043", "Id":"8692029b-a3a2-4a87-a73b-8ea881b4b4d6" }, { "ContentUrl":"https://support.microsoft.com/en-us/kb/2124261", "ProductFamily":"Windows", "Product":"Windows7", "Vendor":"Microsoft", "Description":"A security issue has been identified that could allow an unauthenticated remote attacker to compromise your system and gain control over it. You can help protect your system by installing this update from Microsoft. After you install this update, you may have to restart your system.", "Classification":"SecurityUpdates", "Title":"Security Update for Windows 7 (KB2124261)", "ReleaseDate":1284483600.0, "MsrcClassification":"Important", "Language":"All", "KbNumber":"KB2124261", "MsrcNumber":"MS10-065", "Id":"12ef1bed-0dd2-4633-b3ac-60888aa8ba33" } ---output truncated--- Get patch summary states per-managed node The per-managed node summary gives you the number of patches in the following states per node: "NotApplicable", "Missing", "Failed", "InstalledOther" and "Installed". Linux & macOS aws ssm describe-instance-patch-states \ Patch Manager 714 AWS Systems Manager User Guide --instance-ids i-08ee91c0b17045407 i-09a618aec652973a9 Windows Server aws ssm describe-instance-patch-states ^ --instance-ids i-08ee91c0b17045407 i-09a618aec652973a9 The system returns information like the following. { "InstancePatchStates":[ { "InstanceId": "i-08ee91c0b17045407", "PatchGroup": "", "BaselineId": "pb-0c10e65780EXAMPLE", "SnapshotId": "6d03d6c5-f79d-41d0-8d0e-00a9aEXAMPLE", "InstalledCount": 50, "InstalledOtherCount": 353, "InstalledPendingRebootCount": 0, "InstalledRejectedCount": 0, "MissingCount": 0, "FailedCount": 0, "UnreportedNotApplicableCount": -1, "NotApplicableCount": 671, "OperationStartTime": "2020-01-24T12:37:56-08:00", "OperationEndTime": "2020-01-24T12:37:59-08:00", "Operation": "Scan", "RebootOption": "NoReboot" }, { "InstanceId": "i-09a618aec652973a9", "PatchGroup": "", "BaselineId": "pb-0c10e65780EXAMPLE", "SnapshotId": "c7e0441b-1eae-411b-8aa7-973e6EXAMPLE", "InstalledCount": 36, "InstalledOtherCount": 396, "InstalledPendingRebootCount": 0, "InstalledRejectedCount": 0, "MissingCount": 3, "FailedCount": 0, "UnreportedNotApplicableCount": -1, "NotApplicableCount": 420, Patch Manager 715 AWS Systems Manager User Guide "OperationStartTime": "2020-01-24T12:37:34-08:00", "OperationEndTime": "2020-01-24T12:37:37-08:00", "Operation": "Scan", "RebootOption": "NoReboot" } ---output truncated--- Get patch compliance details for a managed node aws ssm describe-instance-patches --instance-id i-08ee91c0b17045407 The system returns information like the following. { "NextToken":"--token string truncated--", "Patches":[ { "Title": "bind-libs.x86_64:32:9.8.2-0.68.rc1.60.amzn1", "KBId": "bind-libs.x86_64", "Classification": "Security", "Severity": "Important", "State": "Installed", "InstalledTime": "2019-08-26T11:05:24-07:00" }, { "Title": "bind-utils.x86_64:32:9.8.2-0.68.rc1.60.amzn1", "KBId": "bind-utils.x86_64", "Classification": "Security", "Severity": "Important", "State": "Installed", "InstalledTime": "2019-08-26T11:05:32-07:00" }, { "Title": "dhclient.x86_64:12:4.1.1-53.P1.28.amzn1", "KBId": "dhclient.x86_64", "Classification": "Security", "Severity": "Important", "State": "Installed", "InstalledTime": "2019-08-26T11:05:31-07:00" }, ---output truncated--- Patch Manager 716 AWS Systems Manager User Guide View patching compliance results (AWS CLI) To view patch compliance results for a single managed node Run the following command in the AWS Command Line Interface (AWS CLI) to view patch compliance results for a single managed node. aws ssm describe-instance-patch-states --instance-id instance-id Replace instance-id with the ID of the managed node for which you want to view results, in the format i-02573cafcfEXAMPLE or mi-0282f7c436EXAMPLE. The systems returns information like the following. { "InstancePatchStates": [ { "InstanceId": "i-02573cafcfEXAMPLE", "PatchGroup": "mypatchgroup", "BaselineId": "pb-0c10e65780EXAMPLE", "SnapshotId": "a3f5ff34-9bc4-4d2c-a665-4d1c1EXAMPLE", "CriticalNonCompliantCount": 2, "SecurityNonCompliantCount": 2, "OtherNonCompliantCount": 1, "InstalledCount": 123, "InstalledOtherCount": 334, "InstalledPendingRebootCount": 0, "InstalledRejectedCount": 0, "MissingCount": 1, "FailedCount": 2, "UnreportedNotApplicableCount": 11, "NotApplicableCount": 2063, "OperationStartTime": "2021-05-03T11:00:56-07:00", "OperationEndTime": "2021-05-03T11:01:09-07:00", "Operation": "Scan", "LastNoRebootInstallOperationTime": "2020-06-14T12:17:41-07:00", "RebootOption": "RebootIfNeeded" } ] } To view a patch count summary for all EC2 instances in a Region Patch Manager 717 AWS Systems Manager User Guide The describe-instance-patch-states supports retrieving results for just one managed instance at a time. However, using a custom script with the describe-instance-patch-states command, you can generate a more granular report. For example, if the jq filter tool is installed on you local machine, you could run the following command to identify which of your EC2 instances in a particular AWS Region have a status of InstalledPendingReboot. aws ssm describe-instance-patch-states \ --instance-ids $(aws ec2 describe-instances --region region | jq '.Reservations[].Instances[] |
|
systems-manager-ug-229
|
systems-manager-ug.pdf
| 229 |
To view a patch count summary for all EC2 instances in a Region Patch Manager 717 AWS Systems Manager User Guide The describe-instance-patch-states supports retrieving results for just one managed instance at a time. However, using a custom script with the describe-instance-patch-states command, you can generate a more granular report. For example, if the jq filter tool is installed on you local machine, you could run the following command to identify which of your EC2 instances in a particular AWS Region have a status of InstalledPendingReboot. aws ssm describe-instance-patch-states \ --instance-ids $(aws ec2 describe-instances --region region | jq '.Reservations[].Instances[] | .InstanceId' | tr '\n|"' ' ') \ --output text --query 'InstancePatchStates[*].{Instance:InstanceId, InstalledPendingRebootCount:InstalledPendingRebootCount}' region represents the identifier for an AWS Region supported by AWS Systems Manager, such as us-east-2 for the US East (Ohio) Region. For a list of supported region values, see the Region column in Systems Manager service endpoints in the Amazon Web Services General Reference. For example: aws ssm describe-instance-patch-states \ --instance-ids $(aws ec2 describe-instances --region us-east-2 | jq '.Reservations[].Instances[] | .InstanceId' | tr '\n|"' ' ') \ --output text --query 'InstancePatchStates[*].{Instance:InstanceId, InstalledPendingRebootCount:InstalledPendingRebootCount}' The system returns information like the following. 1 i-02573cafcfEXAMPLE 0 i-0471e04240EXAMPLE 3 i-07782c72faEXAMPLE 6 i-083b678d37EXAMPLE 0 i-03a530a2d4EXAMPLE 1 i-01f68df0d0EXAMPLE 0 i-0a39c0f214EXAMPLE 7 i-0903a5101eEXAMPLE 7 i-03823c2fedEXAMPLE In addition to InstalledPendingRebootCount, the list of count types you can search for include the following: Patch Manager 718 AWS Systems Manager User Guide • CriticalNonCompliantCount • SecurityNonCompliantCount • OtherNonCompliantCount • UnreportedNotApplicableCount • InstalledPendingRebootCount • FailedCount • NotApplicableCount • InstalledRejectedCount • InstalledOtherCount • MissingCount • InstalledCount AWS CLI commands for scanning and patching managed nodes After running the following commands to scan for patch compliance or install patches, you can use commands in the AWS CLI commands for viewing patch summaries and details section to view information about patch status and compliance. Sample commands • Scan managed nodes for patch compliance (AWS CLI) • Install patches on managed nodes (AWS CLI) Scan managed nodes for patch compliance (AWS CLI) To scan specific managed nodes for patch compliance Run the following command. Linux & macOS aws ssm send-command \ --document-name 'AWS-RunPatchBaseline' \ --targets Key=InstanceIds,Values='i-02573cafcfEXAMPLE,i-0471e04240EXAMPLE' \ --parameters 'Operation=Scan' \ Patch Manager 719 AWS Systems Manager --timeout-seconds 600 Windows Server User Guide aws ssm send-command ^ --document-name "AWS-RunPatchBaseline" ^ --targets Key=InstanceIds,Values="i-02573cafcfEXAMPLE,i-0471e04240EXAMPLE" ^ --parameters "Operation=Scan" ^ --timeout-seconds 600 The system returns information like the following. { "Command": { "CommandId": "a04ed06c-8545-40f4-87c2-a0babEXAMPLE", "DocumentName": "AWS-RunPatchBaseline", "DocumentVersion": "$DEFAULT", "Comment": "", "ExpiresAfter": 1621974475.267, "Parameters": { "Operation": [ "Scan" ] }, "InstanceIds": [], "Targets": [ { "Key": "InstanceIds", "Values": [ "i-02573cafcfEXAMPLE, i-0471e04240EXAMPLE" ] } ], "RequestedDateTime": 1621952275.267, "Status": "Pending", "StatusDetails": "Pending", "TimeoutSeconds": 600, ---output truncated--- } Patch Manager 720 AWS Systems Manager } User Guide To scan managed nodes for patch compliance by patch group tag Run the following command. Linux & macOS aws ssm send-command \ --document-name 'AWS-RunPatchBaseline' \ --targets Key='tag:PatchGroup',Values='Web servers' \ --parameters 'Operation=Scan' \ --timeout-seconds 600 Windows Server aws ssm send-command ^ --document-name "AWS-RunPatchBaseline" ^ --targets Key="tag:PatchGroup",Values="Web servers" ^ --parameters "Operation=Scan" ^ --timeout-seconds 600 The system returns information like the following. { "Command": { "CommandId": "87a448ee-8adc-44e0-b4d1-6b429EXAMPLE", "DocumentName": "AWS-RunPatchBaseline", "DocumentVersion": "$DEFAULT", "Comment": "", "ExpiresAfter": 1621974983.128, "Parameters": { "Operation": [ "Scan" ] }, "InstanceIds": [], "Targets": [ { "Key": "tag:PatchGroup", "Values": [ Patch Manager 721 AWS Systems Manager User Guide "Web servers" ] } ], "RequestedDateTime": 1621952783.128, "Status": "Pending", "StatusDetails": "Pending", "TimeoutSeconds": 600, ---output truncated--- } } Install patches on managed nodes (AWS CLI) To install patches on specific managed nodes Run the following command. Note The target managed nodes reboot as needed to complete patch installation. For more information, see SSM Command document for patching: AWS-RunPatchBaseline. Linux & macOS aws ssm send-command \ --document-name 'AWS-RunPatchBaseline' \ --targets Key=InstanceIds,Values='i-02573cafcfEXAMPLE,i-0471e04240EXAMPLE' \ --parameters 'Operation=Install' \ --timeout-seconds 600 Windows Server aws ssm send-command ^ --document-name "AWS-RunPatchBaseline" ^ --targets Key=InstanceIds,Values="i-02573cafcfEXAMPLE,i-0471e04240EXAMPLE" ^ --parameters "Operation=Install" ^ --timeout-seconds 600 Patch Manager 722 AWS Systems Manager User Guide The system returns information like the following. { "Command": { "CommandId": "5f403234-38c4-439f-a570-93623EXAMPLE", "DocumentName": "AWS-RunPatchBaseline", "DocumentVersion": "$DEFAULT", "Comment": "", "ExpiresAfter": 1621975301.791, "Parameters": { "Operation": [ "Install" ] }, "InstanceIds": [], "Targets": [ { "Key": "InstanceIds", "Values": [ "i-02573cafcfEXAMPLE, i-0471e04240EXAMPLE" ] } ], "RequestedDateTime": 1621953101.791, "Status": "Pending", "StatusDetails": "Pending", "TimeoutSeconds": 600, ---output truncated--- } } To install patches on managed nodes in a specific patch group Run the following command. Linux & macOS aws ssm send-command \ --document-name 'AWS-RunPatchBaseline' \ --targets Key='tag:PatchGroup',Values='Web servers' \ Patch Manager 723 AWS Systems Manager User Guide -parameters 'Operation=Install' \ --timeout-seconds 600 Windows Server aws ssm send-command ^ --document-name "AWS-RunPatchBaseline" ^ --targets Key="tag:PatchGroup",Values="Web servers" ^ --parameters "Operation=Install" ^ --timeout-seconds 600 The system returns information like the following. { "Command": { "CommandId": "fa44b086-7d36-4ad5-ac8d-627ecEXAMPLE", "DocumentName": "AWS-RunPatchBaseline", "DocumentVersion": "$DEFAULT", "Comment": "", "ExpiresAfter": 1621975407.865, "Parameters": { "Operation": [ "Install" ] }, "InstanceIds": [], "Targets": [ { "Key": "tag:PatchGroup", "Values": [ "Web servers" ] } ], "RequestedDateTime": 1621953207.865, "Status": "Pending", "StatusDetails":
|
systems-manager-ug-230
|
systems-manager-ug.pdf
| 230 |
in a specific patch group Run the following command. Linux & macOS aws ssm send-command \ --document-name 'AWS-RunPatchBaseline' \ --targets Key='tag:PatchGroup',Values='Web servers' \ Patch Manager 723 AWS Systems Manager User Guide -parameters 'Operation=Install' \ --timeout-seconds 600 Windows Server aws ssm send-command ^ --document-name "AWS-RunPatchBaseline" ^ --targets Key="tag:PatchGroup",Values="Web servers" ^ --parameters "Operation=Install" ^ --timeout-seconds 600 The system returns information like the following. { "Command": { "CommandId": "fa44b086-7d36-4ad5-ac8d-627ecEXAMPLE", "DocumentName": "AWS-RunPatchBaseline", "DocumentVersion": "$DEFAULT", "Comment": "", "ExpiresAfter": 1621975407.865, "Parameters": { "Operation": [ "Install" ] }, "InstanceIds": [], "Targets": [ { "Key": "tag:PatchGroup", "Values": [ "Web servers" ] } ], "RequestedDateTime": 1621953207.865, "Status": "Pending", "StatusDetails": "Pending", "TimeoutSeconds": 600, ---output truncated--- } Patch Manager 724 AWS Systems Manager } User Guide AWS Systems Manager Patch Manager tutorials The tutorials in this section demonstrate how to use Patch Manager, a tool in AWS Systems Manager, for several patching scenarios. Topics • Tutorial: Create a patch baseline for installing Windows Service Packs using the console • Tutorial: Update application dependencies, patch a managed node, and perform an application- specific health check using the console • Tutorial: Patch a server environment using the AWS CLI Tutorial: Create a patch baseline for installing Windows Service Packs using the console When you create a custom patch baseline, you can specify that all, some, or only one type of supported patch is installed. In patch baselines for Windows, you can select ServicePacks as the only Classification option in order to limit patching updates to Service Packs only. Service Packs can be installed automatically by Patch Manager, a tool in AWS Systems Manager, provided that the update is available in Windows Update or Windows Server Update Services (WSUS). You can configure a patch baseline to control whether Service Packs for all Windows versions are installed, or just those for specific versions, such as Windows 7 or Windows Server 2016. Use the following procedure to create a custom patch baseline to be used exclusively for installing all Service Packs on your Windows managed nodes. To create a patch baseline for installing Windows Service Packs (console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Patch Manager. 3. Choose the Patch baselines tab, and then choose Create patch baseline. 4. For Name, enter a name for your new patch baseline, for example, MyWindowsServicePackPatchBaseline. Patch Manager 725 AWS Systems Manager User Guide 5. 6. 7. (Optional) For Description, enter a description for this patch baseline. For Operating system, choose Windows. If you want to begin using this patch baseline as the default for Windows as soon as you create it, select Set this patch baseline as the default patch baseline for Windows Server instances . Note This option is available only if you first accessed Patch Manager before the patch policies release on December 22, 2022. For information about setting an existing patch baseline as the default, see Setting an existing patch baseline as the default. 8. In the Approval rules for operating systems section, use the fields to create one or more auto-approval rules. • Products: The operating system versions that the approval rule applies to, such as WindowsServer2012. You can choose one, more than one, or all supported versions of Windows. The default selection is All. • Classification: Choose ServicePacks. • Severity: The severity value of patches the rule is to apply to. To ensure that all Service Packs are included by the rule, choose All. • Auto-approval: The method for selecting patches for automatic approval. • Approve patches after a specified number of days: The number of days for Patch Manager to wait after a patch is released or updated before a patch is automatically approved. You can enter any integer from zero (0) to 360. For most scenarios, we recommend waiting no more than 100 days. • Approve patches released up to a specific date: The patch release date for which Patch Manager automatically applies all patches released or updated on or before that date. For example, if you specify July 7, 2023, no patches released or last updated on or after July 8, 2023, are installed automatically. • (Optional) Compliance reporting: The severity level you want to assign to Service Packs approved by the baseline, such as High. Patch Manager 726 AWS Systems Manager Note User Guide If you specify a compliance reporting level and the patch state of any approved Service Pack is reported as Missing, then the patch baseline's overall reported compliance severity is the severity level you specified. 9. (Optional) For Manage tags, apply one or more tag key name/value pairs to the patch baseline. Tags are optional metadata that you assign to a resource. Tags allow you to categorize a resource in different ways, such as by purpose, owner, or environment. For this patch baseline dedicated to updating Service Packs,
|
systems-manager-ug-231
|
systems-manager-ug.pdf
| 231 |
baseline, such as High. Patch Manager 726 AWS Systems Manager Note User Guide If you specify a compliance reporting level and the patch state of any approved Service Pack is reported as Missing, then the patch baseline's overall reported compliance severity is the severity level you specified. 9. (Optional) For Manage tags, apply one or more tag key name/value pairs to the patch baseline. Tags are optional metadata that you assign to a resource. Tags allow you to categorize a resource in different ways, such as by purpose, owner, or environment. For this patch baseline dedicated to updating Service Packs, you could specify key-value pairs such as the following: • Key=OS,Value=Windows • Key=Classification,Value=ServicePacks 10. Choose Create patch baseline. Tutorial: Update application dependencies, patch a managed node, and perform an application-specific health check using the console In many cases, a managed node must be rebooted after it has been patched with the latest software update. However, rebooting a node in production without safeguards in place can cause several problems, such as invoking alarms, recording incorrect metric data, and interrupting data synchronizations. This tutorial demonstrates how to avoid problems like these by using the AWS Systems Manager document (SSM document) AWS-RunPatchBaselineWithHooks to achieve a complex, multi-step patching operation that accomplishes the following: 1. Prevent new connections to the application 2. Install operating system updates 3. Update the package dependencies of the application 4. Restart the system 5. Perform an application-specific health check For this example, we have set up our infrastructure this way: Patch Manager 727 AWS Systems Manager User Guide • The virtual machines targeted are registered as managed nodes with Systems Manager. • Iptables is used as a local firewall. • The application hosted on the managed nodes is running on port 443. • The application hosted on the managed nodes is a nodeJS application. • The application hosted on the managed nodes is managed by the pm2 process manager. • The application already has a specified health check endpoint. • The application’s health check endpoint requires no end user authentication. The endpoint allows for a health check that meets the organization’s requirements in establishing availability. (In your environments, it might be enough to simply ascertain that the nodeJS application is running and able to listen for requests. In other cases, you might want to also verify that a connection to the caching layer or database layer has already been established.) The examples in this tutorial are for demonstration purposes only and not meant to be implemented as-is into production environments. Also, keep in mind that the lifecycle hooks feature of Patch Manager, a tool in Systems Manager, with the AWS- RunPatchBaselineWithHooks document can support numerous other scenarios. Here are several examples. • Stop a metrics reporting agent before patching and restarting it after the managed node reboots. • Detach the managed node from a CRM or PCS cluster before patching and reattach after the node reboots. • Update third-party software (for example, Java, Tomcat, Adobe applications, and so on) on Windows Server machines after operating system (OS) updates are applied, but before the managed node reboots. To update application dependencies, patch a managed node, and perform an application- specific health check 1. Create an SSM document for your preinstallation script with the following contents and name it NodeJSAppPrePatch. Replace your_application with the name of your application. This script immediately blocks new incoming requests and provides five seconds for already active ones to complete before beginning the patching operation. For the sleep option, specify a number of seconds greater than it usually takes for incoming requests to complete. Patch Manager 728 AWS Systems Manager User Guide # exit on error set -e # set up rule to block incoming traffic iptables -I INPUT -j DROP -p tcp --syn --destination-port 443 || exit 1 # wait for current connections to end. Set timeout appropriate to your application's latency sleep 5 # Stop your application pm2 stop your_application For information about creating SSM documents, see Creating SSM document content. 2. Create another SSM document with the following content for your postinstall script to update your application dependencies and name it NodeJSAppPostPatch. Replace /your/ application/path with the path to your application. cd /your/application/path npm update # you can use npm-check-updates if you want to upgrade major versions 3. Create another SSM document with the following content for your onExit script to bring your application back up and perform a health check. Name this SSM document NodeJSAppOnExitPatch. Replace your_application with the name of your application. # exit on error set -e # restart nodeJs application pm2 start your_application # sleep while your application starts and to allow for a crash sleep 10 # check with pm2 to see if your application is running pm2 pid your_application # re-enable incoming connections iptables -D INPUT -j
|
systems-manager-ug-232
|
systems-manager-ug.pdf
| 232 |
npm update # you can use npm-check-updates if you want to upgrade major versions 3. Create another SSM document with the following content for your onExit script to bring your application back up and perform a health check. Name this SSM document NodeJSAppOnExitPatch. Replace your_application with the name of your application. # exit on error set -e # restart nodeJs application pm2 start your_application # sleep while your application starts and to allow for a crash sleep 10 # check with pm2 to see if your application is running pm2 pid your_application # re-enable incoming connections iptables -D INPUT -j DROP -p tcp --syn --destination-port # perform health check /usr/bin/curl -m 10 -vk -A "" http://localhost:443/health-check || exit 1 4. Create an association in State Manager, a tool in AWS Systems Manager, to issue the operation by performing the following steps: Patch Manager 729 AWS Systems Manager User Guide 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose State Manager, and then choose Create association. 3. For Name, provide a name to help identify the purpose of the association. 4. In the Document list, choose AWS-RunPatchBaselineWithHooks. 5. For Operation, choose Install. 6. (Optional) For Snapshot Id, provide a GUID that you generate to help speed up the operation and ensure consistency. The GUID value can be as simple as 00000000-0000-0000-0000-111122223333. 7. For Pre Install Hook Doc Name, enter NodeJSAppPrePatch. 8. For Post Install Hook Doc Name, enter NodeJSAppPostPatch. 9. For On ExitHook Doc Name,enter NodeJSAppOnExitPatch. 5. 6. 7. For Targets, identify your managed nodes by specifying tags, choosing nodes manually, choosing a resource group, or choosing all managed nodes. For Specify schedule, specify how often to run the association. For managed node patching, once per week is a common cadence. In the Rate control section, choose options to control how the association runs on multiple managed nodes. Ensure that only a portion of managed nodes are updated at a time. Otherwise, all or most of your fleet could be taken offline at once. For more information about using rate controls, see Understanding targets and rate controls in State Manager associations. 8. (Optional) For Output options, to save the command output to a file, select the Enable writing output to S3 box. Enter the bucket and prefix (folder) names in the boxes. Note The S3 permissions that grant the ability to write the data to an S3 bucket are those of the instance profile assigned to the managed node, not those of the IAM user performing this task. For more information, see Configure instance permissions required for Systems Manager or Create an IAM service role for a hybrid environment. In addition, if the specified S3 bucket is in a different AWS account, verify that the instance profile or IAM service role associated with the managed node has the necessary permissions to write to that bucket. 9. Choose Create Association. Patch Manager 730 AWS Systems Manager User Guide Tutorial: Patch a server environment using the AWS CLI The following procedure describes how to patch a server environment by using a custom patch baseline, patch groups, and a maintenance window. Before you begin • Install or update the SSM Agent on your managed nodes. To patch Linux managed nodes, your nodes must be running SSM Agent version 2.0.834.0 or later. For more information, see Updating the SSM Agent using Run Command. • Configure roles and permissions for Maintenance Windows, a tool in AWS Systems Manager. For more information, see Setting up Maintenance Windows. • Install and configure the AWS Command Line Interface (AWS CLI), if you haven't already. For information, see Installing or updating the latest version of the AWS CLI. To configure Patch Manager and patch managed nodes (command line) 1. Run the following command to create a patch baseline for Windows named Production- Baseline. This patch baseline approves patches for a production environment 7 days after they're released or last updated. That is, we have tagged the patch baseline to indicate that it's for a production environment. Note The OperatingSystem parameter and PatchFilters vary depending on the operating system of the target managed nodes the patch baseline applies to. For more information, see OperatingSystem and PatchFilter. 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]}, Patch Manager 731 AWS Systems Manager User Guide {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" The system returns information like the following. { "BaselineId":"pb-0c10e65780EXAMPLE" } 2. Run the following commands to register the "Production-Baseline" patch baseline for two patch groups. The groups are named "Database Servers" and "Front-End
|
systems-manager-ug-233
|
systems-manager-ug.pdf
| 233 |
and PatchFilter. 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]}, Patch Manager 731 AWS Systems Manager User Guide {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" The system returns information like the following. { "BaselineId":"pb-0c10e65780EXAMPLE" } 2. Run the following commands to register the "Production-Baseline" patch baseline for two patch groups. The groups are named "Database Servers" and "Front-End Servers". 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" Patch Manager 732 AWS Systems Manager User Guide The system returns information like the following. { "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" The system returns information like the following. { "PatchGroup":"Front-End Servers", "BaselineId":"pb-0c10e65780EXAMPLE" } 3. Run the following commands to create two maintenance windows for the production servers. The first window runs every Tuesday at 10 PM. The second window runs every Saturday at 10 PM. In addition, the maintenance window is tagged to indicate that it's for a production environment. Linux & macOS aws ssm create-maintenance-window \ --name "Production-Tuesdays" \ --tags "Key=Environment,Value=Production" \ --schedule "cron(0 0 22 ? * TUE *)" \ --duration 1 \ Patch Manager 733 AWS Systems Manager User Guide --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 The system returns information like the following. { "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 Patch Manager 734 AWS Systems Manager User Guide The system returns information like the following. { "WindowId":"mw-9a8b7c6d5eEXAMPLE" } 4. Run the following commands to register the Database and Front-End servers patch groups with their respective maintenance windows. 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" The system returns information like the following. { "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" Patch Manager 735 AWS Systems Manager Windows Server User Guide 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" The system returns information like the following. { "WindowTargetId":"faa01c41-1d57-496c-ba77-ff9caEXAMPLE" } 5. Run the following commands to register a patch task that installs missing updates on the Database and Front-End servers during their respective maintenance windows. 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" ^ Patch Manager 736 AWS Systems Manager User Guide --max-concurrency 2 ^ --max-errors 1 ^ --priority 1 ^ --task-invocation-parameters "RunCommand={Parameters={Operation=Install}}" The system returns information like the following. { "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}}" The system returns information like the following. Patch Manager 737 AWS Systems Manager User Guide { "WindowTaskId":"8a5c4629-31b0-4edd-8aea-33698EXAMPLE" } 6. Run the following command to get the high-level patch compliance summary for a patch group. The high-level patch compliance summary includes the number of managed nodes with patches in the respective patch states. Note It's expected to see zeroes for the number of managed nodes in the summary until the patch task runs during the first maintenance window. Linux & macOS aws ssm describe-patch-group-state \ --patch-group "Database Servers" Windows Server aws ssm describe-patch-group-state ^ --patch-group "Database Servers" The system returns information like the following. { "Instances": number, "InstancesWithFailedPatches": number, "InstancesWithInstalledOtherPatches": number, "InstancesWithInstalledPatches": number, "InstancesWithInstalledPendingRebootPatches": number, "InstancesWithInstalledRejectedPatches": number, "InstancesWithMissingPatches": number, "InstancesWithNotApplicablePatches": number, "InstancesWithUnreportedNotApplicablePatches": number
|
systems-manager-ug-234
|
systems-manager-ug.pdf
| 234 |
command to get the high-level patch compliance summary for a patch group. The high-level patch compliance summary includes the number of managed nodes with patches in the respective patch states. Note It's expected to see zeroes for the number of managed nodes in the summary until the patch task runs during the first maintenance window. Linux & macOS aws ssm describe-patch-group-state \ --patch-group "Database Servers" Windows Server aws ssm describe-patch-group-state ^ --patch-group "Database Servers" The system returns information like the following. { "Instances": number, "InstancesWithFailedPatches": number, "InstancesWithInstalledOtherPatches": number, "InstancesWithInstalledPatches": number, "InstancesWithInstalledPendingRebootPatches": number, "InstancesWithInstalledRejectedPatches": number, "InstancesWithMissingPatches": number, "InstancesWithNotApplicablePatches": number, "InstancesWithUnreportedNotApplicablePatches": number } Patch Manager 738 AWS Systems Manager User Guide 7. Run the following command to get patch summary states per-managed node for a patch group. The per-managed node summary includes a number of patches in the respective patch states per managed node for a patch group. 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" The system returns information like the following. { "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 } ] Patch Manager 739 AWS Systems Manager } User Guide For examples of other AWS CLI commands you can use for your Patch Manager configuration tasks, see Working with Patch Manager resources using the AWS CLI. Troubleshooting Patch Manager Use the following information to help you troubleshoot problems with Patch Manager, a tool in AWS Systems Manager. Topics • Issue: "Invoke-PatchBaselineOperation : Access Denied" error or "Unable to download file from S3" error for baseline_overrides.json • Issue: Patching fails without an apparent cause or error message • Issue: Unexpected patch compliance results • Errors when running AWS-RunPatchBaseline on Linux • Errors when running AWS-RunPatchBaseline on Windows Server • Using AWS Support Automation runbooks • Contacting AWS Support Issue: "Invoke-PatchBaselineOperation : Access Denied" error or "Unable to download file from S3" error for baseline_overrides.json Problem: When the patching operations specified by your patch policy run, you receive an error similar to the following example. Example error on Windows Server ----------ERROR------- Invoke-PatchBaselineOperation : Access Denied At C:\ProgramData\Amazon\SSM\InstanceData\i-02573cafcfEXAMPLE\document\orchestr ation\792dd5bd-2ad3-4f1e-931d-abEXAMPLE\PatchWindows\_script.ps1:219 char:13 + $response = Invoke-PatchBaselineOperation -Operation Install -Snapsho ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (Amazon.Patch.Ba...UpdateOpera tion:InstallWindowsUpdateOperation) [Invoke-PatchBaselineOperation], Amazo nS3Exception Patch Manager 740 AWS Systems Manager User Guide + FullyQualifiedErrorId : PatchBaselineOperations,Amazon.Patch.Baseline.Op erations.PowerShellCmdlets.InvokePatchBaselineOperation failed to run commands: exit status 0xffffffff Example error on Linux [INFO]: Downloading Baseline Override from s3://aws-quicksetup- patchpolicy-123456789012-abcde/baseline_overrides.json [ERROR]: Unable to download file from S3: s3://aws-quicksetup- patchpolicy-123456789012-abcde/baseline_overrides.json. [ERROR]: Error loading entrance module. Cause: You created a patch policy in Quick Setup, and some of your managed nodes already had an instance profile attached (for EC2 instances) or a service role attached (for non-EC2 machines). However, as shown in the following image, you didn't select the Add required IAM policies to existing instance profiles attached to your instances check box. When you create a patch policy, an Amazon S3 bucket is also created to store the policy's configuration baseline_overrides.json file. If you don't select the Add required IAM policies to existing instance profiles attached to your instances check box when creating the policy, the IAM policies and resource tags that are needed to access baseline_overrides.json in the S3 bucket are not automatically added to your existing IAM instance profiles and service roles. Solution 1: Delete the existing patch policy configuration, then create a replacement, making sure to select the Add required IAM policies to existing instance profiles attached to your instances check box. This selection applies the IAM policies created by this Quick Setup configuration to nodes that already have an instance profile or service role attached. (By default, Quick Setup adds the required policies to instances and nodes that do not already have instance profiles or service Patch Manager 741 AWS Systems Manager User Guide roles.) For more information, see Automate organization-wide patching using a Quick Setup patch policy. Solution 2: Manually add the required permissions and tags to each IAM instance profile and IAM service role that you use with Quick Setup. For instructions, see Permissions for the patch policy S3 bucket. Issue: Patching fails without an apparent cause or error message Problem: A patching operation fails without returning an error message. Possible cause: If more than one invocation of AWS-RunPatchBaseline occurs at a time, they can conflict with one another, causing patching tasks to fail. This might not be indicated in patching logs. To check whether concurrent patching operations might have interrupted each other, review the command history in Run Command, a tool in AWS Systems Manager. For a managed node with a patching failure, check to see if multiple operations attempted to patch
|
systems-manager-ug-235
|
systems-manager-ug.pdf
| 235 |
Permissions for the patch policy S3 bucket. Issue: Patching fails without an apparent cause or error message Problem: A patching operation fails without returning an error message. Possible cause: If more than one invocation of AWS-RunPatchBaseline occurs at a time, they can conflict with one another, causing patching tasks to fail. This might not be indicated in patching logs. To check whether concurrent patching operations might have interrupted each other, review the command history in Run Command, a tool in AWS Systems Manager. For a managed node with a patching failure, check to see if multiple operations attempted to patch the machine within 2 minutes of one another. This scenario can sometimes cause a failure. You can also use the AWS Command Line Interface (AWS CLI) to check for concurrent patching attempts by using the following command. Replace the value for node-id with the ID for your managed node. aws ssm list-commands \ --filter "key=DocumentName,value=AWS-RunPatchBaseline" \ --query 'Commands[*]. {CommandId:CommandId,RequestedDateTime:RequestedDateTime,Status:Status}' \ --instance-id node-id \ --output table Solution: If you determine that patching failed because of competing patching operations on the same managed node, adjust your patching configurations to avoid this occurring again. For example, if two maintenance windows specify overlapping patching times, remove or revise one of them. If a maintenance windows specifies one patching operation, but a patch policy specifies a different one for the same time, consider removing the task from the maintenance window. If you determine that conflicting patching operations weren't the cause of the failure in this scenario, we recommend contacting AWS Support. Patch Manager 742 AWS Systems Manager User Guide Issue: Unexpected patch compliance results Problem: When reviewing the patching compliance details generated after a Scan operation, the results include information that don't reflect the rules set up in your patch baseline. For example, an exception you added to the Rejected patches list in a patch baseline is listed as Missing. Or patches classified as Important are listed as missing even though your patch baseline specifies Critical patches only. Cause: Patch Manager currently supports multiple methods of running Scan operations: • A patch policy configured in Quick Setup • A Host Management option configured in Quick Setup • A maintenance window to run a patch Scan or Install task • An on-demand Patch now operation When a Scan operation runs, it overwrites the compliance details from the most recent scan. If you have more than one method set up to run a Scan operation, and they use different patch baselines with different rules, they will result in differing patch compliance results. Solution: To avoid unexpected patch compliance results, we recommend using only one method at a time for running the Patch Manager Scan operation. For more information, see Avoiding unintentional patch compliance data overwrites. Errors when running AWS-RunPatchBaseline on Linux Topics • Issue: 'No such file or directory' error • Issue: 'another process has acquired yum lock' error • Issue: 'Permission denied / failed to run commands' error • Issue: 'Unable to download payload' error • Issue: 'unsupported package manager and python version combination' error • Issue: Patch Manager isn't applying rules specified to exclude certain packages • Issue: Patching fails and Patch Manager reports that the Server Name Indication extension to TLS is not available • Issue: Patch Manager reports 'No more mirrors to try' Patch Manager 743 AWS Systems Manager User Guide • Issue: Patching fails with 'Error code returned from curl is 23' • Issue: Patching fails with ‘Error unpacking rpm package…’ message • Issue: Patching fails with 'Encounter service side error when uploading the inventory' • Issue: Patching fails with ‘Errors were encountered while downloading packages’ message • Issue: Patching fails with a message that 'The following signatures couldn't be verified because the public key is not available' • Issue: Patching fails with a 'NoMoreMirrorsRepoError' message • Issue: Patching fails with an 'Unable to download payload' message • Issue: Patching fails with a message 'install errors: dpkg: error: dpkg frontend is locked by another process' • Issue: Patching on Ubuntu Server fails with a 'dpkg was interrupted' error • Issue: The package manager utility can't resolve a package dependency Issue: 'No such file or directory' error Problem: When you run AWS-RunPatchBaseline, patching fails with one of the following errors. IOError: [Errno 2] No such file or directory: 'patch-baseline-operations-X.XX.tar.gz' Unable to extract tar file: /var/log/amazon/ssm/patch-baseline-operations/patch- baseline-operations-1.75.tar.gz.failed to run commands: exit status 155 Unable to load and extract the content of payload, abort.failed to run commands: exit status 152 Cause 1: Two commands to run AWS-RunPatchBaseline were running at the same time on the same managed node. This creates a race condition that results in the temporary file patch- baseline-operations* not being created or accessed properly. Cause 2: Insufficient storage space remains under the /var directory. Solution 1: Ensure that no maintenance window has
|
systems-manager-ug-236
|
systems-manager-ug.pdf
| 236 |
fails with one of the following errors. IOError: [Errno 2] No such file or directory: 'patch-baseline-operations-X.XX.tar.gz' Unable to extract tar file: /var/log/amazon/ssm/patch-baseline-operations/patch- baseline-operations-1.75.tar.gz.failed to run commands: exit status 155 Unable to load and extract the content of payload, abort.failed to run commands: exit status 152 Cause 1: Two commands to run AWS-RunPatchBaseline were running at the same time on the same managed node. This creates a race condition that results in the temporary file patch- baseline-operations* not being created or accessed properly. Cause 2: Insufficient storage space remains under the /var directory. Solution 1: Ensure that no maintenance window has two or more Run Command tasks that run AWS-RunPatchBaseline with the same Priority level and that run on the same target IDs. If this is the case, reorder the priority. Run Command is a tool in AWS Systems Manager. Patch Manager 744 AWS Systems Manager User Guide Solution 2: Ensure that only one maintenance window at a time is running Run Command tasks that use AWS-RunPatchBaseline on the same targets and on the same schedule. If this is the case, change the schedule. Solution 3: Ensure that only one State Manager association is running AWS-RunPatchBaseline on the same schedule and targeting the same managed nodes. State Manager is a tool in AWS Systems Manager. Solution 4: Free up sufficient storage space under the /var directory for the update packages. Issue: 'another process has acquired yum lock' error Problem: When you run AWS-RunPatchBaseline, patching fails with the following error. 12/20/2019 21:41:48 root [INFO]: another process has acquired yum lock, waiting 2 s and retry. Cause: The AWS-RunPatchBaseline document has started running on a managed node where it's already running in another operation and has acquired the package manager yum process. Solution: Ensure that no State Manager association, maintenance window tasks, or other configurations that run AWS-RunPatchBaseline on a schedule are targeting the same managed node around the same time. Issue: 'Permission denied / failed to run commands' error Problem: When you run AWS-RunPatchBaseline, patching fails with the following error. sh: /var/lib/amazon/ssm/instanceid/document/orchestration/commandid/PatchLinux/_script.sh: Permission denied failed to run commands: exit status 126 Cause: /var/lib/amazon/ might be mounted with noexec permissions. This is an issue because SSM Agent downloads payload scripts to /var/lib/amazon/ssm and runs them from that location. Solution: Ensure that you have configured exclusive partitions to /var/log/amazon and /var/ lib/amazon, and that they're mounted with exec permissions. Patch Manager 745 AWS Systems Manager User Guide Issue: 'Unable to download payload' error Problem: When you run AWS-RunPatchBaseline, patching fails with the following error. Unable to download payload: https://s3.amzn-s3-demo-bucket.region.amazonaws.com/ aws-ssm-region/patchbaselineoperations/linux/payloads/patch-baseline-operations- X.XX.tar.gz.failed to run commands: exit status 156 Cause: The managed node doesn't have the required permissions to access the specified Amazon Simple Storage Service (Amazon S3) bucket. Solution: Update your network configuration so that S3 endpoints are reachable. For more details, see information about required access to S3 buckets for Patch Manager in SSM Agent communications with AWS managed S3 buckets. Issue: 'unsupported package manager and python version combination' error Problem: When you run AWS-RunPatchBaseline, patching fails with the following error. An unsupported package manager and python version combination was found. Apt requires Python3 to be installed. failed to run commands: exit status 1 Cause: A supported version of python3 isn't installed on the Debian Server, Raspberry Pi OS, or Ubuntu Server instance. Solution: Install a supported version of python3 (3.0 - 3.10) on the server, which is required for Debian Server, Raspberry Pi OS, and Ubuntu Server managed nodes. Issue: Patch Manager isn't applying rules specified to exclude certain packages Problem: You have attempted to exclude certain packages by specifying them in the /etc/ yum.conf file, in the format exclude=package-name, but they aren't excluded during the Patch Manager Install operation. Cause: Patch Manager doesn't incorporate exclusions specified in the /etc/yum.conf file. Solution: To exclude specific packages, create a custom patch baseline and create a rule to exclude the packages you don't want installed. Patch Manager 746 AWS Systems Manager User Guide Issue: Patching fails and Patch Manager reports that the Server Name Indication extension to TLS is not available Problem: The patching operation issues the following message. /var/log/amazon/ssm/patch-baseline-operations/urllib3/util/ssl_.py:369: SNIMissingWarning: An HTTPS request has been made, but the SNI (Server Name Indication) extension to TLS is not available on this platform. This might cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced- usage.html#ssl-warnings Cause: This message doesn't indicate an error. Instead, it's a warning that the older version of Python distributed with the operating system doesn't support TLS Server Name Indication. The Systems Manager patch payload script issues this warning when connecting to AWS APIs that support SNI. Solution: To troubleshoot any patching failures when this message is reported, review the contents
|
systems-manager-ug-237
|
systems-manager-ug.pdf
| 237 |
TLS is not available on this platform. This might cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced- usage.html#ssl-warnings Cause: This message doesn't indicate an error. Instead, it's a warning that the older version of Python distributed with the operating system doesn't support TLS Server Name Indication. The Systems Manager patch payload script issues this warning when connecting to AWS APIs that support SNI. Solution: To troubleshoot any patching failures when this message is reported, review the contents of the stdout and stderr files. If you haven't configured the patch baseline to store these files in an S3 bucket or in Amazon CloudWatch Logs, you can locate the files in the following location on your Linux managed node. /var/lib/amazon/ssm/instance-id/document/orchestration/Run-Command- execution-id/awsrunShellScript/PatchLinux Issue: Patch Manager reports 'No more mirrors to try' Problem: The patching operation issues the following message. [Errno 256] No more mirrors to try. Cause: The repositories configured on the managed node are not working correctly. Possible causes for this include: • The yum cache is corrupted. • A repository URL can't be reached due to network-related issues. Patch Manager 747 AWS Systems Manager User Guide Solution: Patch Manager uses the managed node’s default package manager to perform patching operation. Double-check that repositories are configured and operating correctly. Issue: Patching fails with 'Error code returned from curl is 23' Problem: A patching operating that uses AWS-RunPatchBaseline fails with an error similar to the following: 05/01/2025 17:04:30 root [ERROR]: Error code returned from curl is 23 Cause: The curl tool in use on your systems lacks the permissions needed to write to the filesystem. This can occur when if the package manager's default curl tool was replaced by a different version, such as one installed with snap. Solution: If the curl version provided by the package manager was uninstalled when a different version was installed, reinstall it. If you need to keep multiple curl versions installed, ensure that the version associated with the package manager is in the first directory listed in the PATH variable. You can check this by running the command echo $PATH to see the current order of directories that are checked for executable files on your system. Issue: Patching fails with ‘Error unpacking rpm package…’ message Problem: A patching operation fails with an error similar to the following: Error : Error unpacking rpm package python-urllib3-1.25.9-1.amzn2.0.2.noarch python-urllib3-1.25.9-1.amzn2.0.1.noarch was supposed to be removed but is not! failed to run commands: exit status 1 Cause 1: When a particular package is present in multiple package installers, such as both pip and yum or dnf, conflicts can occur when using the default package manager. A common example occurs with the urllib3 package, which is found in pip, yum, and dnf. Cause 2: The python-urllib3 package is corrupted. This can happen if the package files were installed or updated by pip after the rpm was package was previously installed by yum or dnf. Solution: Remove the python-urllib3 package from pip by running the command sudo pip uninstall urllib3, keeping the package only in the default package manager (yum or dnf). Patch Manager 748 AWS Systems Manager User Guide Issue: Patching fails with 'Encounter service side error when uploading the inventory' Problem: When running the AWS-RunPatchBaseline document, you receive the following error message: Encounter service side error when uploading the inventory Cause: Two commands to run AWS-RunPatchBaseline were running at the same time on the same managed node. This creates a race condition when initializing boto3 client during patching operations. Solution: Ensure that no State Manager association, maintenance window tasks, or other configurations that run AWS-RunPatchBaseline on a schedule are targeting the same managed node around the same time. Issue: Patching fails with ‘Errors were encountered while downloading packages’ message Problem: During patching, you receive an error similar to the following: YumDownloadError: [u'Errors were encountered while downloading packages.', u'libxml2-2.9.1-6.el7_9.6.x86_64: [Errno 5] [Errno 12] Cannot allocate memory', u'libxslt-1.1.28-6.el7.x86_64: [Errno 5] [Errno 12] Cannot allocate memory', u'libcroco-0.6.12-6.el7_9.x86_64: [Errno 5] [Errno 12] Cannot allocate memory', u'openldap-2.4.44-25.el7_9.x86_64: [Errno 5] [Errno 12] Cannot allocate memory', Cause: This error can occur when insufficient memory is available on a managed node. Solution: Configure the swap memory, or upgrade the instance to a different type to increase the memory support. Then start a new patching operation. Issue: Patching fails with a message that 'The following signatures couldn't be verified because the public key is not available' Problem: Patching fails on Ubuntu Server with an error similar to the following: 02/17/2022 21:08:43 root [ERROR]: W:GPG error: http://repo.mysql.com/apt/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 467B942D3A79BD29, E:The repository ' http://repo.mysql.com/apt/ubuntu bionic Cause: The GNU Privacy Guard (GPG) key has expired or is
|
systems-manager-ug-238
|
systems-manager-ug.pdf
| 238 |
a managed node. Solution: Configure the swap memory, or upgrade the instance to a different type to increase the memory support. Then start a new patching operation. Issue: Patching fails with a message that 'The following signatures couldn't be verified because the public key is not available' Problem: Patching fails on Ubuntu Server with an error similar to the following: 02/17/2022 21:08:43 root [ERROR]: W:GPG error: http://repo.mysql.com/apt/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 467B942D3A79BD29, E:The repository ' http://repo.mysql.com/apt/ubuntu bionic Cause: The GNU Privacy Guard (GPG) key has expired or is missing. Patch Manager 749 AWS Systems Manager User Guide Solution: Refresh the GPG key, or add the key again. For example, using the error shown previously, we see that the 467B942D3A79BD29 key is missing and must be added. To do so, run either of the following commands: sudo apt-key adv --keyserver hkps://keyserver.ubuntu.com --recv-keys 467B942D3A79BD29 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 467B942D3A79BD29 Or, to refresh all keys, run the following command: sudo apt-key adv --keyserver hkps://keyserver.ubuntu.com --refresh-keys If the error recurs after this, we recommend reporting the issue to the organization that maintains the repository. Until a fix is available, you can edit the /etc/apt/sources.list file to omit the repository during the patching process. To do so, open the sources.list file for editing, locate the line for the repository, and insert a # character at the beginning of the line to comment it out. Then save and close the file. Issue: Patching fails with a 'NoMoreMirrorsRepoError' message Problem: You receive an error similar to the following: NoMoreMirrorsRepoError: failure: repodata/repomd.xml from pgdg94: [Errno 256] No more mirrors to try. Cause: There is an error in the source repository. Solution: We recommend reporting the issue to the organization that maintains the repository. Until the error is fixed, you can disable the repository at the operating system level. To do so, run the following command, replacing the value for repo-name with your repository name: yum-config-manager --disable repo-name Following is an example. yum-config-manager --disable pgdg94 After you run this command, run another patching operation. Patch Manager 750 AWS Systems Manager User Guide Issue: Patching fails with an 'Unable to download payload' message Problem: You receive an error similar to the following: Unable to download payload: https://s3.dualstack.eu-west-1.amazonaws.com/aws-ssm-eu-west-1/patchbaselineoperations/ linux/payloads/patch-baseline-operations-1.83.tar.gz. failed to run commands: exit status 156 Cause: The managed node configuration contains errors or is incomplete. Solution: Make sure that the managed node is configured with the following: • Outbound TCP 443 rule in security group. • Egress TCP 443 rule in NACL. • Ingress TCP 1024-65535 rule in NACL. • NAT/IGW in route table to provide connectivity to an S3 endpoint. If the instance doesn't have internet access, provide it connectivity with the S3 endpoint. To do that, add an S3 gateway endpoint in the VPC and integrate it with the route table of the managed node. Issue: Patching fails with a message 'install errors: dpkg: error: dpkg frontend is locked by another process' Problem: Patching fails with an error similar to the following: install errors: dpkg: error: dpkg frontend is locked by another process failed to run commands: exit status 2 Failed to install package; install status Failed Cause: The package manager is already running another process on a managed node at the operating system level. If that other process takes a long time to complete, the Patch Manager patching operation can time out and fail. Solution: After the other process that’s using the package manager completes, run a new patching operation. Issue: Patching on Ubuntu Server fails with a 'dpkg was interrupted' error Problem: On Ubuntu Server, patching fails with an error similar to the following: Patch Manager 751 AWS Systems Manager User Guide E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem. Cause: One or more packages is misconfigured. Solution: Perform the following steps: 1. Check to see which packages are affected, and what the issues are with each package by running the following commands, one at a time: sudo apt-get check sudo dpkg -C dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\n' | grep -E ^.[^nci] 2. Correct the packages with issues by running the following command: sudo dpkg --configure -a 3. If the previous command didn't fully resolve the issue, run the following command: sudo apt --fix-broken install Issue: The package manager utility can't resolve a package dependency Problem: The native package manager on the managed node is unable to resolve a package dependency and patching fails. The following error message example indicates this type of failure on an operating system that uses yum as the package manager. 09/22/2020 08:56:09 root [ERROR]: yum update failed with result code: 1, message: [u'rpm-python-4.11.3-25.amzn2.0.3.x86_64 requires rpm = 4.11.3-25.amzn2.0.3', u'awscli-1.18.107-1.amzn2.0.1.noarch requires python2-botocore = 1.17.31'] Cause: On Linux operating systems, Patch Manager uses the
|
systems-manager-ug-239
|
systems-manager-ug.pdf
| 239 |
-a 3. If the previous command didn't fully resolve the issue, run the following command: sudo apt --fix-broken install Issue: The package manager utility can't resolve a package dependency Problem: The native package manager on the managed node is unable to resolve a package dependency and patching fails. The following error message example indicates this type of failure on an operating system that uses yum as the package manager. 09/22/2020 08:56:09 root [ERROR]: yum update failed with result code: 1, message: [u'rpm-python-4.11.3-25.amzn2.0.3.x86_64 requires rpm = 4.11.3-25.amzn2.0.3', u'awscli-1.18.107-1.amzn2.0.1.noarch requires python2-botocore = 1.17.31'] Cause: On Linux operating systems, Patch Manager uses the native package manager on the machine to run patching operations. such as yum, dnf, apt, and zypper. The applications automatically detect, install, update, or remove dependent packages as required. However, some Patch Manager 752 AWS Systems Manager User Guide conditions can result in the package manager being unable to complete a dependency operation, such as: • Multiple conflicting repositories are configured on the operating system. • A remote repository URL is inaccessible due to network-related issues. • A package for the wrong architecture is found in the repository. Solution: Patching might fail because of a dependency issue for a wide variety of reasons. Therefore, we recommend that you contact AWS Support to assist with troubleshooting. Errors when running AWS-RunPatchBaseline on Windows Server Topics • Issue: mismatched product family/product pairs • Issue: AWS-RunPatchBaseline output returns an HRESULT (Windows Server) • Issue: managed node doesn't have access to Windows Update Catalog or WSUS • Issue: PatchBaselineOperations PowerShell module is not downloadable • Issue: missing patches Issue: mismatched product family/product pairs Problem: When you create a patch baseline in the Systems Manager console, you specify a product family and a product. For example, you might choose: • Product family: Office Product: Office 2016 Cause: If you attempt to create a patch baseline with a mismatched product family/product pair, an error message is displayed. The following are reasons this can occur: • You selected a valid product family and product pair but then removed the product family selection. • You chose a product from the Obsolete or mismatched options sublist instead of the Available and matching options sublist. Patch Manager 753 AWS Systems Manager User Guide Items in the product Obsolete or mismatched options sublist might have been entered in error through an SDK or AWS Command Line Interface (AWS CLI) create-patch-baseline command. This could mean a typo was introduced or a product was assigned to the wrong product family. A product is also included in the Obsolete or mismatched options sublist if it was specified for a previous patch baseline but has no patches available from Microsoft. Solution: To avoid this issue in the console, always choose options from the Currently available options sublists. You can also view the products that have available patches by using the describe-patch- properties command in the AWS CLI or the DescribePatchProperties API command. Issue: AWS-RunPatchBaseline output returns an HRESULT (Windows Server) Problem: You received an error like the following. ----------ERROR------- Invoke-PatchBaselineOperation : Exception Details: An error occurred when attempting to search Windows Update. Exception Level 1: Error Message: Exception from HRESULT: 0x80240437 Stack Trace: at WUApiLib.IUpdateSearcher.Search(String criteria).. (Windows updates) 11/22/2020 09:17:30 UTC | Info | Searching for Windows Updates. 11/22/2020 09:18:59 UTC | Error | Searching for updates resulted in error: Exception from HRESULT: 0x80240437 ----------ERROR------- failed to run commands: exit status 4294967295 Cause: This output indicates that the native Windows Update APIs were unable to run the patching operations. Solution: Check the HResult code in the following microsoft.com topics to identify troubleshooting steps for resolving the error: • Windows Update error codes by component • Windows Update common errors and mitigation Patch Manager 754 AWS Systems Manager User Guide Issue: managed node doesn't have access to Windows Update Catalog or WSUS Problem: You received an error like the following. Downloading PatchBaselineOperations PowerShell module from https://s3.aws-api- domain/path_to_module.zip to C:\Windows\TEMP\Amazon.PatchBaselineOperations-1.29.zip. Extracting PatchBaselineOperations zip file contents to temporary folder. Verifying SHA 256 of the PatchBaselineOperations PowerShell module files. Successfully downloaded and installed the PatchBaselineOperations PowerShell module. Patch Summary for PatchGroup : BaselineId : Baseline : null SnapshotId : RebootOption : RebootIfNeeded OwnerInformation : OperationType : Scan OperationStartTime : 1970-01-01T00:00:00.0000000Z OperationEndTime : 1970-01-01T00:00:00.0000000Z InstalledCount : -1 InstalledRejectedCount : -1 InstalledPendingRebootCount : -1 InstalledOtherCount : -1 FailedCount : -1 MissingCount : -1 Patch Manager 755 AWS Systems Manager User Guide NotApplicableCount : -1 UnreportedNotApplicableCount : -1 EC2AMAZ-VL3099P - PatchBaselineOperations Assessment Results - 2020-12-30T20:59:46.169 ----------ERROR------- Invoke-PatchBaselineOperation : Exception Details: An error occurred when attempting to search Windows Update. Exception Level 1: Error Message: Exception from HRESULT: 0x80072EE2 Stack Trace: at WUApiLib.IUpdateSearcher.Search(String criteria) at Amazon.Patch.Baseline.Operations.PatchNow.Implementations.WindowsUpdateAgent.SearchForUpdates(String searchCriteria) At C:\ProgramData\Amazon\SSM\InstanceData\i-02573cafcfEXAMPLE\document\orchestration \3d2d4864-04b7-4316-84fe-eafff1ea58 e3\PatchWindows\_script.ps1:230 char:13 + $response = Invoke-PatchBaselineOperation -Operation Install -Snapsho ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (Amazon.Patch.Ba...UpdateOperation:InstallWindowsUpdateOperation) [Inv oke-PatchBaselineOperation], Exception + FullyQualifiedErrorId : Exception
|
systems-manager-ug-240
|
systems-manager-ug.pdf
| 240 |
OperationEndTime : 1970-01-01T00:00:00.0000000Z InstalledCount : -1 InstalledRejectedCount : -1 InstalledPendingRebootCount : -1 InstalledOtherCount : -1 FailedCount : -1 MissingCount : -1 Patch Manager 755 AWS Systems Manager User Guide NotApplicableCount : -1 UnreportedNotApplicableCount : -1 EC2AMAZ-VL3099P - PatchBaselineOperations Assessment Results - 2020-12-30T20:59:46.169 ----------ERROR------- Invoke-PatchBaselineOperation : Exception Details: An error occurred when attempting to search Windows Update. Exception Level 1: Error Message: Exception from HRESULT: 0x80072EE2 Stack Trace: at WUApiLib.IUpdateSearcher.Search(String criteria) at Amazon.Patch.Baseline.Operations.PatchNow.Implementations.WindowsUpdateAgent.SearchForUpdates(String searchCriteria) At C:\ProgramData\Amazon\SSM\InstanceData\i-02573cafcfEXAMPLE\document\orchestration \3d2d4864-04b7-4316-84fe-eafff1ea58 e3\PatchWindows\_script.ps1:230 char:13 + $response = Invoke-PatchBaselineOperation -Operation Install -Snapsho ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (Amazon.Patch.Ba...UpdateOperation:InstallWindowsUpdateOperation) [Inv oke-PatchBaselineOperation], Exception + FullyQualifiedErrorId : Exception Level 1: Error Message: Exception Details: An error occurred when attempting to search Windows Update. Exception Level 1: Patch Manager 756 AWS Systems Manager User Guide Error Message: Exception from HRESULT: 0x80072EE2 Stack Trace: at WUApiLib.IUpdateSearcher.Search(String criteria) at Amazon.Patch.Baseline.Operations.PatchNow.Implementations.WindowsUpdateAgent.SearchForUpdates(String searc ---Error truncated---- Cause: This error could be related to the Windows Update components, or to a lack of connectivity to the Windows Update Catalog or Windows Server Update Services (WSUS). Solution: Confirm that the managed node has connectivity to the Microsoft Update Catalog through an internet gateway, NAT gateway, or NAT instance. If you're using WSUS, confirm that the managed node has connectivity to the WSUS server in your environment. If connectivity is available to the intended destination, check the Microsoft documentation for other potential causes of HResult 0x80072EE2. This might indicate an operating system level issue. Issue: PatchBaselineOperations PowerShell module is not downloadable Problem: You received an error like the following. Preparing to download PatchBaselineOperations PowerShell module from S3. Downloading PatchBaselineOperations PowerShell module from https://s3.aws-api- domain/path_to_module.zip to C:\Windows\TEMP\Amazon.PatchBaselineOperations-1.29.zip. ----------ERROR------- C:\ProgramData\Amazon\SSM\InstanceData\i-02573cafcfEXAMPLE\document\orchestration \aaaaaaaa-bbbb-cccc-dddd-4f6ed6bd5514\ PatchWindows\_script.ps1 : An error occurred when executing PatchBaselineOperations: Unable to connect to the remote server + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,_script.ps1 failed to run commands: exit status 4294967295 Patch Manager 757 AWS Systems Manager User Guide Solution: Check the managed node connectivity and permissions to Amazon Simple Storage Service (Amazon S3). The managed node's AWS Identity and Access Management (IAM) role must use the minimum permissions cited in SSM Agent communications with AWS managed S3 buckets. The node must communicate with the Amazon S3 endpoint through the Amazon S3 gateway endpoint, NAT gateway, or internet gateway. For more information about the VPC Endpoint requirements for AWS Systems Manager SSM Agent (SSM Agent), see Improve the security of EC2 instances by using VPC endpoints for Systems Manager. Issue: missing patches Problem: AWS-RunPatchbaseline completed successfully, but there are some missing patches. The following are some common causes and their solutions. Cause 1: The baseline isn't effective. Solution 1: To check if this is the cause, use the following procedure. 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. In the navigation pane, choose Run Command. Select the Command history tab and then select the command whose baseline you want to check. Select the managed node that has missing patches. Select Step 1 - Output and find the BaselineId value. 2. 3. 4. 5. 6. Check the assigned patch baseline configuration, that is, the operating system, product name, classification, and severity for the patch baseline. 7. Go to the Microsoft Update Catalog. 8. Search the Microsoft Knowledge Base (KB) article IDs (for example, KB3216916). 9. Verify that the value under Product matches that of your managed node and select the corresponding Title. A new Update Details window will open. 10. In the Overview tab, the classification and MSRC severity must match the patch baseline configuration you found earlier. Cause 2: The patch was replaced. Solution 2: To check if this is true, use the following procedure. Patch Manager 758 AWS Systems Manager User Guide 1. Go to the Microsoft Update Catalog. 2. Search the Microsoft Knowledge Base (KB) article IDs (for example, KB3216916). 3. Verify that the value under Product matches that of your managed node and select the corresponding Title. A new Update Details window will open. 4. Go to the Package Details tab. Look for an entry under the This update has been replaced by the following updates: header. Cause 3: The same patch might have different KB numbers because the WSUS and Window online updates are handled as independent Release Channels by Microsoft. Solution 3: Check the patch eligibility. If the package isn't available under WSUS, install OS Build 14393.3115. If the package is available for all operating system builds, install OS Builds 18362.1256 and 18363.1256. Using AWS Support Automation runbooks AWS Support provides two Automation runbooks you can use to troubleshoot certain issues related to patching. • AWSSupport-TroubleshootWindowsUpdate – The AWSSupport- TroubleshootWindowsUpdate runbook is used to identify issues that could fail the Windows Server updates for Amazon Elastic Compute Cloud (Amazon EC2) Windows Server instances. • AWSSupport-TroubleshootPatchManagerLinux – The AWSSupport- TroubleshootPatchManagerLinux runbook troubleshoots common issues that can cause a patch failure
|
systems-manager-ug-241
|
systems-manager-ug.pdf
| 241 |
Microsoft. Solution 3: Check the patch eligibility. If the package isn't available under WSUS, install OS Build 14393.3115. If the package is available for all operating system builds, install OS Builds 18362.1256 and 18363.1256. Using AWS Support Automation runbooks AWS Support provides two Automation runbooks you can use to troubleshoot certain issues related to patching. • AWSSupport-TroubleshootWindowsUpdate – The AWSSupport- TroubleshootWindowsUpdate runbook is used to identify issues that could fail the Windows Server updates for Amazon Elastic Compute Cloud (Amazon EC2) Windows Server instances. • AWSSupport-TroubleshootPatchManagerLinux – The AWSSupport- TroubleshootPatchManagerLinux runbook troubleshoots common issues that can cause a patch failure on Linux-based managed nodes using Patch Manager. The main goal of this runbook is to identify the patch command failure root cause and suggest a remediation plan. Note There is a charge to run Automation runbooks. For information, see AWS Systems Manager Pricing for Automation. Patch Manager 759 AWS Systems Manager Contacting AWS Support User Guide If you can't find troubleshooting solutions in this section or in the Systems Manager issues in AWS re:Post, and you have a Developer, Business, or Enterprise Support plan, you can create a technical support case at AWS Support. Before you contact Support, collect the following items: • SSM agent logs • Run Command command ID, maintenance window ID, or Automation execution ID • For Windows Server managed nodes, also collect the following: • %PROGRAMDATA%\Amazon\PatchBaselineOperations\Logs as described on the Windows tab of How patches are installed • Windows update logs: For Windows Server 2012 R2 and older, use %windir%/ WindowsUpdate.log. For Windows Server 2016 and newer, first run the PowerShell command Get-WindowsUpdateLog before using %windir%/WindowsUpdate.log • For Linux managed nodes, also collect the following: • The contents of the directory /var/lib/amazon/ssm/instance-id/document/ orchestration/Run-Command-execution-id/awsrunShellScript/PatchLinux AWS Systems Manager Run Command Using Run Command, a tool in AWS Systems Manager, you can remotely and securely manage the configuration of your managed nodes. A managed node is any Amazon Elastic Compute Cloud (Amazon EC2) instance or non-EC2 machine in your hybrid and multicloud environment that has been configured for Systems Manager. Run Command allows you to automate common administrative tasks and perform one-time configuration changes at scale. You can use Run Command from the AWS Management Console, the AWS Command Line Interface (AWS CLI), AWS Tools for Windows PowerShell, or the AWS SDKs. Run Command is offered at no additional cost. To get started with Run Command, open the Systems Manager console. In the navigation pane, choose Run Command. Administrators use Run Command to install or bootstrap applications, build a deployment pipeline, capture log files when an instance is removed from an Auto Scaling group, join instances to a Windows domain, and more. Run Command 760 AWS Systems Manager User Guide The Run Command API follows an eventual consistency model, due to the distributed nature of the system supporting the API. This means that the result of an API command you run that affects your resources might not be immediately visible to all subsequent commands you run. You should keep this in mind when you carry out an API command that immediately follows a previous API command. Getting Started The following table includes information to help you get started with Run Command. Topic Details Setting up managed nodes for AWS Systems Manager Verify that you have completed the setup requirements for your Amazon Elastic Compute Cloud (Amazon EC2) instances and non-EC2 machines in a hybrid and multicloud environment. Managing nodes in hybrid and multicloud environments with Systems Manager (Optional) Register on-premises servers and VMs with AWS so you can manage them using Run Command. the section called “Managing edge devices with Systems Manager” (Optional) Configure edge devices so you can manage them using Run Command. Running commands on managed nodes Run Command walkthroughs EventBridge support Learn how to run a command that targets one or more managed nodes by using the AWS Management Console. Learn how to run commands using either Tools for Windows PowerShell or the AWS CLI. This Systems Manager tool is supported as both an event type and a target type in Amazon EventBridge rules. For information, see Monitoring Systems Manager events with Amazon EventBridge and Reference: Amazon EventBridge event patterns and types for Systems Manager. Run Command 761 AWS Systems Manager More info User Guide • Remotely Run Command on an EC2 Instance (10 minute tutorial) • Systems Manager service quotas in the Amazon Web Services General Reference • AWS Systems Manager API Reference Topics • Setting up Run Command • Running commands on managed nodes • Using exit codes in commands • Understanding command statuses • Run Command walkthroughs • Troubleshooting Systems Manager Run Command Setting up Run Command Before you can manage nodes by using Run Command, a tool in AWS Systems Manager, configure an AWS Identity and Access Management (IAM) policy for any
|
systems-manager-ug-242
|
systems-manager-ug.pdf
| 242 |
Command 761 AWS Systems Manager More info User Guide • Remotely Run Command on an EC2 Instance (10 minute tutorial) • Systems Manager service quotas in the Amazon Web Services General Reference • AWS Systems Manager API Reference Topics • Setting up Run Command • Running commands on managed nodes • Using exit codes in commands • Understanding command statuses • Run Command walkthroughs • Troubleshooting Systems Manager Run Command Setting up Run Command Before you can manage nodes by using Run Command, a tool in AWS Systems Manager, configure an AWS Identity and Access Management (IAM) policy for any user who will run commands. If you use any global condition keys for the SendCommand action in your IAM policies, you must include the aws:ViaAWSService condition key and set the boolean value to true. The following is an example. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": ["ssm:SendCommand"], "Resource": ["arn:aws:ssm:region:account:document/YourDocument"], "Condition": { "StringEquals": { "aws:SourceVpce": ["vpce-example1234"] } } }, { "Effect": "Allow", "Action": ["ssm:SendCommand"], Run Command 762 AWS Systems Manager User Guide "Resource": ["arn:aws:ssm:region:account:document/YourDocument"], "Condition": { "Bool": {"aws:ViaAWSService": "true"} } } ] } You must also configure your nodes for Systems Manager. For more information, see Setting up managed nodes for AWS Systems Manager. We recommend completing the following optional setup tasks to help minimize the security posture and day-to-day management of your managed nodes. Monitor command executions using Amazon EventBridge You can use EventBridge to log command execution status changes. You can create a rule that runs whenever there is a state transition, or when there is a transition to one or more states that are of interest. You can also specify Run Command as a target action when an EventBridge event occurs. For more information, see Configuring EventBridge for Systems Manager events. Monitor command executions using Amazon CloudWatch Logs You can configure Run Command to periodically send all command output and error logs to an Amazon CloudWatch log group. You can monitor these output logs in near real-time, search for specific phrases, values, or patterns, and create alarms based on the search. For more information, see Configuring Amazon CloudWatch Logs for Run Command. Restrict Run Command access to specific managed nodes You can restrict a user's ability to run commands on managed nodes by using AWS Identity and Access Management (IAM). Specifically, you can create an IAM policy with a condition that the user can only run commands on managed nodes that are tagged with specific tags. For more information, see Restricting Run Command access based on tags. Restricting Run Command access based on tags This section describes how to restrict a user's ability to run commands on managed nodes by specifying a tag condition in an IAM policy. Managed nodes include Amazon EC2 instances and non-EC2 nodes in a hybrid and multicloud environment that are configured for Systems Manager. Though the information is not explicitly presented, you can also restrict access to managed AWS Run Command 763 AWS Systems Manager User Guide IoT Greengrass core devices. To get started, you must tag your AWS IoT Greengrass devices. For more information, see Tag your AWS IoT Greengrass Version 2 resources in the AWS IoT Greengrass Version 2 Developer Guide. You can restrict command execution to specific managed nodes by creating an IAM policy that includes a condition that the user can only run commands on nodes with specific tags. In the following example, the user is allowed to use Run Command (Effect: Allow, Action: ssm:SendCommand) by using any SSM document (Resource: arn:aws:ssm:*:*:document/*) on any node (Resource: arn:aws:ec2:*:*:instance/*) with the condition that the node is a Finance WebServer (ssm:resourceTag/Finance: WebServer). If the user sends a command to a node that isn't tagged or that has any tag other than Finance: WebServer, the execution results show AccessDenied. { "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":[ "ssm:SendCommand" ], "Resource":[ "arn:aws:ssm:*:*:document/*" ] }, { "Effect":"Allow", "Action":[ "ssm:SendCommand" ], "Resource":[ "arn:aws:ec2:*:*:instance/*" ], "Condition":{ "StringLike":{ "ssm:resourceTag/Finance":[ "WebServers" ] } } } ] Run Command 764 AWS Systems Manager } User Guide You can create IAM policies that allow a user to run commands on managed nodes that are tagged with multiple tags. The following policy allows the user to run commands on managed nodes that have two tags. If a user sends a command to a node that isn't tagged with both of these tags, the execution results show AccessDenied. { "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":[ "ssm:SendCommand" ], "Resource":"*", "Condition":{ "StringLike":{ "ssm:resourceTag/tag_key1":[ "tag_value1" ], "ssm:resourceTag/tag_key2":[ "tag_value2" ] } } }, { "Effect":"Allow", "Action":[ "ssm:SendCommand" ], "Resource":[ "arn:aws:ssm:us-west-1::document/AWS-*", "arn:aws:ssm:us-east-2::document/AWS-*" ] }, { "Effect":"Allow", "Action":[ "ssm:UpdateInstanceInformation", "ssm:ListCommands", "ssm:ListCommandInvocations", Run Command 765 AWS Systems Manager User Guide "ssm:GetDocument" ], "Resource":"*" } ] } You can also create IAM policies that allows a user to run commands on multiple groups of tagged managed nodes. The following example policy allows
|
systems-manager-ug-243
|
systems-manager-ug.pdf
| 243 |
have two tags. If a user sends a command to a node that isn't tagged with both of these tags, the execution results show AccessDenied. { "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":[ "ssm:SendCommand" ], "Resource":"*", "Condition":{ "StringLike":{ "ssm:resourceTag/tag_key1":[ "tag_value1" ], "ssm:resourceTag/tag_key2":[ "tag_value2" ] } } }, { "Effect":"Allow", "Action":[ "ssm:SendCommand" ], "Resource":[ "arn:aws:ssm:us-west-1::document/AWS-*", "arn:aws:ssm:us-east-2::document/AWS-*" ] }, { "Effect":"Allow", "Action":[ "ssm:UpdateInstanceInformation", "ssm:ListCommands", "ssm:ListCommandInvocations", Run Command 765 AWS Systems Manager User Guide "ssm:GetDocument" ], "Resource":"*" } ] } You can also create IAM policies that allows a user to run commands on multiple groups of tagged managed nodes. The following example policy allows the user to run commands on either group of tagged nodes, or both groups. { "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":[ "ssm:SendCommand" ], "Resource":"*", "Condition":{ "StringLike":{ "ssm:resourceTag/tag_key1":[ "tag_value1" ] } } }, { "Effect":"Allow", "Action":[ "ssm:SendCommand" ], "Resource":"*", "Condition":{ "StringLike":{ "ssm:resourceTag/tag_key2":[ "tag_value2" ] } } }, { Run Command 766 AWS Systems Manager User Guide "Effect":"Allow", "Action":[ "ssm:SendCommand" ], "Resource":[ "arn:aws:ssm:us-west-1::document/AWS-*", "arn:aws:ssm:us-east-2::document/AWS-*" ] }, { "Effect":"Allow", "Action":[ "ssm:UpdateInstanceInformation", "ssm:ListCommands", "ssm:ListCommandInvocations", "ssm:GetDocument" ], "Resource":"*" } ] } For more information about creating IAM policies, see Managed policies and inline policies in the IAM User Guide. For more information about tagging managed nodes, see Tag Editor in the AWS Resource Groups User Guide. Running commands on managed nodes This section includes information about how to send commands from the AWS Systems Manager console to managed nodes. This section also includes information about how to cancel a command. Note that if your node is configured with the noexec mount option for the var directory, Run Command is unable to successfuly run commands. Important When you send a command using Run Command, don't include sensitive information formatted as plaintext, such as passwords, configuration data, or other secrets. All Systems Manager API activity in your account is logged in an S3 bucket for AWS CloudTrail logs. This means that any user with access to S3 bucket can view the plaintext values of those secrets. For this reason, we recommend creating and using SecureString parameters to encrypt sensitive data you use in your Systems Manager operations. Run Command 767 AWS Systems Manager User Guide For more information, see Restricting access to Parameter Store parameters using IAM policies. Execution history retention The history of each command is available for up to 30 days. In addition, you can store a copy of all log files in Amazon Simple Storage Service or have an audit trail of all API calls in AWS CloudTrail. Related information For information about sending commands using other tools, see the following topics: • Walkthrough: Use the AWS Tools for Windows PowerShell with Run Command or the examples in the AWS Systems Manager section of the AWS Tools for PowerShell Cmdlet Reference. • Walkthrough: Use the AWS CLI with Run Command or the examples in the SSM CLI Reference Contents • Running commands from the console • Running commands using a specific document version • Run commands at scale • Canceling a command Running commands from the console You can use Run Command, a tool in AWS Systems Manager, from the AWS Management Console to configure managed nodes without having to log into them. This topic includes an example that shows how to update SSM Agent on a managed node by using Run Command. Before you begin Before you send a command using Run Command, verify that your managed nodes meet all Systems Manager setup requirements. To send a command using Run Command 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. Run Command 768 AWS Systems Manager User Guide 2. In the navigation pane, choose Run Command. 3. Choose Run command. 4. 5. 6. In the Command document list, choose a Systems Manager document. In the Command parameters section, specify values for required parameters. In the Targets section, choose the managed nodes on which you want to run this operation by specifying tags, selecting instances or edge devices manually, or specifying a resource group. Tip If a managed node you expect to see isn't listed, see Troubleshooting managed node availability for troubleshooting tips. 7. For Other parameters: • For Comment, enter information about this command. • For Timeout (seconds), specify the number of seconds for the system to wait before failing the overall command execution. 8. For Rate control: • For Concurrency, specify either a number or a percentage of managed nodes on which to run the command at the same time. Note If you selected targets by specifying tags applied to managed nodes or by specifying AWS resource groups, and you aren't certain how many managed nodes are targeted, then restrict the number of targets that can run the document at the same time by specifying a percentage. • For Error threshold, specify when to stop running the command on other managed nodes
|
systems-manager-ug-244
|
systems-manager-ug.pdf
| 244 |
for the system to wait before failing the overall command execution. 8. For Rate control: • For Concurrency, specify either a number or a percentage of managed nodes on which to run the command at the same time. Note If you selected targets by specifying tags applied to managed nodes or by specifying AWS resource groups, and you aren't certain how many managed nodes are targeted, then restrict the number of targets that can run the document at the same time by specifying a percentage. • For Error threshold, specify when to stop running the command on other managed nodes after it fails on either a number or a percentage of nodes. For example, if you specify three errors, then Systems Manager stops sending the command when the fourth error is received. Managed nodes still processing the command might also send errors. 9. (Optional) Choose a CloudWatch alarm to apply to your command for monitoring. To attach a CloudWatch alarm to your command, the IAM principal that runs the command must have permission for the iam:createServiceLinkedRole action. For more information about Run Command 769 AWS Systems Manager User Guide CloudWatch alarms, see Using Amazon CloudWatch alarms. Note that if your alarm activates, any pending command invocations do not run. 10. (Optional) For Output options, to save the command output to a file, select the Write command output to an S3 bucket box. Enter the bucket and prefix (folder) names in the boxes. Note The S3 permissions that grant the ability to write the data to an S3 bucket are those of the instance profile (for EC2 instances) or IAM service role (hybrid-activated machines) assigned to the instance, not those of the IAM user performing this task. For more information, see Configure instance permissions required for Systems Manager or Create an IAM service role for a hybrid environment. In addition, if the specified S3 bucket is in a different AWS account, make sure that the instance profile or IAM service role associated with the managed node has the necessary permissions to write to that bucket. 11. In the SNS notifications section, if you want notifications sent about the status of the command execution, select the Enable SNS notifications check box. For more information about configuring Amazon SNS notifications for Run Command, see Monitoring Systems Manager status changes using Amazon SNS notifications. 12. Choose Run. For information about canceling a command, see the section called “Canceling a command”. Rerunning commands Systems Manager includes two options to help you rerun a command from the Run Command page in the Systems Manager console. • Rerun: This button allows you to run the same command without making changes to it. • Copy to new: This button copies the settings of one command to a new command and gives you the option to edit those settings before you run it. Run Command 770 AWS Systems Manager To rerun a command User Guide 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Run Command. 3. Choose a command to rerun. You can rerun a command immediately after executing it from the command details page. Or, you can choose a command that you previously ran from the Command history tab. 4. Choose either Rerun to run the same command without changes, or choose Copy to new to edit the command settings before you run it. Running commands using a specific document version You can use the document version parameter to specify which version of an AWS Systems Manager document to use when the command runs. You can specify one of the following options for this parameter: • $DEFAULT • $LATEST • Version number Run the following procedure to run a command using the document version parameter. Linux To run commands using the AWS CLI on local Linux machines 1. Install and configure the AWS Command Line Interface (AWS CLI), if you haven't already. For information, see Installing or updating the latest version of the AWS CLI. 2. List all available documents This command lists all of the documents available for your account based on AWS Identity and Access Management (IAM) permissions. aws ssm list-documents Run Command 771 AWS Systems Manager User Guide 3. Run the following command to view the different versions of a document. Replace document name with your own information. aws ssm list-document-versions \ --name "document name" 4. Run the following command to run a command that uses an SSM document version. Replace each example resource placeholder with your own information. aws ssm send-command \ --document-name "AWS-RunShellScript" \ --parameters commands="echo Hello" \ --instance-ids instance-ID \ --document-version '$LATEST' Windows To run commands using the AWS CLI on local Windows machines 1. Install and configure the AWS Command Line Interface (AWS CLI), if you haven't already. For information, see Installing or
|
systems-manager-ug-245
|
systems-manager-ug.pdf
| 245 |
Guide 3. Run the following command to view the different versions of a document. Replace document name with your own information. aws ssm list-document-versions \ --name "document name" 4. Run the following command to run a command that uses an SSM document version. Replace each example resource placeholder with your own information. aws ssm send-command \ --document-name "AWS-RunShellScript" \ --parameters commands="echo Hello" \ --instance-ids instance-ID \ --document-version '$LATEST' Windows To run commands using the AWS CLI on local Windows machines 1. Install and configure the AWS Command Line Interface (AWS CLI), if you haven't already. For information, see Installing or updating the latest version of the AWS CLI. 2. List all available documents This command lists all of the documents available for your account based on AWS Identity and Access Management (IAM) permissions. aws ssm list-documents 3. Run the following command to view the different versions of a document. Replace document name with your own information. aws ssm list-document-versions ^ --name "document name" 4. Run the following command to run a command that uses an SSM document version. Replace each example resource placeholder with your own information. aws ssm send-command ^ --document-name "AWS-RunShellScript" ^ Run Command 772 AWS Systems Manager User Guide --parameters commands="echo Hello" ^ --instance-ids instance-ID ^ --document-version "$LATEST" PowerShell To run commands using the Tools for PowerShell 1. Install and configure the AWS Tools for PowerShell (Tools for Windows PowerShell), if you haven't already. For information, see Installing the AWS Tools for PowerShell. 2. List all available documents This command lists all of the documents available for your account based on AWS Identity and Access Management (IAM) permissions. Get-SSMDocumentList 3. Run the following command to view the different versions of a document. Replace document name with your own information. Get-SSMDocumentVersionList ` -Name "document name" 4. Run the following command to run a command that uses an SSM document version. Replace each example resource placeholder with your own information. Send-SSMCommand ` -DocumentName "AWS-RunShellScript" ` -Parameter @{commands = "echo helloWorld"} ` -InstanceIds "instance-ID" ` -DocumentVersion $LATEST Run commands at scale You can use Run Command, a tool in AWS Systems Manager, to run commands on a fleet of managed nodes by using the targets. The targets parameter accepts a Key,Value combination based on tags that you specified for your managed nodes. When you run the Run Command 773 AWS Systems Manager User Guide command, the system locates and attempts to run the command on all managed nodes that match the specified tags. For more information about tagging managed instances, see Tagging your AWS resources in the Tagging AWS Resources User Guide. For information about tagging your managed IoT devices, see Tag your AWS IoT Greengrass Version 2 resources in the AWS IoT Greengrass Version 2 Developer Guide. You can also use the targets parameter to target a list of specific managed node IDs, as described in the next section. To control how commands run across hundreds or thousands of managed nodes, Run Command also includes parameters for restricting how many nodes can simultaneously process a request and how many errors can be thrown by a command before the command is canceled. Contents • Targeting multiple managed nodes • Using rate controls Targeting multiple managed nodes You can run a command and target managed nodes by specifying tags, AWS resource group names, or managed node IDs. The following examples show the command format when using Run Command from the AWS Command Line Interface (AWS CLI ). Replace each example resource placeholder with your own information. Sample commands in this section are truncated using [...]. Example 1: Targeting tags Linux & macOS aws ssm send-command \ --document-name document-name \ --targets Key=tag:tag-name,Values=tag-value \ [...] Windows aws ssm send-command ^ --document-name document-name ^ Run Command 774 AWS Systems Manager User Guide --targets Key=tag:tag-name,Values=tag-value ^ [...] Example 2: Targeting an AWS resource group by name You can specify a maximum of one resource group name per command. When you create a resource group, we recommend including AWS::SSM:ManagedInstance and AWS::EC2::Instance as resource types in your grouping criteria. Note In order to send commands that target a resource group, you must have been granted AWS Identity and Access Management (IAM) permissions to list or view the resources that belong to that group. For more information, see Set up permissions in the AWS Resource Groups User Guide. Linux & macOS aws ssm send-command \ --document-name document-name \ --targets Key=resource-groups:Name,Values=resource-group-name \ [...] Windows aws ssm send-command ^ --document-name document-name ^ --targets Key=resource-groups:Name,Values=resource-group-name ^ [...] Example 3: Targeting an AWS resource group by resource type You can specify a maximum of five resource group types per command. When you create a resource group, we recommend including AWS::SSM:ManagedInstance and AWS::EC2::Instance as resource types in your grouping criteria. Run Command 775 AWS Systems Manager Note User Guide In order to send
|
systems-manager-ug-246
|
systems-manager-ug.pdf
| 246 |
resources that belong to that group. For more information, see Set up permissions in the AWS Resource Groups User Guide. Linux & macOS aws ssm send-command \ --document-name document-name \ --targets Key=resource-groups:Name,Values=resource-group-name \ [...] Windows aws ssm send-command ^ --document-name document-name ^ --targets Key=resource-groups:Name,Values=resource-group-name ^ [...] Example 3: Targeting an AWS resource group by resource type You can specify a maximum of five resource group types per command. When you create a resource group, we recommend including AWS::SSM:ManagedInstance and AWS::EC2::Instance as resource types in your grouping criteria. Run Command 775 AWS Systems Manager Note User Guide In order to send commands that target a resource group, you must have been granted IAM permissions to list, or view, the resources that belong to that group. For more information, see Set up permissions in the AWS Resource Groups User Guide. Linux & macOS aws ssm send-command \ --document-name document-name \ --targets Key=resource-groups:ResourceTypeFilters,Values=resource- type-1,resource-type-2 \ [...] Windows aws ssm send-command ^ --document-name document-name ^ --targets Key=resource-groups:ResourceTypeFilters,Values=resource- type-1,resource-type-2 ^ [...] Example 4: Targeting instance IDs The following examples show how to target managed nodes by using the instanceids key with the targets parameter. You can use this key to target managed AWS IoT Greengrass core devices because each device is assigned an mi-ID_number. You can view device IDs in Fleet Manager, a tool in AWS Systems Manager. Linux & macOS aws ssm send-command \ --document-name document-name \ --targets Key=instanceids,Values=instance-ID-1,instance-ID-2,instance-ID-3 \ [...] Windows aws ssm send-command ^ Run Command 776 AWS Systems Manager User Guide --document-name document-name ^ --targets Key=instanceids,Values=instance-ID-1,instance-ID-2,instance-ID-3 ^ [...] If you tagged managed nodes for different environments using a Key named Environment and Values of Development, Test, Pre-production and Production, then you could send a command to all managed nodes in one of these environments by using the targets parameter with the following syntax. Linux & macOS aws ssm send-command \ --document-name document-name \ --targets Key=tag:Environment,Values=Development \ [...] Windows aws ssm send-command ^ --document-name document-name ^ --targets Key=tag:Environment,Values=Development ^ [...] You could target additional managed nodes in other environments by adding to the Values list. Separate items using commas. Linux & macOS aws ssm send-command \ --document-name document-name \ --targets Key=tag:Environment,Values=Development,Test,Pre-production \ [...] Windows aws ssm send-command ^ --document-name document-name ^ --targets Key=tag:Environment,Values=Development,Test,Pre-production ^ [...] Run Command 777 AWS Systems Manager User Guide Variation: Refining your targets using multiple Key criteria You can refine the number of targets for your command by including multiple Key criteria. If you include more than one Key criteria, the system targets managed nodes that meet all of the criteria. The following command targets all managed nodes tagged for the Finance Department and tagged for the database server role. Linux & macOS aws ssm send-command \ --document-name document-name \ --targets Key=tag:Department,Values=Finance Key=tag:ServerRole,Values=Database \ [...] Windows aws ssm send-command ^ --document-name document-name ^ --targets Key=tag:Department,Values=Finance Key=tag:ServerRole,Values=Database ^ [...] Variation: Using multiple Key and Value criteria Expanding on the previous example, you can target multiple departments and multiple server roles by including additional items in the Values criteria. Linux & macOS aws ssm send-command \ --document-name document-name \ --targets Key=tag:Department,Values=Finance,Marketing Key=tag:ServerRole,Values=WebServer,Database \ [...] Windows aws ssm send-command ^ --document-name document-name ^ --targets Key=tag:Department,Values=Finance,Marketing Key=tag:ServerRole,Values=WebServer,Database ^ Run Command 778 AWS Systems Manager [...] User Guide Variation: Targeting tagged managed nodes using multiple Values criteria If you tagged managed nodes for different environments using a Key named Department and Values of Sales and Finance, then you could send a command to all of the nodes in these environments by using the targets parameter with the following syntax. Linux & macOS aws ssm send-command \ --document-name document-name \ --targets Key=tag:Department,Values=Sales,Finance \ [...] Windows aws ssm send-command ^ --document-name document-name ^ --targets Key=tag:Department,Values=Sales,Finance ^ [...] You can specify a maximum of five keys, and five values for each key. If either a tag key (the tag name) or a tag value includes spaces, enclose the tag key or the value in quotation marks, as shown in the following examples. Example: Spaces in Value tag Linux & macOS aws ssm send-command \ --document-name document-name \ --targets Key=tag:OS,Values="Windows Server 2016" \ [...] Windows aws ssm send-command ^ --document-name document-name ^ Run Command 779 AWS Systems Manager User Guide --targets Key=tag:OS,Values="Windows Server 2016" ^ [...] Example: Spaces in tag key and Value Linux & macOS aws ssm send-command \ --document-name document-name \ --targets Key="tag:Operating System",Values="Windows Server 2016" \ [...] Windows aws ssm send-command ^ --document-name document-name ^ --targets Key="tag:Operating System",Values="Windows Server 2016" ^ [...] Example: Spaces in one item in a list of Values Linux & macOS aws ssm send-command \ --document-name document-name \ --targets Key=tag:Department,Values="Sales","Finance","Systems Mgmt" \ [...] Windows aws ssm send-command ^ --document-name document-name ^ --targets Key=tag:Department,Values="Sales","Finance","Systems Mgmt" ^ [...] Using rate controls You can control the rate at which commands are sent to managed nodes in a group by using concurrency controls and
|
systems-manager-ug-247
|
systems-manager-ug.pdf
| 247 |
Spaces in tag key and Value Linux & macOS aws ssm send-command \ --document-name document-name \ --targets Key="tag:Operating System",Values="Windows Server 2016" \ [...] Windows aws ssm send-command ^ --document-name document-name ^ --targets Key="tag:Operating System",Values="Windows Server 2016" ^ [...] Example: Spaces in one item in a list of Values Linux & macOS aws ssm send-command \ --document-name document-name \ --targets Key=tag:Department,Values="Sales","Finance","Systems Mgmt" \ [...] Windows aws ssm send-command ^ --document-name document-name ^ --targets Key=tag:Department,Values="Sales","Finance","Systems Mgmt" ^ [...] Using rate controls You can control the rate at which commands are sent to managed nodes in a group by using concurrency controls and error controls. Run Command 780 AWS Systems Manager Topics • Using concurrency controls • Using error controls Using concurrency controls User Guide You can control the number of managed nodes that run a command simultaneously by using the max-concurrency parameter (the Concurrency options in the Run a command page). You can specify either an absolute number of managed nodes, for example 10, or a percentage of the target set, for example 10%. The queueing system delivers the command to a single node and waits until the system acknowledges the initial invocation before sending the command to two more nodes. The system exponentially sends commands to more nodes until the system meets the value of max-concurrency. The default for value max-concurrency is 50. The following examples show you how to specify values for the max-concurrency parameter. Linux & macOS aws ssm send-command \ --document-name document-name \ --max-concurrency 10 \ --targets Key=tag:Environment,Values=Development \ [...] aws ssm send-command \ --document-name document-name \ --max-concurrency 10% \ --targets Key=tag:Department,Values=Finance,Marketing Key=tag:ServerRole,Values=WebServer,Database \ [...] Windows aws ssm send-command ^ --document-name document-name ^ --max-concurrency 10 ^ --targets Key=tag:Environment,Values=Development ^ [...] aws ssm send-command ^ Run Command 781 AWS Systems Manager User Guide --document-name document-name ^ --max-concurrency 10% ^ --targets Key=tag:Department,Values=Finance,Marketing Key=tag:ServerRole,Values=WebServer,Database ^ [...] Using error controls You can also control the execution of a command to hundreds or thousands of managed nodes by setting an error limit using the max-errors parameters (the Error threshold field in the Run a command page). The parameter specifies how many errors are allowed before the system stops sending the command to additional managed nodes. You can specify either an absolute number of errors, for example 10, or a percentage of the target set, for example 10%. If you specify 3, for example, the system stops sending the command when the fourth error is received. If you specify 0, then the system stops sending the command to additional managed nodes after the first error result is returned. If you send a command to 50 managed nodes and set max-errors to 10%, then the system stops sending the command to additional nodes when the sixth error is received. Invocations that are already running a command when max-errors is reached are allowed to complete, but some of these invocations might fail as well. If you need to ensure that there won’t be more than max-errors failed invocations, set max-concurrency to 1 so the invocations proceed one at a time. The default for max-errors is 0. The following examples show you how to specify values for the max-errors parameter. Linux & macOS aws ssm send-command \ --document-name document-name \ --max-errors 10 \ --targets Key=tag:Database,Values=Development \ [...] aws ssm send-command \ --document-name document-name \ --max-errors 10% \ --targets Key=tag:Environment,Values=Development \ [...] aws ssm send-command \ Run Command 782 AWS Systems Manager User Guide --document-name document-name \ --max-concurrency 1 \ --max-errors 1 \ --targets Key=tag:Environment,Values=Production \ [...] Windows aws ssm send-command ^ --document-name document-name ^ --max-errors 10 ^ --targets Key=tag:Database,Values=Development ^ [...] aws ssm send-command ^ --document-name document-name ^ --max-errors 10% ^ --targets Key=tag:Environment,Values=Development ^ [...] aws ssm send-command ^ --document-name document-name ^ --max-concurrency 1 ^ --max-errors 1 ^ --targets Key=tag:Environment,Values=Production ^ [...] Canceling a command You can attempt to cancel a command as long as the service shows that it's in either a Pending or Executing state. However, even if a command is still in one of these states, we can't guarantee that the command will be canceled and the underlying process stopped. To cancel a command using the console 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. 3. In the navigation pane, choose Run Command. Select the command invocation that you want to cancel. Run Command 783 AWS Systems Manager 4. Choose Cancel command. To cancel a command using the AWS CLI User Guide Run the following command. Replace each example resource placeholder with your own information. Linux & macOS aws ssm cancel-command \ --command-id "command-ID" \ --instance-ids "instance-ID" Windows aws ssm cancel-command ^ --command-id "command-ID" ^ --instance-ids "instance-ID" For information about the status of a canceled command, see Understanding command statuses. Using exit codes in commands In some cases, you might need to manage how your commands are handled by using exit
|
systems-manager-ug-248
|
systems-manager-ug.pdf
| 248 |
Run Command. Select the command invocation that you want to cancel. Run Command 783 AWS Systems Manager 4. Choose Cancel command. To cancel a command using the AWS CLI User Guide Run the following command. Replace each example resource placeholder with your own information. Linux & macOS aws ssm cancel-command \ --command-id "command-ID" \ --instance-ids "instance-ID" Windows aws ssm cancel-command ^ --command-id "command-ID" ^ --instance-ids "instance-ID" For information about the status of a canceled command, see Understanding command statuses. Using exit codes in commands In some cases, you might need to manage how your commands are handled by using exit codes. Specify exit codes in commands Using Run Command, a tool in AWS Systems Manager, you can specify exit codes to determine how commands are handled. By default, the exit code of the last command run in a script is reported as the exit code for the entire script. For example, you have a script that contains three commands. The first one fails but the following ones succeed. Because the final command succeeded, the status of the execution is reported as succeeded. Shell scripts To fail the entire script at the first command failure, you can include a shell conditional statement to exit the script if any command before the final one fails. Use the following approach. <command 1> Run Command 784 AWS Systems Manager if [ $? != 0 ] then exit <N> fi <command 2> <command 3> In the following example, the entire script fails if the first command fails. User Guide cd /test if [ $? != 0 ] then echo "Failed" exit 1 fi date PowerShell scripts PowerShell requires that you call exit explicitly in your scripts for Run Command to successfully capture the exit code. <command 1> if ($?) {<do something>} else {exit <N>} <command 2> <command 3> exit <N> Here is an example: cd C:\ if ($?) {echo "Success"} else {exit 1} date Handling reboots when running commands If you use Run Command, a tool in AWS Systems Manager, to run scripts that reboot managed nodes, we recommend that you specify an exit code in your script. If you attempt to reboot a node from a script by using some other mechanism, the script execution status might not be updated Run Command 785 AWS Systems Manager User Guide correctly, even if the reboot is the last step in your script. For Windows managed nodes, you specify exit 3010 in your script. For Linux and macOS managed nodes, you specify exit 194. The exit code instructs AWS Systems Manager Agent (SSM Agent) to reboot the managed node, and then restart the script after the reboot completed. Before starting the reboot, SSM Agent informs the Systems Manager service in the cloud that communication will be disrupted during the server reboot. Note The reboot script can't be part of an aws:runDocument plugin. If a document contains the reboot script and another document tries to run that document through the aws:runDocument plugin, SSM Agent returns an error. Create idempotent scripts When developing scripts that reboot managed nodes, make the scripts idempotent so the script execution continues where it left off after the reboot. Idempotent scripts manage state and validate if the action was performed or not. This prevents a step from running multiple times when it's only intended to run once. Here is an outline example of an idempotent script that reboots a managed node multiple times. $name = Get current computer name If ($name –ne $desiredName) { Rename computer exit 3010 } $domain = Get current domain name If ($domain –ne $desiredDomain) { Join domain exit 3010 } If (desired package not installed) { Install package exit 3010 Run Command 786 AWS Systems Manager } Examples User Guide The following script samples use exit codes to restart managed nodes. The Linux example installs package updates on Amazon Linux, and then restarts the node. The Windows Server example installs the Telnet-Client on the node, and then restarts it. Amazon Linux #!/bin/bash yum -y update needs-restarting -r if [ $? -eq 1 ] then exit 194 else exit 0 fi Windows $telnet = Get-WindowsFeature -Name Telnet-Client if (-not $telnet.Installed) { # Install Telnet and then send a reboot request to SSM Agent. Install-WindowsFeature -Name "Telnet-Client" exit 3010 } Understanding command statuses Run Command, a tool in AWS Systems Manager, reports detailed status information about the different states a command experiences during processing and for each managed node that processed the command. You can monitor command statuses using the following methods: • Choose the Refresh icon on the Commands tab in the Run Command console interface. • Call list-commands or list-command-invocations using the AWS Command Line Interface (AWS CLI). Or call Get-SSMCommand or Get-SSMCommandInvocation using AWS Tools for Windows PowerShell. Run Command 787 AWS Systems Manager User Guide • Configure
|
systems-manager-ug-249
|
systems-manager-ug.pdf
| 249 |
to SSM Agent. Install-WindowsFeature -Name "Telnet-Client" exit 3010 } Understanding command statuses Run Command, a tool in AWS Systems Manager, reports detailed status information about the different states a command experiences during processing and for each managed node that processed the command. You can monitor command statuses using the following methods: • Choose the Refresh icon on the Commands tab in the Run Command console interface. • Call list-commands or list-command-invocations using the AWS Command Line Interface (AWS CLI). Or call Get-SSMCommand or Get-SSMCommandInvocation using AWS Tools for Windows PowerShell. Run Command 787 AWS Systems Manager User Guide • Configure Amazon EventBridge to respond to state or status changes. • Configure Amazon Simple Notification Service (Amazon SNS) to send notifications for all status changes or specific statuses such as Failed or TimedOut. Run Command status Run Command reports status details for three areas: plugins, invocations, and an overall command status. A plugin is a code-execution block that is defined in your command's SSM document. For more information about plugins, see Command document plugin reference. When you send a command to multiple managed nodes at the same time, each copy of the command targeting each node is a command invocation. For example, if you use the AWS- RunShellScript document and send an ifconfig command to 20 Linux instances, that command has 20 invocations. Each command invocation individually reports status. The plugins for a given command invocation individually report status as well. Lastly, Run Command includes an aggregated command status for all plugins and invocations. The aggregated command status can be different than the status reported by plugins or invocations, as noted in the following tables. Note If you run commands to large numbers of managed nodes using the max-concurrency or max-errors parameters, command status reflects the limits imposed by those parameters, as described in the following tables. For more information about these parameters, see Run commands at scale. Detailed status for command plugins and invocations Status Pending Details The command hasn't yet been sent to the managed node or hasn't been received by SSM Agent. If the command isn't received by the agent before the length of time passes that is equal to the sum of the Timeout (seconds) parameter and the Execution timeout Run Command 788 AWS Systems Manager Status InProgress Delayed User Guide Details parameter, the status changes to Delivery Timed Out. Systems Manager is attempting to send the command to the managed node, or the command was received by SSM Agent and has started running on the instance. Depending on the result of all command plugins, the status changes to Success, Failed, Delivery Timed Out, or Execution Timed Out. Exception: If the agent isn't running or available on the node, the command status remains at In Progress until the agent is available again, or until the execution timeout limit is reached. The status then changes to a terminal state. The system attempted to send the command to the managed node but wasn't successful. The system retries again. Run Command 789 AWS Systems Manager User Guide Status Success Details This status is returned under a variety of conditions. This status doesn't mean the command was processed on the node. For example, the command can be received by SSM Agent on the managed node and return an exit code of zero as a result of your PowerShell ExecutionPolicy preventing the command from running. This is a terminal state. Conditions that result in a command returning a Success status are: • When targeting a single instance, the command was received by SSM Agent on the managed node and returned an exit code of zero. • When targeting multiple instances, the number of failed invocations has not crossed the error threshold specified in the command. • When targeting multiple instances, at least 1 invocation has succeeded while others have timed out. The specified error threshold still applies. • When targeting a tag, no instances are found associated with the tag. • When targeting a tag, the number of failed invocations has not crossed the error threshold specified in the command. • When targeting a tag, at least 1 invocation has succeeded while others have timed out. The specified error threshold still applies. • You have applications or policies enforced at the OS level that prevent or override the Run Command 790 AWS Systems Manager Status DeliveryTimedOut ExecutionTimedOut User Guide Details execution of a command resulting in an exit code of zero being returned. Note The same conditions apply when targeting resource groups. To troubleshoot errors or get more information about the command execution, send a command that handles errors or exceptions by returning appropriate exit codes (non- zero exit codes for command failure). The command wasn't delivered to the managed node before the total timeout expired. Total timeouts don't count against the
|
systems-manager-ug-250
|
systems-manager-ug.pdf
| 250 |
• You have applications or policies enforced at the OS level that prevent or override the Run Command 790 AWS Systems Manager Status DeliveryTimedOut ExecutionTimedOut User Guide Details execution of a command resulting in an exit code of zero being returned. Note The same conditions apply when targeting resource groups. To troubleshoot errors or get more information about the command execution, send a command that handles errors or exceptions by returning appropriate exit codes (non- zero exit codes for command failure). The command wasn't delivered to the managed node before the total timeout expired. Total timeouts don't count against the parent command’s max-errors limit, but they do contribute to whether the parent command status is Success, Incomplete , or Delivery Timed Out. This is a terminal state. Command automation started on the managed node, but the command wasn’t completed before the execution timeout expired. Execution timeouts count as a failure, which will send a non-zero reply and Systems Manager will exit the attempt to run the command automation, and report a failure status. Run Command 791 AWS Systems Manager User Guide Status Failed Cancelled Undeliverable Terminated Details The command wasn't successful on the managed node. For a plugin, this indicates that the result code wasn't zero. For a command invocation, this indicates that the result code for one or more plugins wasn't zero. Invocation failures count against the max-errors limit of the parent command. This is a terminal state. The command was canceled before it was completed. This is a terminal state. The command can't be delivered to the managed node. The node might not exist or it might not be responding. Undeliverable invocations don't count against the parent command’s max-errors limit, but they do contribute to whether the parent command status is Success or Incomplete . For example, if all invocations in a command have the status Undeliverable , then the command status returned is Failed. However, if a command has five invocations, four of which return the status Undeliverable and one of which returns the status Success, then the parent command's status is Success. This is a terminal state. The parent command exceeded its max-error s limit and subsequent command invocations were canceled by the system. This is a terminal state. Run Command 792 AWS Systems Manager Status InvalidPlatform AccessDenied User Guide Details The command was sent to a managed node that didn't match the required platforms specified by the chosen document. Invalid Platform doesn't count against the parent command’s max-errors limit, but it does contribute to whether the parent command status is Success or Failed. For example, if all invocations in a command have the status Invalid Platform, then the command status returned is Failed. However, if a command has five invocations, four of which return the status Invalid Platform and one of which returns the status Success, then the parent command's status is Success. This is a terminal state. The AWS Identity and Access Managemen t (IAM) user or role initiating the command doesn't have access to the targeted managed node. Access Denied doesn't count against the parent command’s max-errors limit, but it does contribute to whether the parent command status is Success or Failed. For example, if all invocations in a command have the status Access Denied, then the command status returned is Failed. However, if a command has five invocations, four of which return the status Access Denied and one of which returns the status Success, then the parent command's status is Success. This is a terminal state. Run Command 793 AWS Systems Manager Detailed status for a command User Guide Status Pending InProgress Delayed Success DeliveryTimedOut Details The command wasn't yet received by an agent on any managed nodes. The command has been sent to at least one managed node but hasn't reached a final state on all nodes. The system attempted to send the command to the node but wasn't successful. The system retries again. The command was received by SSM Agent on all specified or targeted managed nodes and returned an exit code of zero. All command invocations have reached a terminal state, and the value of max-errors wasn't reached. This status doesn't mean the command was successfully processed on all specified or targeted managed nodes. This is a terminal state. Note To troubleshoot errors or get more information about the command execution, send a command that handles errors or exceptions by returning appropriate exit codes (non- zero exit codes for command failure). The command wasn't delivered to the managed node before the total timeout expired. The value of max-errors or more command invocations shows a status of Run Command 794 AWS Systems Manager Status Failed Incomplete Cancelled RateExceeded User Guide Details Delivery Timed Out. This is a terminal state. The command wasn't successful on the managed node. The value of
|
systems-manager-ug-251
|
systems-manager-ug.pdf
| 251 |
specified or targeted managed nodes. This is a terminal state. Note To troubleshoot errors or get more information about the command execution, send a command that handles errors or exceptions by returning appropriate exit codes (non- zero exit codes for command failure). The command wasn't delivered to the managed node before the total timeout expired. The value of max-errors or more command invocations shows a status of Run Command 794 AWS Systems Manager Status Failed Incomplete Cancelled RateExceeded User Guide Details Delivery Timed Out. This is a terminal state. The command wasn't successful on the managed node. The value of max-errors or more command invocations shows a status of Failed. This is a terminal state. The command was attempted on all managed nodes and one or more of the invocations doesn't have a value of Success. However, not enough invocations failed for the status to be Failed. This is a terminal state. The command was canceled before it was completed. This is a terminal state. The number of managed nodes targeted by the command exceeded the account quota for pending invocations. The system has canceled the command before executing it on any node. This is a terminal state. Run Command 795 AWS Systems Manager Status AccessDenied No Instances In Tag User Guide Details The user or role initiating the command doesn't have access to the targeted resource group. AccessDenied doesn't count against the parent command’s max-errors limit, but does contribute to whether the parent command status is Success or Failed. (For example, if all invocations in a command have the status AccessDenied , then the command status returned is Failed. However, if a command has 5 invocations, 4 of which return the status AccessDenied and 1 of which returns the status Success, then the parent command's status is Success.) This is a terminal state. The tag key-pair value or resource group targeted by the command doesn't match any managed nodes. This is a terminal state. Understanding command timeout values Systems Manager enforces the following timeout values when running commands. Total Timeout In the Systems Manager console, you specify the timeout value in the Timeout (seconds) field. After a command is sent, Run Command checks whether the command has expired or not. If a command reaches the command expiration limit (total timeout), it changes status to DeliveryTimedOut for all invocations that have the status InProgress, Pending or Delayed. Run Command 796 AWS Systems Manager User Guide On a more technical level, total timeout (Timeout (seconds)) is a combination of two timeout values, as shown here: Total timeout = "Timeout(seconds)" from the console + "timeoutSeconds": "{{ executionTimeout }}" from your SSM document For example, the default value of Timeout (seconds) in the Systems Manager console is 600 seconds. If you run a command by using the AWS-RunShellScript SSM document, the default value of "timeoutSeconds": "{{ executionTimeout }}" is 3600 seconds, as shown in the following document sample: "executionTimeout": { "type": "String", "default": "3600", "runtimeConfig": { "aws:runShellScript": { "properties": [ { "timeoutSeconds": "{{ executionTimeout }}" This means the command runs for 4,200 seconds (70 minutes) before the system sets the command status to DeliveryTimedOut. Run Command 797 AWS Systems Manager Execution Timeout User Guide In the Systems Manager console, you specify the execution timeout value in the Execution Timeout field, if available. Not all SSM documents require that you specify an execution timeout. The Execution Timeout field is only displayed when a corresponding input parameter has been defined in the SSM document. If specified, the command must complete within this time period. Note Run Command relies on the SSM Agent document terminal response to determine whether or not the command was delivered to the agent. SSM Agent must send an ExecutionTimedOut signal for an invocation or command to be marked as ExecutionTimedOut. Default Execution Timeout If a SSM document doesn't require that you explicitly specify an execution timeout value, then Systems Manager enforces the hard-coded default execution timeout. How Systems Manager reports timeouts If Systems Manager receives an execution timeout reply from SSM Agent on a target, then Systems Manager marks the command invocation as executionTimeout. If Run Command doesn't receive a document terminal response from SSM Agent, the command invocation is marked as deliveryTimeout. To determine timeout status on a target, SSM Agent combines all parameters and the content of the SSM document to calculate for executionTimeout. When SSM Agent determines that a command has timed out, it sends executionTimeout to the service. The default for Timeout (seconds) is 3600 seconds. The default for Execution Timeout is also 3600 seconds. Therefore, the total default timeout for a command is 7200 seconds. Run Command 798 AWS Systems Manager Note User Guide SSM Agent processes executionTimeout differently depending on the type of SSM document and the document version. Run Command walkthroughs The walkthroughs in
|
systems-manager-ug-252
|
systems-manager-ug.pdf
| 252 |
as deliveryTimeout. To determine timeout status on a target, SSM Agent combines all parameters and the content of the SSM document to calculate for executionTimeout. When SSM Agent determines that a command has timed out, it sends executionTimeout to the service. The default for Timeout (seconds) is 3600 seconds. The default for Execution Timeout is also 3600 seconds. Therefore, the total default timeout for a command is 7200 seconds. Run Command 798 AWS Systems Manager Note User Guide SSM Agent processes executionTimeout differently depending on the type of SSM document and the document version. Run Command walkthroughs The walkthroughs in this section show you how to run commands with Run Command, a tool in AWS Systems Manager, using either the AWS Command Line Interface (AWS CLI) or AWS Tools for Windows PowerShell. Contents • Updating software using Run Command • Walkthrough: Use the AWS CLI with Run Command • Walkthrough: Use the AWS Tools for Windows PowerShell with Run Command You can also view sample commands in the following references. • Systems Manager AWS CLI Reference • AWS Tools for Windows PowerShell - AWS Systems Manager Updating software using Run Command The following procedures describe how to update software on your managed nodes. Updating the SSM Agent using Run Command The following procedure describes how to update the SSM Agent running on your managed nodes. You can update to either the latest version of SSM Agent or downgrade to an older version. When you run the command, the system downloads the version from AWS, installs it, and then uninstalls the version that existed before the command was run. If an error occurs during this process, the system rolls back to the version on the server before the command was run and the command status shows that the command failed. Run Command 799 AWS Systems Manager Note User Guide If an instance is running macOS version 11.0 (Big Sur) or later, the instance must have the SSM Agent version 3.1.941.0 or higher to run the AWS-UpdateSSMAgent document. If the instance is running a version of SSM Agent released before 3.1.941.0, you can update your SSM Agent to run the AWS-UpdateSSMAgent document by running brew update and brew upgrade amazon-ssm-agent commands. To be notified about SSM Agent updates, subscribe to the SSM Agent Release Notes page on GitHub. To update SSM Agent using Run Command 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Run Command. 3. Choose Run command. 4. 5. In the Command document list, choose AWS-UpdateSSMAgent. In the Command parameters section, specify values for the following parameters, if you want: a. b. (Optional) For Version, enter the version of SSM Agent to install. You can install older versions of the agent. If you don't specify a version, the service installs the latest version. (Optional) For Allow Downgrade, choose true to install an earlier version of SSM Agent. If you choose this option, specify the earlier version number. Choose false to install only the newest version of the service. 6. In the Targets section, choose the managed nodes on which you want to run this operation by specifying tags, selecting instances or edge devices manually, or specifying a resource group. Tip If a managed node you expect to see isn't listed, see Troubleshooting managed node availability for troubleshooting tips. 7. For Other parameters: • For Comment, enter information about this command. Run Command 800 AWS Systems Manager User Guide • For Timeout (seconds), specify the number of seconds for the system to wait before failing the overall command execution. 8. For Rate control: • For Concurrency, specify either a number or a percentage of managed nodes on which to run the command at the same time. Note If you selected targets by specifying tags applied to managed nodes or by specifying AWS resource groups, and you aren't certain how many managed nodes are targeted, then restrict the number of targets that can run the document at the same time by specifying a percentage. • For Error threshold, specify when to stop running the command on other managed nodes after it fails on either a number or a percentage of nodes. For example, if you specify three errors, then Systems Manager stops sending the command when the fourth error is received. Managed nodes still processing the command might also send errors. 9. (Optional) For Output options, to save the command output to a file, select the Write command output to an S3 bucket box. Enter the bucket and prefix (folder) names in the boxes. Note The S3 permissions that grant the ability to write the data to an S3 bucket are those of the instance profile (for EC2 instances) or IAM service role (hybrid-activated machines) assigned to the instance, not those of the IAM
|
systems-manager-ug-253
|
systems-manager-ug.pdf
| 253 |
you specify three errors, then Systems Manager stops sending the command when the fourth error is received. Managed nodes still processing the command might also send errors. 9. (Optional) For Output options, to save the command output to a file, select the Write command output to an S3 bucket box. Enter the bucket and prefix (folder) names in the boxes. Note The S3 permissions that grant the ability to write the data to an S3 bucket are those of the instance profile (for EC2 instances) or IAM service role (hybrid-activated machines) assigned to the instance, not those of the IAM user performing this task. For more information, see Configure instance permissions required for Systems Manager or Create an IAM service role for a hybrid environment. In addition, if the specified S3 bucket is in a different AWS account, make sure that the instance profile or IAM service role associated with the managed node has the necessary permissions to write to that bucket. 10. In the SNS notifications section, if you want notifications sent about the status of the command execution, select the Enable SNS notifications check box. Run Command 801 AWS Systems Manager User Guide For more information about configuring Amazon SNS notifications for Run Command, see Monitoring Systems Manager status changes using Amazon SNS notifications. 11. Choose Run. Updating PowerShell using Run Command The following procedure describes how to update PowerShell to version 5.1 on your Windows Server 2012 and 2012 R2 managed nodes. The script provided in this procedure downloads the Windows Management Framework (WMF) version 5.1 update, and starts the installation of the update. The node reboots during this process because this is required when installing WMF 5.1. The download and installation of the update takes approximately five minutes to complete. To update PowerShell using Run Command 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Run Command. 3. Choose Run command. 4. 5. In the Command document list, choose AWS-RunPowerShellScript. In the Commands section, paste the following commands for your operating system. Windows Server 2012 R2 Set-Location -Path "C:\Windows\Temp" Invoke-WebRequest "https://go.microsoft.com/fwlink/?linkid=839516" -OutFile "Win8.1AndW2K12R2-KB3191564-x64.msu" Start-Process -FilePath "$env:systemroot\system32\wusa.exe" -Verb RunAs - ArgumentList ('Win8.1AndW2K12R2-KB3191564-x64.msu', '/quiet') Windows Server 2012 Set-Location -Path "C:\Windows\Temp" Invoke-WebRequest "https://go.microsoft.com/fwlink/?linkid=839513" -OutFile "W2K12-KB3191565-x64.msu" Run Command 802 AWS Systems Manager User Guide Start-Process -FilePath "$env:systemroot\system32\wusa.exe" -Verb RunAs - ArgumentList ('W2K12-KB3191565-x64.msu', '/quiet') 6. In the Targets section, choose the managed nodes on which you want to run this operation by specifying tags, selecting instances or edge devices manually, or specifying a resource group. Tip If a managed node you expect to see isn't listed, see Troubleshooting managed node availability for troubleshooting tips. 7. For Other parameters: • For Comment, enter information about this command. • For Timeout (seconds), specify the number of seconds for the system to wait before failing the overall command execution. 8. For Rate control: • For Concurrency, specify either a number or a percentage of managed nodes on which to run the command at the same time. Note If you selected targets by specifying tags applied to managed nodes or by specifying AWS resource groups, and you aren't certain how many managed nodes are targeted, then restrict the number of targets that can run the document at the same time by specifying a percentage. • For Error threshold, specify when to stop running the command on other managed nodes after it fails on either a number or a percentage of nodes. For example, if you specify three errors, then Systems Manager stops sending the command when the fourth error is received. Managed nodes still processing the command might also send errors. 9. (Optional) For Output options, to save the command output to a file, select the Write command output to an S3 bucket box. Enter the bucket and prefix (folder) names in the boxes. Run Command 803 AWS Systems Manager Note User Guide The S3 permissions that grant the ability to write the data to an S3 bucket are those of the instance profile (for EC2 instances) or IAM service role (hybrid-activated machines) assigned to the instance, not those of the IAM user performing this task. For more information, see Configure instance permissions required for Systems Manager or Create an IAM service role for a hybrid environment. In addition, if the specified S3 bucket is in a different AWS account, make sure that the instance profile or IAM service role associated with the managed node has the necessary permissions to write to that bucket. 10. In the SNS notifications section, if you want notifications sent about the status of the command execution, select the Enable SNS notifications check box. For more information about configuring Amazon SNS notifications for Run Command, see Monitoring Systems Manager status changes using Amazon SNS notifications. 11. Choose Run. After the managed node reboots
|
systems-manager-ug-254
|
systems-manager-ug.pdf
| 254 |
Create an IAM service role for a hybrid environment. In addition, if the specified S3 bucket is in a different AWS account, make sure that the instance profile or IAM service role associated with the managed node has the necessary permissions to write to that bucket. 10. In the SNS notifications section, if you want notifications sent about the status of the command execution, select the Enable SNS notifications check box. For more information about configuring Amazon SNS notifications for Run Command, see Monitoring Systems Manager status changes using Amazon SNS notifications. 11. Choose Run. After the managed node reboots and the installation of the update is complete, connect to your node to confirm that PowerShell successfully upgraded to version 5.1. To check the version of PowerShell on your node, open PowerShell and enter $PSVersionTable. The PSVersion value in the output table shows 5.1 if the upgrade was successful. If the PSVersion value is different than 5.1, for example 3.0 or 4.0, review the Setup logs in Event Viewer under Windows Logs. These logs indicate why the update installation failed. Walkthrough: Use the AWS CLI with Run Command The following sample walkthrough shows you how to use the AWS Command Line Interface (AWS CLI) to view information about commands and command parameters, how to run commands, and how to view the status of those commands. Important Only trusted administrators should be allowed to use AWS Systems Manager pre- configured documents shown in this topic. The commands or scripts specified in Systems Manager documents run with administrative permissions on your managed nodes. If a user has permission to run any of the pre-defined Systems Manager documents (any document Run Command 804 AWS Systems Manager User Guide that begins with AWS-), then that user also has administrator access to the node. For all other users, you should create restrictive documents and share them with specific users. Topics • Step 1: Getting started • Step 2: Run shell scripts to view resource details • Step 3: Send simple commands using the AWS-RunShellScript document • Step 4: Run a simple Python script using Run Command • Step 5: Run a Bash script using Run Command Step 1: Getting started You must either have administrator permissions on the managed node you want to configure or you must have been granted the appropriate permission in AWS Identity and Access Management (IAM). Also note, this example uses the US East (Ohio) Region (us-east-2). Run Command is available in the AWS Regions listed in Systems Manager service endpoints in the Amazon Web Services General Reference. For more information, see Setting up managed nodes for AWS Systems Manager. To run commands using the AWS CLI 1. Install and configure the AWS Command Line Interface (AWS CLI), if you haven't already. For information, see Installing or updating the latest version of the AWS CLI. 2. List all available documents. This command lists all of the documents available for your account based on IAM permissions. aws ssm list-documents 3. Verify that an managed node is ready to receive commands. The output of the following command shows if managed nodes are online. Linux & macOS aws ssm describe-instance-information \ Run Command 805 AWS Systems Manager User Guide --output text --query "InstanceInformationList[*]" Windows aws ssm describe-instance-information ^ --output text --query "InstanceInformationList[*]" 4. Run the following command to view details about a particular managed node. Note To run the commands in this walkthrough, replace the instance and command IDs. For managed AWS IoT Greengrass core devices, use the mi-ID_number for instance ID. The command ID is returned as a response to send-command. Instance IDs are available from Fleet Manager, a tool in AWS Systems Manager.. Linux & macOS aws ssm describe-instance-information \ --instance-information-filter-list key=InstanceIds,valueSet=instance-ID Windows aws ssm describe-instance-information ^ --instance-information-filter-list key=InstanceIds,valueSet=instance-ID Step 2: Run shell scripts to view resource details Using Run Command and the AWS-RunShellScript document, you can run any command or script on a managed node as if you were logged on locally. View the description and available parameters Run the following command to view a description of the Systems Manager JSON document. Linux & macOS aws ssm describe-document \ Run Command 806 AWS Systems Manager User Guide --name "AWS-RunShellScript" \ --query "[Document.Name,Document.Description]" Windows aws ssm describe-document ^ --name "AWS-RunShellScript" ^ --query "[Document.Name,Document.Description]" Run the following command to view the available parameters and details about those parameters. Linux & macOS aws ssm describe-document \ --name "AWS-RunShellScript" \ --query "Document.Parameters[*]" Windows aws ssm describe-document ^ --name "AWS-RunShellScript" ^ --query "Document.Parameters[*]" Step 3: Send simple commands using the AWS-RunShellScript document Run the following command to get IP information for a Linux managed node. If you're targeting a Windows Server managed node, change the document-name to AWS- RunPowerShellScript and change the command from ifconfig to ipconfig. Linux & macOS aws ssm send-command \ --instance-ids "instance-ID"
|
systems-manager-ug-255
|
systems-manager-ug.pdf
| 255 |
"[Document.Name,Document.Description]" Windows aws ssm describe-document ^ --name "AWS-RunShellScript" ^ --query "[Document.Name,Document.Description]" Run the following command to view the available parameters and details about those parameters. Linux & macOS aws ssm describe-document \ --name "AWS-RunShellScript" \ --query "Document.Parameters[*]" Windows aws ssm describe-document ^ --name "AWS-RunShellScript" ^ --query "Document.Parameters[*]" Step 3: Send simple commands using the AWS-RunShellScript document Run the following command to get IP information for a Linux managed node. If you're targeting a Windows Server managed node, change the document-name to AWS- RunPowerShellScript and change the command from ifconfig to ipconfig. Linux & macOS aws ssm send-command \ --instance-ids "instance-ID" \ --document-name "AWS-RunShellScript" \ --comment "IP config" \ --parameters commands=ifconfig \ --output text Run Command 807 AWS Systems Manager Windows User Guide aws ssm send-command ^ --instance-ids "instance-ID" ^ --document-name "AWS-RunShellScript" ^ --comment "IP config" ^ --parameters commands=ifconfig ^ --output text Get command information with response data The following command uses the Command ID that was returned from the previous command to get the details and response data of the command execution. The system returns the response data if the command completed. If the command execution shows "Pending" or "InProgress" you run this command again to see the response data. Linux & macOS aws ssm list-command-invocations \ --command-id $sh-command-id \ --details Windows aws ssm list-command-invocations ^ --command-id $sh-command-id ^ --details Identify user The following command displays the default user running the commands. Linux & macOS sh_command_id=$(aws ssm send-command \ --instance-ids "instance-ID" \ --document-name "AWS-RunShellScript" \ --comment "Demo run shell script on Linux managed node" \ --parameters commands=whoami \ --output text \ Run Command 808 AWS Systems Manager User Guide --query "Command.CommandId") Get command status The following command uses the Command ID to get the status of the command execution on the managed node. This example uses the Command ID that was returned in the previous command. Linux & macOS aws ssm list-commands \ --command-id "command-ID" Windows aws ssm list-commands ^ --command-id "command-ID" Get command details The following command uses the Command ID from the previous command to get the status of the command execution on a per managed node basis. Linux & macOS aws ssm list-command-invocations \ --command-id "command-ID" \ --details Windows aws ssm list-command-invocations ^ --command-id "command-ID" ^ --details Get command information with response data for a specific managed node The following command returns the output of the original aws ssm send-command request for a specific managed node. Run Command 809 User Guide AWS Systems Manager Linux & macOS aws ssm list-command-invocations \ --instance-id instance-ID \ --command-id "command-ID" \ --details Windows aws ssm list-command-invocations ^ --instance-id instance-ID ^ --command-id "command-ID" ^ --details Display Python version The following command returns the version of Python running on a node. Linux & macOS sh_command_id=$(aws ssm send-command \ --instance-ids "instance-ID" \ --document-name "AWS-RunShellScript" \ --comment "Demo run shell script on Linux Instances" \ --parameters commands='python -V' \ --output text --query "Command.CommandId") \ sh -c 'aws ssm list-command-invocations \ --command-id "$sh_command_id" \ --details \ --query "CommandInvocations[].CommandPlugins[].{Status:Status,Output:Output}"' Step 4: Run a simple Python script using Run Command The following command runs a simple Python "Hello World" script using Run Command. Linux & macOS sh_command_id=$(aws ssm send-command \ --instance-ids "instance-ID" \ --document-name "AWS-RunShellScript" \ Run Command 810 AWS Systems Manager User Guide --comment "Demo run shell script on Linux Instances" \ --parameters '{"commands":["#!/usr/bin/python","print \"Hello World from python \""]}' \ --output text \ --query "Command.CommandId") \ sh -c 'aws ssm list-command-invocations \ --command-id "$sh_command_id" \ --details \ --query "CommandInvocations[].CommandPlugins[].{Status:Status,Output:Output}"' Step 5: Run a Bash script using Run Command The examples in this section demonstrate how to run the following bash script using Run Command. For examples of using Run Command to run scripts stored in remote locations, see Running scripts from Amazon S3 and Running scripts from GitHub. #!/bin/bash yum -y update yum install -y ruby cd /home/ec2-user curl -O https://aws-codedeploy-us-east-2.s3.amazonaws.com/latest/install chmod +x ./install ./install auto This script installs the AWS CodeDeploy agent on Amazon Linux and Red Hat Enterprise Linux (RHEL) instances, as described in Create an Amazon EC2 instance for CodeDeploy in the AWS CodeDeploy User Guide. The script installs the CodeDeploy agent from an AWS managed S3 bucket in thee US East (Ohio) Region (us-east-2), aws-codedeploy-us-east-2. Run a bash script in an AWS CLI command The following sample demonstrates how to include the bash script in a CLI command using the -- parameters option. Linux & macOS aws ssm send-command \ Run Command 811 AWS Systems Manager User Guide --document-name "AWS-RunShellScript" \ --targets '[{"Key":"InstanceIds","Values":["instance-id"]}]' \ --parameters '{"commands":["#!/bin/bash","yum -y update","yum install -y ruby","cd /home/ec2-user","curl -O https://aws-codedeploy-us- east-2.s3.amazonaws.com/latest/install","chmod +x ./install","./install auto"]}' Run a bash script in a JSON file In the following example, the content of the bash script is stored in a JSON file, and the file is included in the command using the --cli-input-json option. Linux & macOS aws ssm send-command \ --document-name "AWS-RunShellScript"
|
systems-manager-ug-256
|
systems-manager-ug.pdf
| 256 |
command The following sample demonstrates how to include the bash script in a CLI command using the -- parameters option. Linux & macOS aws ssm send-command \ Run Command 811 AWS Systems Manager User Guide --document-name "AWS-RunShellScript" \ --targets '[{"Key":"InstanceIds","Values":["instance-id"]}]' \ --parameters '{"commands":["#!/bin/bash","yum -y update","yum install -y ruby","cd /home/ec2-user","curl -O https://aws-codedeploy-us- east-2.s3.amazonaws.com/latest/install","chmod +x ./install","./install auto"]}' Run a bash script in a JSON file In the following example, the content of the bash script is stored in a JSON file, and the file is included in the command using the --cli-input-json option. Linux & macOS aws ssm send-command \ --document-name "AWS-RunShellScript" \ --targets "Key=InstanceIds,Values=instance-id" \ --cli-input-json file://installCodeDeployAgent.json Windows aws ssm send-command ^ --document-name "AWS-RunShellScript" ^ --targets "Key=InstanceIds,Values=instance-id" ^ --cli-input-json file://installCodeDeployAgent.json The contents of the referenced installCodeDeployAgent.json file is shown in the following example. { "Parameters": { "commands": [ "#!/bin/bash", "yum -y update", "yum install -y ruby", "cd /home/ec2-user", "curl -O https://aws-codedeploy-us-east-2.s3.amazonaws.com/latest/install", "chmod +x ./install", "./install auto" ] } Run Command 812 AWS Systems Manager } User Guide Walkthrough: Use the AWS Tools for Windows PowerShell with Run Command The following examples show how to use the AWS Tools for Windows PowerShell to view information about commands and command parameters, how to run commands, and how to view the status of those commands. This walkthrough includes an example for each of the pre-defined AWS Systems Manager documents. Important Only trusted administrators should be allowed to use Systems Manager pre-configured documents shown in this topic. The commands or scripts specified in Systems Manager documents run with administrative permission on your managed nodes. If a user has permission to run any of the predefined Systems Manager documents (any document that begins with AWS), then that user also has administrator access to the node. For all other users, you should create restrictive documents and share them with specific users. Topics • Configure AWS Tools for Windows PowerShell session settings • List all available documents • Run PowerShell commands or scripts • Install an application using the AWS-InstallApplication document • Install a PowerShell module using the AWS-InstallPowerShellModule JSON document • Join a managed node to a Domain using the AWS-JoinDirectoryServiceDomain JSON document • Send Windows metrics to Amazon CloudWatch Logs using the AWS-ConfigureCloudWatch document • Update EC2Config using the AWS-UpdateEC2Config document • Turn on or turn off Windows automatic update using the AWS-ConfigureWindowsUpdate document • Manage Windows updates using Run Command Configure AWS Tools for Windows PowerShell session settings Specify your credentials Run Command 813 AWS Systems Manager User Guide Open Tools for Windows PowerShell on your local computer and run the following command to specify your credentials. You must either have administrator permissions on the managed nodes you want to configure or you must have been granted the appropriate permission in AWS Identity and Access Management (IAM). For more information, see Setting up managed nodes for AWS Systems Manager. Set-AWSCredentials –AccessKey key-name –SecretKey key-name Set a default AWS Region Run the following command to set the region for your PowerShell session. The example uses the US East (Ohio) Region (us-east-2). Run Command is available in the AWS Regions listed in Systems Manager service endpoints in the Amazon Web Services General Reference. Set-DefaultAWSRegion ` -Region us-east-2 List all available documents This command lists all documents available for your account. Get-SSMDocumentList Run PowerShell commands or scripts Using Run Command and the AWS-RunPowerShell document, you can run any command or script on a managed node as if you were logged on locally. You can issue commands or enter a path to a local script to run the command. Note For information about rebooting managed nodes when using Run Command to call scripts, see Handling reboots when running commands. View the description and available parameters Get-SSMDocumentDescription ` -Name "AWS-RunPowerShellScript" Run Command 814 AWS Systems Manager User Guide View more information about parameters Get-SSMDocumentDescription ` -Name "AWS-RunPowerShellScript" | Select -ExpandProperty Parameters Send a command using the AWS-RunPowerShellScript document The following command shows the contents of the "C:\Users" directory and the contents of the "C:\" directory on two managed nodes. $runPSCommand = Send-SSMCommand ` -InstanceIds @("instance-ID-1", "instance-ID-2") ` -DocumentName "AWS-RunPowerShellScript" ` -Comment "Demo AWS-RunPowerShellScript with two instances" ` -Parameter @{'commands'=@('dir C:\Users', 'dir C:\')} Get command request details The following command uses the CommandId to get the status of the command execution on both managed nodes. This example uses the CommandId that was returned in the previous command. Get-SSMCommand ` -CommandId $runPSCommand.CommandId The status of the command in this example can be Success, Pending, or InProgress. Get command information per managed node The following command uses the CommandId from the previous command to get the status of the command execution on a per managed node basis. Get-SSMCommandInvocation ` -CommandId $runPSCommand.CommandId Get command information with response data for a specific managed node The following command returns the output of the original Send-SSMCommand for
|
systems-manager-ug-257
|
systems-manager-ug.pdf
| 257 |
the CommandId to get the status of the command execution on both managed nodes. This example uses the CommandId that was returned in the previous command. Get-SSMCommand ` -CommandId $runPSCommand.CommandId The status of the command in this example can be Success, Pending, or InProgress. Get command information per managed node The following command uses the CommandId from the previous command to get the status of the command execution on a per managed node basis. Get-SSMCommandInvocation ` -CommandId $runPSCommand.CommandId Get command information with response data for a specific managed node The following command returns the output of the original Send-SSMCommand for a specific managed node. Get-SSMCommandInvocation ` -CommandId $runPSCommand.CommandId ` -Details $true ` Run Command 815 AWS Systems Manager User Guide -InstanceId instance-ID | Select -ExpandProperty CommandPlugins Cancel a command The following command cancels the Send-SSMCommand for the AWS-RunPowerShellScript document. $cancelCommand = Send-SSMCommand ` -InstanceIds @("instance-ID-1","instance-ID-2") ` -DocumentName "AWS-RunPowerShellScript" ` -Comment "Demo AWS-RunPowerShellScript with two instances" ` -Parameter @{'commands'='Start-Sleep –Seconds 120; dir C:\'} Stop-SSMCommand -CommandId $cancelCommand.CommandId Check the command status The following command checks the status of the Cancel command. Get-SSMCommand ` -CommandId $cancelCommand.CommandId Install an application using the AWS-InstallApplication document Using Run Command and the AWS-InstallApplication document, you can install, repair, or uninstall applications on managed nodes. The command requires the path or address to an MSI. Note For information about rebooting managed nodes when using Run Command to call scripts, see Handling reboots when running commands. View the description and available parameters Get-SSMDocumentDescription ` -Name "AWS-InstallApplication" View more information about parameters Get-SSMDocumentDescription ` Run Command 816 AWS Systems Manager User Guide -Name "AWS-InstallApplication" | Select -ExpandProperty Parameters Send a command using the AWS-InstallApplication document The following command installs a version of Python on your managed node in unattended mode, and logs the output to a local text file on your C: drive. $installAppCommand = Send-SSMCommand ` -InstanceId instance-ID ` -DocumentName "AWS-InstallApplication" ` -Parameter @{'source'='https://www.python.org/ftp/python/2.7.9/python-2.7.9.msi'; 'parameters'='/norestart /quiet /log c:\pythoninstall.txt'} Get command information per managed node The following command uses the CommandId to get the status of the command execution. Get-SSMCommandInvocation ` -CommandId $installAppCommand.CommandId ` -Details $true Get command information with response data for a specific managed node The following command returns the results of the Python installation. Get-SSMCommandInvocation ` -CommandId $installAppCommand.CommandId ` -Details $true ` -InstanceId instance-ID | Select -ExpandProperty CommandPlugins Install a PowerShell module using the AWS-InstallPowerShellModule JSON document You can use Run Command to install PowerShell modules on managed nodes. For more information about PowerShell modules, see Windows PowerShell Modules. View the description and available parameters Get-SSMDocumentDescription ` -Name "AWS-InstallPowerShellModule" View more information about parameters Run Command 817 AWS Systems Manager User Guide Get-SSMDocumentDescription ` -Name "AWS-InstallPowerShellModule" | Select -ExpandProperty Parameters Install a PowerShell module The following command downloads the EZOut.zip file, installs it, and then runs an additional command to install XPS viewer. Lastly, the output of this command is uploaded to an S3 bucket named "amzn-s3-demo-bucket". $installPSCommand = Send-SSMCommand ` -InstanceId instance-ID ` -DocumentName "AWS-InstallPowerShellModule" ` -Parameter @{'source'='https://gallery.technet.microsoft.com/EZOut-33ae0fb7/ file/110351/1/EZOut.zip';'commands'=@('Add-WindowsFeature -name XPS-Viewer -restart')} ` -OutputS3BucketName amzn-s3-demo-bucket Get command information per managed node The following command uses the CommandId to get the status of the command execution. Get-SSMCommandInvocation ` -CommandId $installPSCommand.CommandId ` -Details $true Get command information with response data for the managed node The following command returns the output of the original Send-SSMCommand for the specific CommandId. Get-SSMCommandInvocation ` -CommandId $installPSCommand.CommandId ` -Details $true | Select -ExpandProperty CommandPlugins Join a managed node to a Domain using the AWS-JoinDirectoryServiceDomain JSON document Using Run Command, you can quickly join a managed node to an AWS Directory Service domain. Before executing this command, create a directory. We also recommend that you learn more about the AWS Directory Service. For more information, see the AWS Directory Service Administration Guide. Run Command 818 AWS Systems Manager User Guide You can only join a managed node to a domain. You can't remove a node from a domain. Note For information about managed nodes when using Run Command to call scripts, see Handling reboots when running commands. View the description and available parameters Get-SSMDocumentDescription ` -Name "AWS-JoinDirectoryServiceDomain" View more information about parameters Get-SSMDocumentDescription ` -Name "AWS-JoinDirectoryServiceDomain" | Select -ExpandProperty Parameters Join a managed node to a domain The following command joins a managed node to the given AWS Directory Service domain and uploads any generated output to the example Amazon Simple Storage Service (Amazon S3) bucket. $domainJoinCommand = Send-SSMCommand ` -InstanceId instance-ID ` -DocumentName "AWS-JoinDirectoryServiceDomain" ` -Parameter @{'directoryId'='d-example01'; 'directoryName'='ssm.example.com'; 'dnsIpAddresses'=@('192.168.10.195', '192.168.20.97')} ` -OutputS3BucketName amzn-s3-demo-bucket Get command information per managed node The following command uses the CommandId to get the status of the command execution. Get-SSMCommandInvocation ` -CommandId $domainJoinCommand.CommandId ` -Details $true Get command information with response data for the managed node Run Command 819 AWS Systems Manager User Guide This command returns the output of the original Send-SSMCommand for the specific CommandId. Get-SSMCommandInvocation `
|
systems-manager-ug-258
|
systems-manager-ug.pdf
| 258 |
to the given AWS Directory Service domain and uploads any generated output to the example Amazon Simple Storage Service (Amazon S3) bucket. $domainJoinCommand = Send-SSMCommand ` -InstanceId instance-ID ` -DocumentName "AWS-JoinDirectoryServiceDomain" ` -Parameter @{'directoryId'='d-example01'; 'directoryName'='ssm.example.com'; 'dnsIpAddresses'=@('192.168.10.195', '192.168.20.97')} ` -OutputS3BucketName amzn-s3-demo-bucket Get command information per managed node The following command uses the CommandId to get the status of the command execution. Get-SSMCommandInvocation ` -CommandId $domainJoinCommand.CommandId ` -Details $true Get command information with response data for the managed node Run Command 819 AWS Systems Manager User Guide This command returns the output of the original Send-SSMCommand for the specific CommandId. Get-SSMCommandInvocation ` -CommandId $domainJoinCommand.CommandId ` -Details $true | Select -ExpandProperty CommandPlugins Send Windows metrics to Amazon CloudWatch Logs using the AWS-ConfigureCloudWatch document You can send Windows Server messages in the application, system, security, and Event Tracing for Windows (ETW) logs to Amazon CloudWatch Logs. When you allow logging for the first time, Systems Manager sends all logs generated within one (1) minute from the time that you start uploading logs for the application, system, security, and ETW logs. Logs that occurred before this time aren't included. If you turn off logging and then later turn logging back on, Systems Manager sends logs from the time it left off. For any custom log files and Internet Information Services (IIS) logs, Systems Manager reads the log files from the beginning. In addition, Systems Manager can also send performance counter data to CloudWatch Logs. If you previously turned on CloudWatch integration in EC2Config, the Systems Manager settings override any settings stored locally on the managed node in the C:\Program Files\Amazon \EC2ConfigService\Settings\AWS.EC2.Windows.CloudWatch.json file. For more information about using EC2Config to manage performance counters and logs on a single managed node, see Collecting metrics and logs from Amazon EC2 instances and on-premises servers with the CloudWatch agent in the Amazon CloudWatch User Guide. View the description and available parameters Get-SSMDocumentDescription ` -Name "AWS-ConfigureCloudWatch" View more information about parameters Get-SSMDocumentDescription ` -Name "AWS-ConfigureCloudWatch" | Select -ExpandProperty Parameters Send application logs to CloudWatch The following command configures the managed node and moves Windows Applications logs to CloudWatch. Run Command 820 AWS Systems Manager User Guide $cloudWatchCommand = Send-SSMCommand ` -InstanceID instance-ID ` -DocumentName "AWS-ConfigureCloudWatch" ` -Parameter @{'properties'='{"engineConfiguration": {"PollInterval":"00:00:15", "Components":[{"Id":"ApplicationEventLog", "FullName":"AWS.EC2.Windows.CloudWatch.EventLog.EventLogInputComponent,AWS.EC2.Windows.CloudWatch", "Parameters":{"LogName":"Application", "Levels":"7"}},{"Id":"CloudWatch", "FullName":"AWS.EC2.Windows.CloudWatch.CloudWatchLogsOutput,AWS.EC2.Windows.CloudWatch", "Parameters":{"Region":"region", "LogGroup":"my-log-group", "LogStream":"instance- id"}}], "Flows":{"Flows":["ApplicationEventLog,CloudWatch"]}}}'} Get command information per managed node The following command uses the CommandId to get the status of the command execution. Get-SSMCommandInvocation ` -CommandId $cloudWatchCommand.CommandId ` -Details $true Get command information with response data for a specific managed node The following command returns the results of the Amazon CloudWatch configuration. Get-SSMCommandInvocation ` -CommandId $cloudWatchCommand.CommandId ` -Details $true ` -InstanceId instance-ID | Select -ExpandProperty CommandPlugins Send performance counters to CloudWatch using the AWS-ConfigureCloudWatch document The following demonstration command uploads performance counters to CloudWatch. For more information, see the Amazon CloudWatch User Guide. $cloudWatchMetricsCommand = Send-SSMCommand ` -InstanceID instance-ID ` -DocumentName "AWS-ConfigureCloudWatch" ` -Parameter @{'properties'='{"engineConfiguration": {"PollInterval":"00:00:15", "Components":[{"Id":"PerformanceCounter", "FullName":"AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch", "Parameters":{"CategoryName":"Memory", "CounterName":"Available MBytes", "InstanceName":"", "MetricName":"AvailableMemory", "Unit":"Megabytes","DimensionName":"", "DimensionValue":""}},{"Id":"CloudWatch", Run Command 821 AWS Systems Manager User Guide "FullName":"AWS.EC2.Windows.CloudWatch.CloudWatch.CloudWatchOutputComponent,AWS.EC2.Windows.CloudWatch", "Parameters":{"AccessKey":"", "SecretKey":"","Region":"region", "NameSpace":"Windows- Default"}}], "Flows":{"Flows":["PerformanceCounter,CloudWatch"]}}}'} Update EC2Config using the AWS-UpdateEC2Config document Using Run Command and the AWS-EC2ConfigUpdate document, you can update the EC2Config service running on your Windows Server managed nodes. This command can update the EC2Config service to the latest version or a version you specify. View the description and available parameters Get-SSMDocumentDescription ` -Name "AWS-UpdateEC2Config" View more information about parameters Get-SSMDocumentDescription ` -Name "AWS-UpdateEC2Config" | Select -ExpandProperty Parameters Update EC2Config to the latest version $ec2ConfigCommand = Send-SSMCommand ` -InstanceId instance-ID ` -DocumentName "AWS-UpdateEC2Config" Get command information with response data for the managed node This command returns the output of the specified command from the previous Send- SSMCommand. Get-SSMCommandInvocation ` -CommandId $ec2ConfigCommand.CommandId ` -Details $true ` -InstanceId instance-ID | Select -ExpandProperty CommandPlugins Update EC2Config to a specific version The following command downgrades EC2Config to an older version. Send-SSMCommand ` Run Command 822 AWS Systems Manager User Guide -InstanceId instance-ID ` -DocumentName "AWS-UpdateEC2Config" ` -Parameter @{'version'='4.9.3519'; 'allowDowngrade'='true'} Turn on or turn off Windows automatic update using the AWS-ConfigureWindowsUpdate document Using Run Command and the AWS-ConfigureWindowsUpdate document, you can turn on or turn off automatic Windows updates on your Windows Server managed nodes. This command configures the Windows Update Agent to download and install Windows updates on the day and hour that you specify. If an update requires a reboot, the managed node reboots automatically 15 minutes after updates have been installed. With this command you can also configure Windows Update to check for updates but not install them. The AWS-ConfigureWindowsUpdate document is compatible with Windows Server 2008, 2008 R2, 2012, 2012 R2, and 2016. View the description and available parameters Get-SSMDocumentDescription ` –Name "AWS-ConfigureWindowsUpdate" View more information about parameters Get-SSMDocumentDescription ` -Name "AWS-ConfigureWindowsUpdate" | Select -ExpandProperty Parameters Turn on Windows automatic update The following command configures Windows Update to automatically
|
systems-manager-ug-259
|
systems-manager-ug.pdf
| 259 |
download and install Windows updates on the day and hour that you specify. If an update requires a reboot, the managed node reboots automatically 15 minutes after updates have been installed. With this command you can also configure Windows Update to check for updates but not install them. The AWS-ConfigureWindowsUpdate document is compatible with Windows Server 2008, 2008 R2, 2012, 2012 R2, and 2016. View the description and available parameters Get-SSMDocumentDescription ` –Name "AWS-ConfigureWindowsUpdate" View more information about parameters Get-SSMDocumentDescription ` -Name "AWS-ConfigureWindowsUpdate" | Select -ExpandProperty Parameters Turn on Windows automatic update The following command configures Windows Update to automatically download and install updates daily at 10:00 PM. $configureWindowsUpdateCommand = Send-SSMCommand ` -InstanceId instance-ID ` -DocumentName "AWS-ConfigureWindowsUpdate" ` -Parameters @{'updateLevel'='InstallUpdatesAutomatically'; 'scheduledInstallDay'='Daily'; 'scheduledInstallTime'='22:00'} View command status for allowing Windows automatic update The following command uses the CommandId to get the status of the command execution for allowing Windows automatic update. Run Command 823 AWS Systems Manager User Guide Get-SSMCommandInvocation ` -Details $true ` -CommandId $configureWindowsUpdateCommand.CommandId | Select -ExpandProperty CommandPlugins Turn off Windows automatic update The following command lowers the Windows Update notification level so the system checks for updates but doesn't automatically update the managed node. $configureWindowsUpdateCommand = Send-SSMCommand ` -InstanceId instance-ID ` -DocumentName "AWS-ConfigureWindowsUpdate" ` -Parameters @{'updateLevel'='NeverCheckForUpdates'} View command status for turning off Windows automatic update The following command uses the CommandId to get the status of the command execution for turning off Windows automatic update. Get-SSMCommandInvocation ` -Details $true ` -CommandId $configureWindowsUpdateCommand.CommandId | Select -ExpandProperty CommandPlugins Manage Windows updates using Run Command Using Run Command and the AWS-InstallWindowsUpdates document, you can manage updates for Windows Server managed nodes. This command scans for or installs missing updates on your managed nodes and optionally reboots following installation. You can also specify the appropriate classifications and severity levels for updates to install in your environment. Note For information about rebooting managed nodes when using Run Command to call scripts, see Handling reboots when running commands. The following examples demonstrate how to perform the specified Windows Update management tasks. Run Command 824 AWS Systems Manager User Guide Search for all missing Windows updates Send-SSMCommand ` -InstanceId instance-ID ` -DocumentName "AWS-InstallWindowsUpdates" ` -Parameters @{'Action'='Scan'} Install specific Windows updates Send-SSMCommand ` -InstanceId instance-ID ` -DocumentName "AWS-InstallWindowsUpdates" ` -Parameters @{'Action'='Install';'IncludeKbs'='kb-ID-1,kb-ID-2,kb- ID-3';'AllowReboot'='True'} Install important missing Windows updates Send-SSMCommand ` -InstanceId instance-ID ` -DocumentName "AWS-InstallWindowsUpdates" ` -Parameters @{'Action'='Install';'SeverityLevels'='Important';'AllowReboot'='True'} Install missing Windows updates with specific exclusions Send-SSMCommand ` -InstanceId instance-ID ` -DocumentName "AWS-InstallWindowsUpdates" ` -Parameters @{'Action'='Install';'ExcludeKbs'='kb-ID-1,kb- ID-2';'AllowReboot'='True'} Troubleshooting Systems Manager Run Command Run Command, a tool in AWS Systems Manager, provides status details with each command execution. For more information about the details of command statuses, see Understanding command statuses. You can also use the information in this topic to help troubleshoot problems with Run Command. Topics • Some of my managed nodes are missing • A step in my script failed, but the overall status is 'succeeded' Run Command 825 AWS Systems Manager User Guide • SSM Agent isn't running properly Some of my managed nodes are missing In the Run a command page, after you choose an SSM document to run and select Manually selecting instances in the Targets section, a list is displayed of managed nodes you can choose to run the command on. If a managed node you expect to see isn't listed, see Troubleshooting managed node availability for troubleshooting tips. After you create, activate, reboot, or restart a managed node, install Run Command on a node, or attach an AWS Identity and Access Management (IAM) instance profile to a node, it can take a few minutes for the managed node to be added to the list. A step in my script failed, but the overall status is 'succeeded' Using Run Command, you can define how your scripts handle exit codes. By default, the exit code of the last command run in a script is reported as the exit code for the entire script. You can, however, include a conditional statement to exit the script if any command before the final one fails. For information and examples, see Specify exit codes in commands. SSM Agent isn't running properly If you experience problems running commands using Run Command, there might be a problem with the SSM Agent. For information about investigating issues with SSM Agent, see Troubleshooting SSM Agent. AWS Systems Manager Session Manager Session Manager is a fully managed AWS Systems Manager tool. With Session Manager, you can manage your Amazon Elastic Compute Cloud (Amazon EC2) instances, edge devices, on-premises servers, and virtual machines (VMs). You can use either an interactive one-click browser-based shell or the AWS Command Line Interface (AWS CLI). Session Manager provides secure node management without the need to open inbound ports, maintain bastion hosts, or manage SSH keys. Session Manager also allows you to comply with corporate policies that require controlled
|
systems-manager-ug-260
|
systems-manager-ug.pdf
| 260 |
Agent. For information about investigating issues with SSM Agent, see Troubleshooting SSM Agent. AWS Systems Manager Session Manager Session Manager is a fully managed AWS Systems Manager tool. With Session Manager, you can manage your Amazon Elastic Compute Cloud (Amazon EC2) instances, edge devices, on-premises servers, and virtual machines (VMs). You can use either an interactive one-click browser-based shell or the AWS Command Line Interface (AWS CLI). Session Manager provides secure node management without the need to open inbound ports, maintain bastion hosts, or manage SSH keys. Session Manager also allows you to comply with corporate policies that require controlled access to managed nodes, strict security practices, and logs with node access details, while providing end users with simple one-click cross-platform access to your managed nodes. To get started with Session Manager, open the Systems Manager console. In the navigation pane, choose Session Manager. Session Manager 826 AWS Systems Manager User Guide How can Session Manager benefit my organization? Session Manager offers these benefits: • Centralized access control to managed nodes using IAM policies Administrators have a single place to grant and revoke access to managed nodes. Using only AWS Identity and Access Management (IAM) policies, you can control which individual users or groups in your organization can use Session Manager and which managed nodes they can access. • No open inbound ports and no need to manage bastion hosts or SSH keys Leaving inbound SSH ports and remote PowerShell ports open on your managed nodes greatly increases the risk of entities running unauthorized or malicious commands on the managed nodes. Session Manager helps you improve your security posture by letting you close these inbound ports, freeing you from managing SSH keys and certificates, bastion hosts, and jump boxes. • One-click access to managed nodes from the console and CLI Using the AWS Systems Manager console or Amazon EC2 console, you can start a session with a single click. Using the AWS CLI, you can also start a session that runs a single command or a sequence of commands. Because permissions to managed nodes are provided through IAM policies instead of SSH keys or other mechanisms, the connection time is greatly reduced. • Connect to both Amazon EC2 instances and non-EC2 managed nodes in hybrid and multicloud environments You can connect to both Amazon Elastic Compute Cloud (Amazon EC2) instances and non-EC2 nodes in your hybrid and multicloud environment. To connect to non-EC2 nodes using Session Manager, you must first activate the advanced- instances tier. There is a charge to use the advanced-instances tier. However, there is no additional charge to connect to EC2 instances using Session Manager. For information, see Configuring instance tiers. • Port forwarding Redirect any port inside your managed node to a local port on a client. After that, connect to the local port and access the server application that is running inside the node. • Cross-platform support for Windows, Linux, and macOS Session Manager 827 AWS Systems Manager User Guide Session Manager provides support for Windows, Linux, and macOS from a single tool. For example, you don't need to use an SSH client for Linux and macOS managed nodes or an RDP connection for Windows Server managed nodes. • Logging session activity To meet operational or security requirements in your organization, you might need to provide a record of the connections made to your managed nodes and the commands that were run on them. You can also receive notifications when a user in your organization starts or ends session activity. Logging capabilities are provided through integration with the following AWS services: • AWS CloudTrail – AWS CloudTrail captures information about Session Manager API calls made in your AWS account and writes it to log files that are stored in an Amazon Simple Storage Service (Amazon S3) bucket you specify. One bucket is used for all CloudTrail logs for your account. For more information, see Logging AWS Systems Manager API calls with AWS CloudTrail. • Amazon Simple Storage Service – You can choose to store session log data in an Amazon S3 bucket of your choice for debugging and troubleshooting purposes. Log data can be sent to your Amazon S3 bucket with or without encryption using your AWS KMS key. For more information, see Logging session data using Amazon S3 (console). • Amazon CloudWatch Logs – CloudWatch Logs allows you to monitor, store, and access log files from various AWS services. You can send session log data to a CloudWatch Logs log group for debugging and troubleshooting purposes. Log data can be sent to your log group with or without AWS KMS encryption using your KMS key. For more information, see Logging session data using Amazon CloudWatch Logs (console). • Amazon EventBridge and Amazon Simple Notification Service – EventBridge allows you to set up rules to
|
systems-manager-ug-261
|
systems-manager-ug.pdf
| 261 |
your AWS KMS key. For more information, see Logging session data using Amazon S3 (console). • Amazon CloudWatch Logs – CloudWatch Logs allows you to monitor, store, and access log files from various AWS services. You can send session log data to a CloudWatch Logs log group for debugging and troubleshooting purposes. Log data can be sent to your log group with or without AWS KMS encryption using your KMS key. For more information, see Logging session data using Amazon CloudWatch Logs (console). • Amazon EventBridge and Amazon Simple Notification Service – EventBridge allows you to set up rules to detect when changes happen to AWS resources that you specify. You can create a rule to detect when a user in your organization starts or stops a session, and then receive a notification through Amazon SNS (for example, a text or email message) about the event. You can also configure a CloudWatch event to initiate other responses. For more information, see Monitoring session activity using Amazon EventBridge (console). Session Manager 828 AWS Systems Manager Note User Guide Logging isn't available for Session Manager sessions that connect through port forwarding or SSH. This is because SSH encrypts all session data, and Session Manager only serves as a tunnel for SSH connections. Who should use Session Manager? • Any AWS customer who wants to improve their security posture, reduce operational overhead by centralizing access control on managed nodes, and reduce inbound node access. • Information Security experts who want to monitor and track managed node access and activity, close down inbound ports on managed nodes, or allow connections to managed nodes that don't have a public IP address. • Administrators who want to grant and revoke access from a single location, and who want to provide one solution to users for Linux, macOS, and Windows Server managed nodes. • Users who want to connect to a managed node with just one click from the browser or AWS CLI without having to provide SSH keys. What are the main features of Session Manager? • Support for Windows Server, Linux and macOS managed nodes Session Manager enables you to establish secure connections to your Amazon Elastic Compute Cloud (EC2) instances, edge devices, on-premises servers, and virtual machines (VMs). For a list of supported operating system types, see Setting up Session Manager. Note Session Manager support for on-premises machines is provided for the advanced- instances tier only. For information, see Turning on the advanced-instances tier. • Console, CLI, and SDK access to Session Manager capabilities You can work with Session Manager in the following ways: Session Manager 829 AWS Systems Manager User Guide The AWS Systems Manager console includes access to all the Session Manager capabilities for both administrators and end users. You can perform any task that is related to your sessions by using the Systems Manager console. The Amazon EC2 console provides the ability for end users to connect to EC2 instances for which they have been granted session permissions. The AWS CLI includes access to Session Manager capabilities for end users. You can start a session, view a list of sessions, and permanently end a session by using the AWS CLI. Note To use the AWS CLI to run session commands, you must be using version 1.16.12 of the CLI (or later), and you must have installed the Session Manager plugin on your local machine. For information, see Install the Session Manager plugin for the AWS CLI. To view the plugin on GitHub, see session-manager-plugin. • IAM access control Through the use of IAM policies, you can control which members of your organization can initiate sessions to managed nodes and which nodes they can access. You can also provide temporary access to your managed nodes. For example, you might want to give an on-call engineer (or a group of on-call engineers) access to production servers only for the duration of their rotation. • Logging support Session Manager provide you with options for logging session histories in your AWS account through integration with a number of other AWS services. For more information, see Logging session activity and Enabling and disabling session logging. • Configurable shell profiles Session Manager provides you with options to configure preferences within sessions. These customizable profiles allow you to define preferences such as shell preferences, environment variables, working directories, and running multiple commands when a session is started. • Customer key data encryption support You can configure Session Manager to encrypt the session data logs that you send to an Amazon Simple Storage Service (Amazon S3) bucket or stream to a CloudWatch Logs log group. You can also configure Session Manager to further encrypt the data transmitted between client machines Session Manager 830 AWS Systems Manager User Guide and your managed nodes during your sessions. For information, see Enabling
|
systems-manager-ug-262
|
systems-manager-ug.pdf
| 262 |
configure preferences within sessions. These customizable profiles allow you to define preferences such as shell preferences, environment variables, working directories, and running multiple commands when a session is started. • Customer key data encryption support You can configure Session Manager to encrypt the session data logs that you send to an Amazon Simple Storage Service (Amazon S3) bucket or stream to a CloudWatch Logs log group. You can also configure Session Manager to further encrypt the data transmitted between client machines Session Manager 830 AWS Systems Manager User Guide and your managed nodes during your sessions. For information, see Enabling and disabling session logging and Configure session preferences. • AWS PrivateLink support for managed nodes without public IP addresses You can also set up VPC Endpoints for Systems Manager using AWS PrivateLink to further secure your sessions. AWS PrivateLink limits all network traffic between your managed nodes, Systems Manager, and Amazon EC2 to the Amazon network. For more information, see Improve the security of EC2 instances by using VPC endpoints for Systems Manager. • Tunneling In a session, use a Session-type AWS Systems Manager (SSM) document to tunnel traffic, such as http or a custom protocol, between a local port on a client machine and a remote port on a managed node. • Interactive commands Create a Session-type SSM document that uses a session to interactively run a single command, giving you a way to manage what users can do on a managed node. What is a session? A session is a connection made to a managed node using Session Manager. Sessions are based on a secure bi-directional communication channel between the client (you) and the remote managed node that streams inputs and outputs for commands. Traffic between a client and a managed node is encrypted using TLS 1.2, and requests to create the connection are signed using Sigv4. This two- way communication allows interactive bash and PowerShell access to managed nodes. You can also use an AWS Key Management Service (AWS KMS) key to further encrypt data beyond the default TLS encryption. For example, say that John is an on-call engineer in your IT department. He receives notification of an issue that requires him to remotely connect to a managed node, such as a failure that requires troubleshooting or a directive to change a simple configuration option on a node. Using the AWS Systems Manager console, the Amazon EC2 console, or the AWS CLI, John starts a session connecting him to the managed node, runs commands on the node needed to complete the task, and then ends the session. When John sends that first command to start the session, the Session Manager service authenticates his ID, verifies the permissions granted to him by an IAM policy, checks configuration settings (such as verifying allowed limits for the sessions), and sends a message to SSM Agent Session Manager 831 AWS Systems Manager User Guide to open the two-way connection. After the connection is established and John types the next command, the command output from SSM Agent is uploaded to this communication channel and sent back to his local machine. Topics • Setting up Session Manager • Working with Session Manager • Logging session activity • Enabling and disabling session logging • Session document schema • Troubleshooting Session Manager Setting up Session Manager Before you use AWS Systems Manager Session Manager to connect to the managed nodes in your account, complete the steps in the following topics. Topics • Step 1: Complete Session Manager prerequisites • Step 2: Verify or add instance permissions for Session Manager • Step 3: Control session access to managed nodes • Step 4: Configure session preferences • Step 5: (Optional) Restrict access to commands in a session • Step 6: (Optional) Use AWS PrivateLink to set up a VPC endpoint for Session Manager • Step 7: (Optional) Turn on or turn off ssm-user account administrative permissions • Step 8: (Optional) Allow and control permissions for SSH connections through Session Manager Step 1: Complete Session Manager prerequisites Before using Session Manager, make sure your environment meets the following requirements. Session Manager 832 AWS Systems Manager Session Manager prerequisites User Guide Requirement Description Supported operating systems Session Manager supports connecting to Amazon Elastic Compute Cloud (Amazon EC2) instances, in addition to non-EC2 machines in your hybrid and multicloud environment that use the advanced-instances tier. Session Manager supports the following operating system versions: Note Session Manager supports EC2 instances, edge devices, and on- premises servers and virtual machines (VMs) in your hybrid and multicloud environment that use the advanced- instances tier. For more informati on about advanced instances, see Configuring instance tiers. Linux and macOS Session Manager supports all the versions of Linux and macOS that are supported by AWS Systems Manager. For information, see Supported operating systems and machine
|
systems-manager-ug-263
|
systems-manager-ug.pdf
| 263 |
connecting to Amazon Elastic Compute Cloud (Amazon EC2) instances, in addition to non-EC2 machines in your hybrid and multicloud environment that use the advanced-instances tier. Session Manager supports the following operating system versions: Note Session Manager supports EC2 instances, edge devices, and on- premises servers and virtual machines (VMs) in your hybrid and multicloud environment that use the advanced- instances tier. For more informati on about advanced instances, see Configuring instance tiers. Linux and macOS Session Manager supports all the versions of Linux and macOS that are supported by AWS Systems Manager. For information, see Supported operating systems and machine types. Windows Session Manager supports Windows Server 2012 through Windows Server 2022. Session Manager 833 AWS Systems Manager Requirement User Guide Description Note Microsoft Windows Server 2016 Nano isn't supported. Session Manager 834 AWS Systems Manager Requirement SSM Agent User Guide Description At minimum, AWS Systems Manager SSM Agent version 2.3.68.0 or later must be installed on the managed nodes you want to connect to through sessions. To use the option to encrypt session data using a key created in AWS Key Managemen t Service (AWS KMS), version 2.3.539.0 or later of SSM Agent must be installed on the managed node. To use shell profiles in a session, SSM Agent version 3.0.161.0 or later must be installed on the managed node. To start a Session Manager port forwarding or SSH session, SSM Agent version 3.0.222.0 or later must be installed on the managed node. To stream session data using Amazon CloudWatch Logs, SSM Agent version 3.0.284.0 or later must be installed on the managed node. For information about how to determine the version number running on an instance, see Checking the SSM Agent version number. For information about manually installing or automatically updating SSM Agent, see Working with SSM Agent. About the ssm-user account Starting with version 2.3.50.0 of SSM Agent, the agent creates a user account on the managed node, with root or administrator permissions, called ssm-user. (On versions Session Manager 835 AWS Systems Manager Requirement User Guide Description before 2.3.612.0, the account is created when SSM Agent starts or restarts. On version 2.3.612.0 and later, ssm-user is created the first time a session starts on the managed node.) Sessions are launched using the administrative credentials of this user account. For information about restricting administr ative control for this account, see Turn off or turn on ssm-user account administrative permissions. ssm-user on Windows Server domain controllers Beginning with SSM Agent version 2.3.612.0, the ssm-user account isn't created automatic ally on managed nodes that are used as Windows Server domain controllers. To use Session Manager on a Windows Server machine being used as a domain controlle r, you must create the ssm-user account manually if it isn't already present, and assign Domain Administrator permissions to the user. On Windows Server, SSM Agent sets a new password for the ssm-user account each time a session starts, so you don't need to specify a password when you create the account. Session Manager 836 AWS Systems Manager Requirement Connectivity to endpoints User Guide Description The managed nodes you connect to must also allow HTTPS (port 443) outbound traffic to the following endpoints: • ec2messages.region.amazonaws.com • ssm.region.amazonaws.com • ssmmessages.region.amazonaws.com For more information, see the following topics: • Reference: ec2messages, ssmmessages, and other API operations • How do I create VPC endpoints so that I can use Systems Manager to manage private EC2 instances without internet access? in the AWS re:Post Knowledge Center. Alternatively, you can connect to the required endpoints by using interface endpoints. For more information, see Step 6: (Optional) Use AWS PrivateLink to set up a VPC endpoint for Session Manager. Session Manager 837 AWS Systems Manager Requirement AWS CLI User Guide Description (Optional) If you use the AWS Command Line Interface (AWS CLI) to start your sessions (instead of using the AWS Systems Manager console or Amazon EC2 console), version 1.16.12 or later of the CLI must be installed on your local machine. You can call aws --version to check the version. If you need to install or upgrade the CLI, see Installing the AWS Command Line Interface in the AWS Command Line Interface User Guide. Important An updated version of SSM Agent is released whenever new tools are added to Systems Manager or updates are made to existing tools. Failing to use the latest version of the agent can prevent your managed node from using various Systems Manager tools and features. For that reason, we recommend that you automate the process of keeping SSM Agent up to date on your machines. For informati on, see Automating updates to SSM Agent. Subscribe to the SSM Agent Release Notes page on GitHub to get notifications about SSM Agent updates. Session Manager 838 AWS Systems Manager Requirement User Guide Description In addition, to
|
systems-manager-ug-264
|
systems-manager-ug.pdf
| 264 |
SSM Agent is released whenever new tools are added to Systems Manager or updates are made to existing tools. Failing to use the latest version of the agent can prevent your managed node from using various Systems Manager tools and features. For that reason, we recommend that you automate the process of keeping SSM Agent up to date on your machines. For informati on, see Automating updates to SSM Agent. Subscribe to the SSM Agent Release Notes page on GitHub to get notifications about SSM Agent updates. Session Manager 838 AWS Systems Manager Requirement User Guide Description In addition, to use the CLI to manage your nodes with Session Manager, you must first install the Session Manager plugin on your local machine. For information, see Install the Session Manager plugin for the AWS CLI. Turn on advanced-instances tier (hybrid and multicloud environments) To connect to non-EC2 machines using Session Manager, you must turn on the advanced- instances tier in the AWS account and AWS Region where you create hybrid activations to register non-EC2 machines as managed nodes. There is a charge to use the advanced- instances tier. For more information about the advanced-instance tier, see Configuring instance tiers. Session Manager 839 AWS Systems Manager Requirement Description User Guide Verify IAM service role permissions (hybrid and multicloud environments) Hybrid-activated nodes use the AWS Identity and Access Management (IAM) service role specified in the hybrid activation to communicate with Systems Manager API operations. This service role must contain the permissions required to connect to your hybrid and multicloud machines using Session Manager. If your service role contains the AWS managed policy AmazonSSMManagedIn stanceCore Session Manager are already provided. , the required permissions for If you find that the service role does not contain the required permissions, you must deregister the managed instance and register it with a new hybrid activation that uses an IAM service role with the required permissio ns. For more information about deregiste ring managed instances, see Deregistering managed nodes in a hybrid and multicloud environment. For more information about creating IAM policies with Session Manager permissions, see Step 2: Verify or add instance permissions for Session Manager. Step 2: Verify or add instance permissions for Session Manager By default, AWS Systems Manager doesn't have permission to perform actions on your instances. You can provide instance permissions at the account level using an AWS Identity and Access Management (IAM) role, or at the instance level using an instance profile. If your use case allows, we recommend granting access at the account level using the Default Host Management Configuration. If you've already set up the Default Host Management Configuration for your account using the AmazonSSMManagedEC2InstanceDefaultPolicy policy, you can proceed to the next step. For more information about the Default Host Management Configuration, see Managing EC2 instances automatically with Default Host Management Configuration. Session Manager 840 AWS Systems Manager User Guide Alternatively, you can use instance profiles to provide the required permissions to your instances. An instance profile passes an IAM role to an Amazon EC2 instance. You can attach an IAM instance profile to an Amazon EC2 instance as you launch it or to a previously launched instance. For more information, see Using instance profiles. For on-premises servers or virtual machines (VMs), permissions are provided by the IAM service role associated with the hybrid activation used to register your on-premises servers and VMs with Systems Manager. On-premises servers and VMs do not use instance profiles. If you already use other Systems Manager tools, such as Run Command or Parameter Store, an instance profile with the required basic permissions for Session Manager might already be attached to your Amazon EC2 instances. If an instance profile that contains the AWS managed policy AmazonSSMManagedInstanceCore is already attached to your instances, the required permissions for Session Manager are already provided. This is also true if the IAM service role used in your hybrid activation contains the AmazonSSMManagedInstanceCore managed policy. However, in some cases, you might need to modify the permissions attached to your instance profile. For example, you want to provide a narrower set of instance permissions, you have created a custom policy for your instance profile, or you want to use Amazon Simple Storage Service (Amazon S3) encryption or AWS Key Management Service (AWS KMS) encryption options for securing session data. For these cases, do one of the following to allow Session Manager actions to be performed on your instances: • Embed permissions for Session Manager actions in a custom IAM role To add permissions for Session Manager actions to an existing IAM role that doesn't rely on the AWS-provided default policy AmazonSSMManagedInstanceCore, follow the steps in Add Session Manager permissions to an existing IAM role. • Create a custom IAM role with Session Manager permissions only To create an IAM role that
|
systems-manager-ug-265
|
systems-manager-ug.pdf
| 265 |
Storage Service (Amazon S3) encryption or AWS Key Management Service (AWS KMS) encryption options for securing session data. For these cases, do one of the following to allow Session Manager actions to be performed on your instances: • Embed permissions for Session Manager actions in a custom IAM role To add permissions for Session Manager actions to an existing IAM role that doesn't rely on the AWS-provided default policy AmazonSSMManagedInstanceCore, follow the steps in Add Session Manager permissions to an existing IAM role. • Create a custom IAM role with Session Manager permissions only To create an IAM role that contains permissions only for Session Manager actions, follow the steps in Create a custom IAM role for Session Manager. • Create and use a new IAM role with permissions for all Systems Manager actions To create an IAM role for Systems Manager managed instances that uses a default policy supplied by AWS to grant all Systems Manager permissions, follow the steps in Configure instance permissions required for Systems Manager. Session Manager 841 AWS Systems Manager Topics • Add Session Manager permissions to an existing IAM role • Create a custom IAM role for Session Manager Add Session Manager permissions to an existing IAM role User Guide Use the following procedure to add Session Manager permissions to an existing AWS Identity and Access Management (IAM) role. By adding permissions to an existing role, you can enhance the security of your computing environment without having to use the AWS AmazonSSMManagedInstanceCore policy for instance permissions. Note Note the following information: • This procedure assumes that your existing role already includes other Systems Manager ssm permissions for actions you want to allow access to. This policy alone isn't enough to use Session Manager. • The following policy example includes an s3:GetEncryptionConfiguration action. This action is required if you chose the Enforce S3 log encryption option in Session Manager logging preferences. To add Session Manager permissions to an existing role (console) 1. Sign in to the AWS Management Console and open the IAM console at https:// console.aws.amazon.com/iam/. In the navigation pane, choose Roles. Select the name of the role that you are adding the permissions to. 2. 3. 4. Choose the Permissions tab. 5. Choose Add permissions, and then select Create inline policy. 6. Choose the JSON tab. 7. Replace the default policy content with the following content. Replace key-name with the Amazon Resource Name (ARN) of the AWS Key Management Service key (AWS KMS key) that you want to use. Session Manager 842 AWS Systems Manager User Guide { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ssmmessages:CreateControlChannel", "ssmmessages:CreateDataChannel", "ssmmessages:OpenControlChannel", "ssmmessages:OpenDataChannel" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "s3:GetEncryptionConfiguration" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "kms:Decrypt" ], "Resource": "key-name" } ] } For information about using a KMS key to encrypt session data, see Turn on KMS key encryption of session data (console). If you won't use AWS KMS encryption for your session data, you can remove the following content from the policy. , { "Effect": "Allow", "Action": [ "kms:Decrypt" Session Manager 843 AWS Systems Manager ], "Resource": "key-name" } 8. Choose Next: Tags. User Guide 9. (Optional) Add tags by choosing Add tag, and entering the preferred tags for the policy. 10. Choose Next: Review. 11. On the Review policy page, for Name, enter a name for the inline policy, such as SessionManagerPermissions. 12. (Optional) For Description, enter a description for the policy. Choose Create policy. For information about the ssmmessages actions, see Reference: ec2messages, ssmmessages, and other API operations. Create a custom IAM role for Session Manager You can create an AWS Identity and Access Management (IAM) role that grants Session Manager the permission to perform actions on your Amazon EC2 managed instances. You can also include a policy to grant the permissions needed for session logs to be sent to Amazon Simple Storage Service (Amazon S3) and Amazon CloudWatch Logs. After you create the IAM role, for information about how to attach the role to an instance, see Attach or Replace an Instance Profile at the AWS re:Post website. For more information about IAM instance profiles and roles, see Using instance profiles in the IAM User Guide and IAM roles for Amazon EC2 in the Amazon Elastic Compute Cloud User Guide for Linux Instances. For more information about creating an IAM service role for on-premises machines, see Create the IAM service role required for Systems Manager in hybrid and multicloud environments. Topics • Creating an IAM role with minimal Session Manager permissions (console) • Creating an IAM role with permissions for Session Manager and Amazon S3 and CloudWatch Logs (console) Session Manager 844 AWS Systems Manager User Guide Creating an IAM role with minimal Session Manager permissions (console) Use the following procedure to create a
|
systems-manager-ug-266
|
systems-manager-ug.pdf
| 266 |
User Guide and IAM roles for Amazon EC2 in the Amazon Elastic Compute Cloud User Guide for Linux Instances. For more information about creating an IAM service role for on-premises machines, see Create the IAM service role required for Systems Manager in hybrid and multicloud environments. Topics • Creating an IAM role with minimal Session Manager permissions (console) • Creating an IAM role with permissions for Session Manager and Amazon S3 and CloudWatch Logs (console) Session Manager 844 AWS Systems Manager User Guide Creating an IAM role with minimal Session Manager permissions (console) Use the following procedure to create a custom IAM role with a policy that provides permissions for only Session Manager actions on your instances. To create an instance profile with minimal Session Manager permissions (console) 1. Sign in to the AWS Management Console and open the IAM console at https:// console.aws.amazon.com/iam/. 2. In the navigation pane, choose Policies, and then choose Create policy. (If a Get Started button is displayed, choose it, and then choose Create Policy.) 3. Choose the JSON tab. 4. Replace the default content with the following policy. To encrypt session data using AWS Key Management Service (AWS KMS), replace key-name with the Amazon Resource Name (ARN) of the AWS KMS key that you want to use. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ssm:UpdateInstanceInformation", "ssmmessages:CreateControlChannel", "ssmmessages:CreateDataChannel", "ssmmessages:OpenControlChannel", "ssmmessages:OpenDataChannel" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "kms:Decrypt" ], "Resource": "key-name" } ] } Session Manager 845 AWS Systems Manager User Guide For information about using a KMS key to encrypt session data, see Turn on KMS key encryption of session data (console). If you won't use AWS KMS encryption for your session data, you can remove the following content from the policy. , { "Effect": "Allow", "Action": [ "kms:Decrypt" ], "Resource": "key-name" } 5. Choose Next: Tags. 6. (Optional) Add tags by choosing Add tag, and entering the preferred tags for the policy. 7. Choose Next: Review. 8. On the Review policy page, for Name, enter a name for the inline policy, such as SessionManagerPermissions. 9. (Optional) For Description, enter a description for the policy. 10. Choose Create policy. 11. In the navigation pane, choose Roles, and then choose Create role. 12. On the Create role page, choose AWS service, and for Use case, choose EC2. 13. Choose Next. 14. On the Add permissions page, select the check box to the left of name of the policy you just created, such as SessionManagerPermissions. 15. Choose Next. 16. On the Name, review, and create page, for Role name, enter a name for the IAM role, such as MySessionManagerRole. 17. (Optional) For Role description, enter a description for the instance profile. 18. (Optional) Add tags by choosing Add tag, and entering the preferred tags for the role. Choose Create role. Session Manager 846 AWS Systems Manager User Guide For information about ssmmessages actions, see Reference: ec2messages, ssmmessages, and other API operations. Creating an IAM role with permissions for Session Manager and Amazon S3 and CloudWatch Logs (console) Use the following procedure to create a custom IAM role with a policy that provides permissions for Session Manager actions on your instances. The policy also provides the permissions needed for session logs to be stored in Amazon Simple Storage Service (Amazon S3) buckets and Amazon CloudWatch Logs log groups. Important To output session logs to an Amazon S3 bucket owned by a different AWS account, you must add the s3:PutObjectAcl permission to the IAM role policy. Additionally, you must ensure that the bucket policy grants cross-account access to the IAM role used by the owning account to grant Systems Manager permissions for managed instances. If the bucket uses Key Management Service (KMS) encryption, then the bucket's KMS policy must also grant this cross-account access. For more information about configuring cross-account bucket permissions in Amazon S3, see Granting cross-account bucket permissions in the Amazon Simple Storage Service User Guide. If the cross-account permissions aren't added, the account that owns the Amazon S3 bucket can't access the session output logs. For information about specifying preferences for storing session logs, see Enabling and disabling session logging. To create an IAM role with permissions for Session Manager and Amazon S3 and CloudWatch Logs (console) 1. Sign in to the AWS Management Console and open the IAM console at https:// console.aws.amazon.com/iam/. 2. In the navigation pane, choose Policies, and then choose Create policy. (If a Get Started button is displayed, choose it, and then choose Create Policy.) 3. Choose the JSON tab. 4. Replace the default content with the following policy. Replace each example resource placeholder with your own information. Session Manager 847 AWS Systems Manager User Guide { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ssmmessages:CreateControlChannel", "ssmmessages:CreateDataChannel", "ssmmessages:OpenControlChannel", "ssmmessages:OpenDataChannel", "ssm:UpdateInstanceInformation" ], "Resource": "*" }, {
|
systems-manager-ug-267
|
systems-manager-ug.pdf
| 267 |
and Amazon S3 and CloudWatch Logs (console) 1. Sign in to the AWS Management Console and open the IAM console at https:// console.aws.amazon.com/iam/. 2. In the navigation pane, choose Policies, and then choose Create policy. (If a Get Started button is displayed, choose it, and then choose Create Policy.) 3. Choose the JSON tab. 4. Replace the default content with the following policy. Replace each example resource placeholder with your own information. Session Manager 847 AWS Systems Manager User Guide { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ssmmessages:CreateControlChannel", "ssmmessages:CreateDataChannel", "ssmmessages:OpenControlChannel", "ssmmessages:OpenDataChannel", "ssm:UpdateInstanceInformation" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "logs:CreateLogStream", "logs:PutLogEvents", "logs:DescribeLogGroups", "logs:DescribeLogStreams" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::amzn-s3-demo-bucket/s3-prefix/*" }, { "Effect": "Allow", "Action": [ "s3:GetEncryptionConfiguration" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "kms:Decrypt" ], Session Manager 848 AWS Systems Manager User Guide "Resource": "key-name" }, { "Effect": "Allow", "Action": "kms:GenerateDataKey", "Resource": "*" } ] } 5. Choose Next: Tags. 6. (Optional) Add tags by choosing Add tag, and entering the preferred tags for the policy. 7. Choose Next: Review. 8. On the Review policy page, for Name, enter a name for the inline policy, such as SessionManagerPermissions. 9. (Optional) For Description, enter a description for the policy. 10. Choose Create policy. 11. In the navigation pane, choose Roles, and then choose Create role. 12. On the Create role page, choose AWS service, and for Use case, choose EC2. 13. Choose Next. 14. On the Add permissions page, select the check box to the left of name of the policy you just created, such as SessionManagerPermissions. 15. Choose Next. 16. On the Name, review, and create page, for Role name, enter a name for the IAM role, such as MySessionManagerRole. 17. (Optional) For Role description, enter a description for the role. 18. (Optional) Add tags by choosing Add tag, and entering the preferred tags for the role. 19. Choose Create role. Step 3: Control session access to managed nodes You grant or revoke Session Manager access to managed nodes by using AWS Identity and Access Management (IAM) policies. You can create a policy and attach it to an IAM user or group that specifies which managed nodes the user or group can connect to. You can also specify the Session Manager API operations the user or groups can perform on those managed nodes. Session Manager 849 AWS Systems Manager User Guide To help you get started with IAM permission policies for Session Manager, we've created sample policies for an end user and an administrator user. You can use these policies with only minor changes. Or, use them as a guide to create custom IAM policies. For more information, see Sample IAM policies for Session Manager. For information about how to create IAM policies and attach them to users or groups, see Creating IAM Policies and Adding and Removing IAM Policies in the IAM User Guide. About session ID ARN formats When you create an IAM policy for Session Manager access, you specify a session ID as part of the Amazon Resource Name (ARN). The session ID includes the user name as a variable. To help illustrate this, here's the format of a Session Manager ARN and an example: arn:aws:ssm:region-id:account-id:session/session-id For example: arn:aws:ssm:us-east-2:123456789012:session/JohnDoe-1a2b3c4d5eEXAMPLE For more information about using variables in IAM policies, see IAM Policy Elements: Variables. Topics • Start a default shell session by specifying the default session document in IAM policies • Start a session with a document by specifying the session documents in IAM policies • Sample IAM policies for Session Manager • Additional sample IAM policies for Session Manager Start a default shell session by specifying the default session document in IAM policies When you configure Session Manager for your AWS account or when you change session preferences in the Systems Manager console, the system creates an SSM session document called SSM-SessionManagerRunShell. This is the default session document. Session Manager uses this document to store your session preferences, which include information like the following: • A location where you want to save session data, such an Amazon Simple Storage Service (Amazon S3) bucket or a Amazon CloudWatch Logs log group. • An AWS Key Management Service (AWS KMS) key ID for encrypting session data. • Whether Run As support is allowed for your sessions. Session Manager 850 AWS Systems Manager User Guide Here is an example of the information contained in the SSM-SessionManagerRunShell session preferences document. { "schemaVersion": "1.0", "description": "Document to hold regional settings for Session Manager", "sessionType": "Standard_Stream", "inputs": { "s3BucketName": "amzn-s3-demo-bucket", "s3KeyPrefix": "MyS3Prefix", "s3EncryptionEnabled": true, "cloudWatchLogGroupName": "MyCWLogGroup", "cloudWatchEncryptionEnabled": false, "kmsKeyId": "1a2b3c4d", "runAsEnabled": true, "runAsDefaultUser": "RunAsUser" } } By default, Session Manager uses the default session document when a user starts a session from the AWS Management Console. This applies to
|
systems-manager-ug-268
|
systems-manager-ug.pdf
| 268 |
Key Management Service (AWS KMS) key ID for encrypting session data. • Whether Run As support is allowed for your sessions. Session Manager 850 AWS Systems Manager User Guide Here is an example of the information contained in the SSM-SessionManagerRunShell session preferences document. { "schemaVersion": "1.0", "description": "Document to hold regional settings for Session Manager", "sessionType": "Standard_Stream", "inputs": { "s3BucketName": "amzn-s3-demo-bucket", "s3KeyPrefix": "MyS3Prefix", "s3EncryptionEnabled": true, "cloudWatchLogGroupName": "MyCWLogGroup", "cloudWatchEncryptionEnabled": false, "kmsKeyId": "1a2b3c4d", "runAsEnabled": true, "runAsDefaultUser": "RunAsUser" } } By default, Session Manager uses the default session document when a user starts a session from the AWS Management Console. This applies to either Fleet Manager or Session Manager in the Systems Manager console, or EC2 Connect in the Amazon EC2 console. Session Manager also uses the default session document when a user starts a session by using an AWS CLI command like the following example: aws ssm start-session \ --target i-02573cafcfEXAMPLE To start a default shell session, you must specify the default session document in the IAM policy, as shown in the following example. { "Version": "2012-10-17", "Statement": [ { "Sid": "EnableSSMSession", "Effect": "Allow", "Action": [ "ssm:StartSession" ], "Resource": [ Session Manager 851 AWS Systems Manager User Guide "arn:aws:ec2:us-west-2:123456789012:instance/i-02573cafcfEXAMPLE", "arn:aws:ssm:us-west-2:123456789012:document/SSM-SessionManagerRunShell" ] }, { "Effect": "Allow", "Action": [ "ssmmessages:OpenDataChannel" ], "Resource": [ "*" ] } ] } Start a session with a document by specifying the session documents in IAM policies If you use the start-session AWS CLI command using the default session document, you can omit the document name. The system automatically calls the SSM-SessionManagerRunShell session document. In all other cases, you must specify a value for the document-name parameter. When a user specifies the name of a session document in a command, the systems checks their IAM policy to verify they have permission to access the document. If they don't have permission, the connection request fails. The following examples includes the document-name parameter with the AWS- StartPortForwardingSession session document. aws ssm start-session \ --target i-02573cafcfEXAMPLE \ --document-name AWS-StartPortForwardingSession \ --parameters '{"portNumber":["80"], "localPortNumber":["56789"]}' For an example of how to specify a Session Manager session document in an IAM policy, see Quickstart end user policies for Session Manager. Session Manager 852 AWS Systems Manager Note User Guide To start a session using SSH, you must complete configuration steps on the target managed node and the user's local machine. For information, see (Optional) Allow and control permissions for SSH connections through Session Manager. Sample IAM policies for Session Manager Use the samples in this section to help you create AWS Identity and Access Management (IAM) policies that provide the most commonly needed permissions for Session Manager access. Note You can also use an AWS KMS key policy to control which IAM entities (users or roles) and AWS accounts are given access to your KMS key. For information, see Overview of Managing Access to Your AWS KMS Resources and Using Key Policies in AWS KMS in the AWS Key Management Service Developer Guide. Topics • Quickstart end user policies for Session Manager • Quickstart administrator policy for Session Manager Quickstart end user policies for Session Manager Use the following examples to create IAM end user policies for Session Manager. You can create a policy that allows users to start sessions from only the Session Manager console and AWS Command Line Interface (AWS CLI), from only the Amazon Elastic Compute Cloud (Amazon EC2) console, or from all three. These policies provide end users the ability to start a session to a particular managed node and the ability to end only their own sessions. Refer to Additional sample IAM policies for Session Manager for examples of customizations you might want to make to the policy. In the following sample policies, replace each example resource placeholder with your own information. Session Manager 853 AWS Systems Manager User Guide Refer to the following sections to view sample policies for the range of session access you want to provide. Session Manager and Fleet Manager Use this sample policy to give users the ability to start and resume sessions from only the Session Manager and Fleet Manager consoles. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ssm:StartSession" ], "Resource": [ "arn:aws:ec2:region:account-id:instance/instance-id", "arn:aws:ssm:region:account-id:document/SSM- SessionManagerRunShell" ] }, { "Effect": "Allow", "Action": ["ssmmessages:OpenDataChannel"], "Resource": ["arn:aws:ssm:*:*:session/${aws:userid}-*"] }, { "Effect": "Allow", "Action": [ "ssm:DescribeSessions", "ssm:GetConnectionStatus", "ssm:DescribeInstanceProperties", "ec2:DescribeInstances" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "ssm:TerminateSession", "ssm:ResumeSession" ], Session Manager 854 AWS Systems Manager User Guide "Resource": [ "arn:aws:ssm:*:*:session/${aws:userid}-*" ] }, { "Effect": "Allow", "Action": [ "kms:GenerateDataKey" ], "Resource": "key-name" } ] } Amazon EC2 Use this sample policy to give users the ability to start and resume sessions from only the Amazon EC2 console. This policy doesn't provide all the permissions needed to start sessions from the Session Manager console and the AWS CLI. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow",
|
systems-manager-ug-269
|
systems-manager-ug.pdf
| 269 |
["ssmmessages:OpenDataChannel"], "Resource": ["arn:aws:ssm:*:*:session/${aws:userid}-*"] }, { "Effect": "Allow", "Action": [ "ssm:DescribeSessions", "ssm:GetConnectionStatus", "ssm:DescribeInstanceProperties", "ec2:DescribeInstances" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "ssm:TerminateSession", "ssm:ResumeSession" ], Session Manager 854 AWS Systems Manager User Guide "Resource": [ "arn:aws:ssm:*:*:session/${aws:userid}-*" ] }, { "Effect": "Allow", "Action": [ "kms:GenerateDataKey" ], "Resource": "key-name" } ] } Amazon EC2 Use this sample policy to give users the ability to start and resume sessions from only the Amazon EC2 console. This policy doesn't provide all the permissions needed to start sessions from the Session Manager console and the AWS CLI. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ssm:StartSession", "ssm:SendCommand" ], "Resource": [ "arn:aws:ec2:region:account-id:instance/instance-id", "arn:aws:ssm:region:account-id:document/SSM- SessionManagerRunShell" ] }, { "Effect": "Allow", "Action": ["ssmmessages:OpenDataChannel"], "Resource": ["arn:aws:ssm:*:*:session/${aws:userid}-*"] }, { Session Manager 855 AWS Systems Manager User Guide "Effect": "Allow", "Action": [ "ssm:GetConnectionStatus", "ssm:DescribeInstanceInformation" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "ssm:TerminateSession", "ssm:ResumeSession" ], "Resource": [ "arn:aws:ssm:*:*:session/${aws:username}-*" ] } ] } AWS CLI Use this sample policy to give users the ability to start and resume sessions from the AWS CLI. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ssm:StartSession", "ssm:SendCommand" ], "Resource": [ "arn:aws:ec2:region:account-id:instance/instance-id", "arn:aws:ssm:region:account-id:document/SSM- SessionManagerRunShell" ] }, { "Effect": "Allow", "Action": ["ssmmessages:OpenDataChannel"], Session Manager 856 AWS Systems Manager User Guide "Resource": ["arn:aws:ssm:*:*:session/${aws:userid}-*"] }, { "Effect": "Allow", "Action": [ "ssm:TerminateSession", "ssm:ResumeSession" ], "Resource": [ "arn:aws:ssm:*:*:session/${aws:userid}-*" ] }, { "Effect": "Allow", "Action": [ "kms:GenerateDataKey" ], "Resource": "key-name" } ] } 1 SSM-SessionManagerRunShell is the default name of the SSM document that Session Manager creates to store your session configuration preferences. You can create a custom Session document and specify it in this policy instead. You can also specify the AWS-provided document AWS-StartSSHSession for users who are starting sessions using SSH. For information about configuration steps needed to support sessions using SSH, see (Optional) Allow and control permissions for SSH connections through Session Manager. 2 The kms:GenerateDataKey permission enables the creation of a data encryption key that will be used to encrypt session data. If you will use AWS Key Management Service (AWS KMS) encryption for your session data, replace key-name with the Amazon Resource Name (ARN) of the KMS key you want to use, in the format arn:aws:kms:us- west-2:111122223333:key/1234abcd-12ab-34cd-56ef-12345EXAMPLE. If you won't use KMS key encryption for your session data, remove the following content from the policy. { "Effect": "Allow", "Action": [ Session Manager 857 AWS Systems Manager User Guide "kms:GenerateDataKey" ], "Resource": "key-name" } For information about using AWS KMS for encrypting session data, see Turn on KMS key encryption of session data (console). 3 The permission for SendCommand is needed for cases where a user attempts to start a session from the Amazon EC2 console, but the SSM Agent must be updated to the minimum required version for Session Manager first. Run Command is used to send a command to the instance to update the agent. Quickstart administrator policy for Session Manager Use the following examples to create IAM administrator policies for Session Manager. These policies provide administrators the ability to start a session to managed nodes that are tagged with Key=Finance,Value=WebServers, permission to create, update, and delete preferences, and permission to end only their own sessions. Refer to Additional sample IAM policies for Session Manager for examples of customizations you might want to make to the policy. You can create a policy that allows administrators to perform these tasks from only the Session Manager console and AWS CLI, from only the Amazon EC2 console, or from all three. In the following sample policies, replace each example resource placeholder with your own information. Refer to the following sections to view sample policies for the three permissions scenarios. Session Manager and CLI Use this sample policy to give administrators the ability to perform session-related tasks from only the Session Manager console and the AWS CLI. This policy doesn't provide all the permissions needed to perform session-related tasks from the Amazon EC2 console. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ Session Manager 858 AWS Systems Manager User Guide "ssm:StartSession" ], "Resource": [ "arn:aws:ec2:region:account-id:instance/*" ], "Condition": { "StringLike": { "ssm:resourceTag/Finance": [ "WebServers" ] } } }, { "Effect": "Allow", "Action": ["ssmmessages:OpenDataChannel"], "Resource": ["arn:aws:ssm:*:*:session/${aws:userid}-*"] }, { "Effect": "Allow", "Action": [ "ssm:DescribeSessions", "ssm:GetConnectionStatus", "ssm:DescribeInstanceProperties", "ec2:DescribeInstances" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "ssm:CreateDocument", "ssm:UpdateDocument", "ssm:GetDocument", "ssm:StartSession" ], "Resource": "arn:aws:ssm:region:account-id:document/SSM- SessionManagerRunShell" }, { "Effect": "Allow", "Action": ["ssmmessages:OpenDataChannel"], "Resource": ["arn:aws:ssm:*:*:session/${aws:userid}-*"] }, Session Manager 859 AWS Systems Manager { "Effect": "Allow", "Action": [ "ssm:TerminateSession", "ssm:ResumeSession" ], "Resource": [ "arn:aws:ssm:*:*:session/${aws:userid}-*" User Guide ] } ] } Amazon EC2 Use this sample policy to give administrators the ability to perform session-related tasks from only the Amazon EC2 console. This policy doesn't provide all the permissions needed to perform session-related tasks from the Session Manager console and the AWS CLI. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action":
|
systems-manager-ug-270
|
systems-manager-ug.pdf
| 270 |
], "Resource": "*" }, { "Effect": "Allow", "Action": [ "ssm:CreateDocument", "ssm:UpdateDocument", "ssm:GetDocument", "ssm:StartSession" ], "Resource": "arn:aws:ssm:region:account-id:document/SSM- SessionManagerRunShell" }, { "Effect": "Allow", "Action": ["ssmmessages:OpenDataChannel"], "Resource": ["arn:aws:ssm:*:*:session/${aws:userid}-*"] }, Session Manager 859 AWS Systems Manager { "Effect": "Allow", "Action": [ "ssm:TerminateSession", "ssm:ResumeSession" ], "Resource": [ "arn:aws:ssm:*:*:session/${aws:userid}-*" User Guide ] } ] } Amazon EC2 Use this sample policy to give administrators the ability to perform session-related tasks from only the Amazon EC2 console. This policy doesn't provide all the permissions needed to perform session-related tasks from the Session Manager console and the AWS CLI. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ssm:StartSession", "ssm:SendCommand" ], "Resource": [ "arn:aws:ec2:region:account-id:instance/*" ], "Condition": { "StringLike": { "ssm:resourceTag/tag-key": [ "tag-value" ] } } }, { "Effect": "Allow", "Action": [ Session Manager 860 AWS Systems Manager User Guide "ssm:StartSession" ], "Resource": [ "arn:aws:ssm:region:account-id:document/SSM-SessionManagerRunShell" ] }, { "Effect": "Allow", "Action": ["ssmmessages:OpenDataChannel"], "Resource": ["arn:aws:ssm:*:*:session/${aws:userid}-*"] }, { "Effect": "Allow", "Action": [ "ssm:GetConnectionStatus", "ssm:DescribeInstanceInformation" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "ssm:TerminateSession", "ssm:ResumeSession" ], "Resource": [ "arn:aws:ssm:*:*:session/${aws:userid}-*" ] } ] } Session Manager, CLI, and Amazon EC2 Use this sample policy to give administrators the ability to perform session-related tasks from the Session Manager console, the AWS CLI, and the Amazon EC2 console. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ Session Manager 861 AWS Systems Manager User Guide "ssm:StartSession", "ssm:SendCommand" ], "Resource": [ "arn:aws:ec2:region:account-id:instance/*" ], "Condition": { "StringLike": { "ssm:resourceTag/tag-key": [ "tag-value" ] } } }, { "Effect": "Allow", "Action": ["ssmmessages:OpenDataChannel"], "Resource": ["arn:aws:ssm:*:*:session/${aws:userid}-*"] }, { "Effect": "Allow", "Action": [ "ssm:DescribeSessions", "ssm:GetConnectionStatus", "ssm:DescribeInstanceInformation", "ssm:DescribeInstanceProperties", "ec2:DescribeInstances" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "ssm:CreateDocument", "ssm:UpdateDocument", "ssm:GetDocument", "ssm:StartSession" ], "Resource": "arn:aws:ssm:region:account-id:document/SSM- SessionManagerRunShell" }, { "Effect": "Allow", Session Manager 862 AWS Systems Manager User Guide "Action": [ "ssm:TerminateSession", "ssm:ResumeSession" ], "Resource": [ "arn:aws:ssm:*:*:session/${aws:userid}-*" ] } ] } 1 The permission for SendCommand is needed for cases where a user attempts to start a session from the Amazon EC2 console, but a command must be sent to update SSM Agent first. Additional sample IAM policies for Session Manager Refer to the following example policies to help you create a custom AWS Identity and Access Management (IAM) policy for any Session Manager user access scenarios you want to support. Topics • Example 1: Grant access to documents in the console • Example 2: Restrict access to specific managed nodes • Example 3: Restrict access based on tags • Example 4: Allow a user to end only sessions they started • Example 5: Allow full (administrative) access to all sessions Example 1: Grant access to documents in the console You can allow users to specify a custom document when they launch a session using the Session Manager console. The following example IAM policy grants permission to access documents with names that begin with SessionDocument- in the specified AWS Region and AWS account. To use this policy, replace each example resource placeholder with your own information. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", Session Manager 863 AWS Systems Manager User Guide "Action": [ "ssm:GetDocument", "ssm:ListDocuments" ], "Resource": [ "arn:aws:ssm:region:account-id:document/SessionDocument-*" ] } ] } Note The Session Manager console only supports Session documents that have a sessionType of Standard_Stream which are used to define session preferences. For more information, see Session document schema. Example 2: Restrict access to specific managed nodes You can create an IAM policy that defines which managed nodes that a user is allowed to connect to using Session Manager. For example, the following policy grants a user the permission to start, end, and resume their sessions on three specific nodes. The policy restricts the user from connecting to nodes other than those specified. Note For federated users, see Example 4: Allow a user to end only sessions they started. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ssm:StartSession" ], "Resource": [ "arn:aws:ec2:us-east-2:123456789012:instance/i-1234567890EXAMPLE", Session Manager 864 AWS Systems Manager User Guide "arn:aws:ec2:us-east-2:123456789012:instance/i-abcdefghijEXAMPLE", "arn:aws:ec2:us-east-2:123456789012:instance/i-0e9d8c7b6aEXAMPLE", "arn:aws:ssm:us-east-2:123456789012:document/SSM- SessionManagerRunShell" ] }, { "Effect": "Allow", "Action": ["ssmmessages:OpenDataChannel"], "Resource": ["arn:aws:ssm:*:*:session/${aws:userid}-*"] }, { "Effect": "Allow", "Action": [ "ssm:TerminateSession", "ssm:ResumeSession" ], "Resource": [ "arn:aws:ssm:*:*:session/${aws:userid}-*" ] }, { "Effect": "Allow", "Action": ["ssmmessages:OpenDataChannel"], "Resource": ["arn:aws:ssm:*:*:session/${aws:userid}-*"] } ] } Example 3: Restrict access based on tags You can restrict access to managed nodes based on specific tags. In the following example, the user is allowed to start and resume sessions (Effect: Allow, Action: ssm:StartSession, ssm:ResumeSession) on any managed node (Resource: arn:aws:ec2:region:987654321098:instance/*) with the condition that the node is a Finance WebServer (ssm:resourceTag/Finance: WebServer). If the user sends a command to a managed node that isn't tagged or that has any tag other than Finance: WebServer, the command result will include AccessDenied. { "Version": "2012-10-17", "Statement": [ Session Manager 865 User Guide AWS Systems Manager { "Effect": "Allow", "Action": [ "ssm:StartSession" ], "Resource": [ "arn:aws:ec2:us-east-2:123456789012:instance/*" ], "Condition": { "StringLike": { "ssm:resourceTag/Finance": [ "WebServers" ] } } }, {
|
systems-manager-ug-271
|
systems-manager-ug.pdf
| 271 |
In the following example, the user is allowed to start and resume sessions (Effect: Allow, Action: ssm:StartSession, ssm:ResumeSession) on any managed node (Resource: arn:aws:ec2:region:987654321098:instance/*) with the condition that the node is a Finance WebServer (ssm:resourceTag/Finance: WebServer). If the user sends a command to a managed node that isn't tagged or that has any tag other than Finance: WebServer, the command result will include AccessDenied. { "Version": "2012-10-17", "Statement": [ Session Manager 865 User Guide AWS Systems Manager { "Effect": "Allow", "Action": [ "ssm:StartSession" ], "Resource": [ "arn:aws:ec2:us-east-2:123456789012:instance/*" ], "Condition": { "StringLike": { "ssm:resourceTag/Finance": [ "WebServers" ] } } }, { "Effect": "Allow", "Action": ["ssmmessages:OpenDataChannel"], "Resource": ["arn:aws:ssm:*:*:session/${aws:userid}-*"] }, { "Effect": "Allow", "Action": [ "ssm:TerminateSession", "ssm:ResumeSession" ], "Resource": [ "arn:aws:ssm:*:*:session/${aws:userid}-*" ] }, { "Effect": "Allow", "Action": [ "ssm:StartSession" ], "Resource": [ "arn:aws:ssm:us-east-2:123456789012:document/SSM- SessionManagerRunShell" ] } ] } Session Manager 866 AWS Systems Manager User Guide You can create IAM policies that allow a user to start sessions to managed nodes that are tagged with multiple tags. The following policy allows the user to start sessions to managed nodes that have both the specified tags applied to them. If a user sends a command to a managed node that isn't tagged with both of these tags, the command result will include AccessDenied. { "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":[ "ssm:StartSession" ], "Resource":"*", "Condition":{ "StringLike":{ "ssm:resourceTag/tag-key1":[ "tag-value1" ], "ssm:resourceTag/tag-key2":[ "tag-value2" ] } } }, { "Effect": "Allow", "Action": ["ssmmessages:OpenDataChannel"], "Resource": ["arn:aws:ssm:*:*:session/${aws:userid}-*"] }, { "Effect": "Allow", "Action": [ "ssm:StartSession" ], "Resource": [ "arn:aws:ssm:us-east-2:123456789012:document/SSM- SessionManagerRunShell" ] } ] } Session Manager 867 AWS Systems Manager User Guide For more information about creating IAM policies, see Managed Policies and Inline Policies in the IAM User Guide. For more information about tagging managed nodes, see Tagging your Amazon EC2 resources in the Amazon EC2 User Guide (content applies to Windows and Linux managed nodes). For more information about increasing your security posture against unauthorized root- level commands on your managed nodes, see Restricting access to root-level commands through SSM Agent Example 4: Allow a user to end only sessions they started Session Manager provides two methods to control which sessions a federated user in your AWS account is allowed to end. • Use the variable {aws:userid} in an AWS Identity and Access Management (IAM) permissions policy. Federated users can end only sessions they started. For unfederated users, use Method 1. For federated users, use Method 2. • Use tags supplied by AWS tags in an IAM permissions policy. In the policy, you include a condition that allows users to end only sessions that are tagged with specific tags that have been provided by AWS. This method works for all accounts, including those that use federated IDs to grant access to AWS. Method 1: Grant TerminateSession privileges using the variable {aws:username} The following IAM policy allows a user to view the IDs of all sessions in your account. However, users can interact with managed nodes only through sessions they started. A user who is assigned the following policy can't connect to or end other users' sessions. The policy uses the variable {aws:username} to achieve this. Note This method doesn't work for accounts that grant access to AWS using federated IDs. { "Version": "2012-10-17", "Statement": [ { "Action": [ "ssm:DescribeSessions" ], Session Manager 868 AWS Systems Manager User Guide "Effect": "Allow", "Resource": [ "*" ] }, { "Action": [ "ssm:TerminateSession" ], "Effect": "Allow", "Resource": [ "arn:aws:ssm:*:*:session/${aws:username}-*" ] } ] } Method 2: Grant TerminateSession privileges using tags supplied by AWS You can control which sessions that a user can end by including conditional tag key variables in an IAM policy. The condition specifies that the user can only end sessions that are tagged with one or both of these specific tag key variables and a specified value. When a user in your AWS account starts a session, Session Manager applies two resource tags to the session. The first resource tag is aws:ssmmessages:target-id, with which you specify the ID of the target the user is allowed to end. The other resource tag is aws:ssmmessages:session-id, with a value in the format of role-id:caller-specified- role-name. Note Session Manager doesn’t support custom tags for this IAM access control policy. You must use the resource tags supplied by AWS, described below. aws:ssmmessages:target-id With this tag key, you include the managed node ID as the value in policy. In the following policy block, the condition statement allows a user to end only the node i-02573cafcfEXAMPLE. { Session Manager 869 AWS Systems Manager User Guide "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ssm:TerminateSession" ], "Resource": "*", "Condition": { "StringLike": { "ssm:resourceTag/aws:ssmmessages:target-id": [ "i-02573cafcfEXAMPLE" ] } } } ] } If the user tries to end a session for which they haven’t been granted this TerminateSession permission, they receive an AccessDeniedException error. aws:ssmmessages:session-id This tag key includes
|
systems-manager-ug-272
|
systems-manager-ug.pdf
| 272 |
supplied by AWS, described below. aws:ssmmessages:target-id With this tag key, you include the managed node ID as the value in policy. In the following policy block, the condition statement allows a user to end only the node i-02573cafcfEXAMPLE. { Session Manager 869 AWS Systems Manager User Guide "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ssm:TerminateSession" ], "Resource": "*", "Condition": { "StringLike": { "ssm:resourceTag/aws:ssmmessages:target-id": [ "i-02573cafcfEXAMPLE" ] } } } ] } If the user tries to end a session for which they haven’t been granted this TerminateSession permission, they receive an AccessDeniedException error. aws:ssmmessages:session-id This tag key includes a variable for the session ID as the value in the request to start a session. The following example demonstrates a policy for cases where the caller type is User. The value you supply for aws:ssmmessages:session-id is the ID of the user. In this example, AIDIODR4TAW7CSEXAMPLE represents the ID of a user in your AWS account. To retrieve the ID for a user in your AWS account, use the IAM command, get-user. For information, see get-user in the AWS Identity and Access Management section of the IAM User Guide. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ssm:TerminateSession" ], "Resource": "*", "Condition": { "StringLike": { Session Manager 870 AWS Systems Manager User Guide "ssm:resourceTag/aws:ssmmessages:session-id": [ "AIDIODR4TAW7CSEXAMPLE" ] } } } ] } The following example demonstrates a policy for cases where the caller type is AssumedRole. You can use the {aws:userid} variable for the value you supply for aws:ssmmessages:session-id. Alternatively, you can hardcode a role ID for the value you supply for aws:ssmmessages:session-id. If you hardcode a role ID, you must provide the value in the format role-id:caller-specified-role-name. For example, AIDIODR4TAW7CSEXAMPLE:MyRole. Important In order for system tags to be applied, the role ID you supply can contain the following characters only: Unicode letters, 0-9, space, _, ., :, /, =, +, -, @, and \. To retrieve the role ID for a role in your AWS account, use the get-caller-identity command. For information, see get-caller-identity in the AWS CLI Command Reference. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ssm:TerminateSession" ], "Resource": "*", "Condition": { "StringLike": { "ssm:resourceTag/aws:ssmmessages:session-id": [ "${aws:userid}*" ] } } Session Manager 871 AWS Systems Manager } ] } User Guide If a user tries to end a session for which they haven’t been granted this TerminateSession permission, they receive an AccessDeniedException error. aws:ssmmessages:target-id and aws:ssmmessages:session-id You can also create IAM policies that allow a user to end sessions that are tagged with both system tags, as shown in this example. { "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":[ "ssm:TerminateSession" ], "Resource":"*", "Condition":{ "StringLike":{ "ssm:resourceTag/aws:ssmmessages:target-id":[ "i-02573cafcfEXAMPLE" ], "ssm:resourceTag/aws:ssmmessages:session-id":[ "${aws:userid}*" ] } } } ] } Example 5: Allow full (administrative) access to all sessions The following IAM policy allows a user to fully interact with all managed nodes and all sessions created by all users for all nodes. It should be granted only to an Administrator who needs full control over your organization's Session Manager activities. { Session Manager 872 AWS Systems Manager User Guide "Version": "2012-10-17", "Statement": [ { "Action": [ "ssm:StartSession", "ssm:TerminateSession", "ssm:ResumeSession", "ssm:DescribeSessions", "ssm:GetConnectionStatus" ], "Effect": "Allow", "Resource": [ "*" ] }, { "Effect": "Allow", "Action": ["ssmmessages:OpenDataChannel"], "Resource": ["arn:aws:ssm:*:*:session/${aws:userid}-*"] } ] } Step 4: Configure session preferences Users that have been granted administrative permissions in their AWS Identity and Access Management (IAM) policy can configure session preferences, including the following: • Turn on Run As support for Linux managed nodes. This makes it possible to start sessions using the credentials of a specified operating system user instead of the credentials of a system- generated ssm-user account that AWS Systems Manager Session Manager can create on a managed node. • Configure Session Manager to use AWS KMS key encryption to provide additional protection to the data transmitted between client machines and managed nodes. • Configure Session Manager to create and send session history logs to an Amazon Simple Storage Service (Amazon S3) bucket or an Amazon CloudWatch Logs log group. The stored log data can then be used to report on the session connections made to your managed nodes and the commands run on them during the sessions. • Configure session timeouts. You can use this setting to specify when to end a session after a period of inactivity. Session Manager 873 AWS Systems Manager User Guide • Configure Session Manager to use configurable shell profiles. These customizable profiles allow you to define preferences within sessions such as shell preferences, environment variables, working directories, and running multiple commands when a session is started. For more information about the permissions needed to configue Session Manager preferences, see the section called “Grant or deny a user permissions to update Session Manager preferences”. Topics • Grant or deny a user permissions to update Session Manager preferences
|
systems-manager-ug-273
|
systems-manager-ug.pdf
| 273 |
can use this setting to specify when to end a session after a period of inactivity. Session Manager 873 AWS Systems Manager User Guide • Configure Session Manager to use configurable shell profiles. These customizable profiles allow you to define preferences within sessions such as shell preferences, environment variables, working directories, and running multiple commands when a session is started. For more information about the permissions needed to configue Session Manager preferences, see the section called “Grant or deny a user permissions to update Session Manager preferences”. Topics • Grant or deny a user permissions to update Session Manager preferences • Specify an idle session timeout value • Specify maximum session duration • Allow configurable shell profiles • Turn on Run As support for Linux and macOS managed nodes • Turn on KMS key encryption of session data (console) • Create a Session Manager preferences document (command line) • Update Session Manager preferences (command line) For information about using the Systems Manager console to configure options for logging session data, see the following topics: • Logging session data using Amazon S3 (console) • Streaming session data using Amazon CloudWatch Logs (console) • Logging session data using Amazon CloudWatch Logs (console) Grant or deny a user permissions to update Session Manager preferences Account preferences are stored as AWS Systems Manager (SSM) documents for each AWS Region. Before a user can update account preferences for sessions in your account, they must be granted the necessary permissions to access the type of SSM document where these preferences are stored. These permissions are granted through an AWS Identity and Access Management (IAM) policy. Administrator policy to allow preferences to be created and updated An administrator can have the following policy to create and update preferences at any time. The following policy allows permission to access and update the SSM-SessionManagerRunShell document in the us-east-2 account 123456789012. Session Manager 874 AWS Systems Manager User Guide { "Version": "2012-10-17", "Statement": [ { "Action": [ "ssm:CreateDocument", "ssm:GetDocument", "ssm:UpdateDocument", "ssm:DeleteDocument" ], "Effect": "Allow", "Resource": [ "arn:aws:ssm:us-east-2:123456789012:document/SSM- SessionManagerRunShell" ] } ] } User policy to prevent preferences from being updated Use the following policy to prevent end users in your account from updating or overriding any Session Manager preferences. { "Version": "2012-10-17", "Statement": [ { "Action": [ "ssm:CreateDocument", "ssm:GetDocument", "ssm:UpdateDocument", "ssm:DeleteDocument" ], "Effect": "Deny", "Resource": [ "arn:aws:ssm:us-east-2:123456789012:document/SSM- SessionManagerRunShell" ] } ] } Session Manager 875 AWS Systems Manager User Guide Specify an idle session timeout value Session Manager, a tool in AWS Systems Manager, allows you to specify the amount of time to allow a user to be inactive before the system ends a session. By default, sessions time out after 20 minutes of inactivity. You can modify this setting to specify that a session times out between 1 and 60 minutes of inactivity. Some professional computing security agencies recommend setting idle session timeouts to a maximum of 15 minutes. To allow idle session timeout (console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Session Manager. 3. Choose the Preferences tab, and then choose Edit. 4. Specify the amount of time to allow a user to be inactive before a session ends in the minutes field under Idle session timeout. 5. Choose Save. Specify maximum session duration Session Manager, a tool in AWS Systems Manager, allows you to specify the maximum duration of a session before it ends. By default, sessions do not have a maximum duration. The value you specify for maximum session duration must be between 1 and 1,440 minutes. To specify maximum session duration (console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Session Manager. 3. Choose the Preferences tab, and then choose Edit. 4. 5. Select the check box next to Enable maximum session duration. Specify the maximum duration of session before it ends in the minutes field under Maximum session duration. 6. Choose Save. Session Manager 876 AWS Systems Manager Allow configurable shell profiles User Guide By default, sessions on EC2 instances for Linux start using the Bourne shell (sh). However, you might prefer to use another shell like bash. By allowing configurable shell profiles, you can customize preferences within sessions such as shell preferences, environment variables, working directories, and running multiple commands when a session is started. Important Systems Manager doesn't check the commands or scripts in your shell profile to see what changes they would make to an instance before they're run. To restrict a user’s ability to modify commands or scripts entered in their shell profile, we recommend the following: • Create a customized Session-type document for your AWS Identity and Access Management (IAM) users and roles. Then modify the IAM policy for these users and roles so the StartSession API operation can only use the
|
systems-manager-ug-274
|
systems-manager-ug.pdf
| 274 |
within sessions such as shell preferences, environment variables, working directories, and running multiple commands when a session is started. Important Systems Manager doesn't check the commands or scripts in your shell profile to see what changes they would make to an instance before they're run. To restrict a user’s ability to modify commands or scripts entered in their shell profile, we recommend the following: • Create a customized Session-type document for your AWS Identity and Access Management (IAM) users and roles. Then modify the IAM policy for these users and roles so the StartSession API operation can only use the Session-type document you have created for them. For information see, Create a Session Manager preferences document (command line) and Quickstart end user policies for Session Manager. • Modify the IAM policy for your IAM users and roles to deny access to the UpdateDocument API operation for the Session-type document resource you create. This allows your users and roles to use the document you created for their session preferences without allowing them to modify any of the settings. To turn on configurable shell profiles 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Session Manager. 3. Choose the Preferences tab, and then choose Edit. 4. Specify the environment variables, shell preferences, or commands you want to run when your session starts in the fields for the applicable operating systems. 5. Choose Save. The following are some example commands that can be added to your shell profile. Change to the bash shell and change to the /usr directory on Linux instances. Session Manager 877 AWS Systems Manager exec /bin/bash cd /usr User Guide Output a timestamp and welcome message at the start of a session. Linux & macOS timestamp=$(date '+%Y-%m-%dT%H:%M:%SZ') user=$(whoami) echo $timestamp && echo "Welcome $user"'!' echo "You have logged in to a production instance. Note that all session activity is being logged." Windows $timestamp = (Get-Date).ToString("yyyy-MM-ddTH:mm:ssZ") $splitName = (whoami).Split("\") $user = $splitName[1] Write-Host $timestamp Write-Host "Welcome $user!" Write-Host "You have logged in to a production instance. Note that all session activity is being logged." View dynamic system activity at the start of a session. Linux & macOS top Windows while ($true) { Get-Process | Sort-Object -Descending CPU | Select-Object -First 30; ` Start-Sleep -Seconds 2; cls Write-Host "Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName"; Write-Host "------- ------ ----- ----- ----- ------ -- -----------"} Session Manager 878 AWS Systems Manager User Guide Turn on Run As support for Linux and macOS managed nodes By default, Session Manager authenticates connections using the credentials of the system- generated ssm-user account that is created on a managed node. (On Linux and macOS machines, this account is added to /etc/sudoers/.) If you choose, you can instead authenticate sessions using the credentials of an operating system (OS) user account, or a domain user for instances joined to an Active Directory. In this case, Session Manager verifies that the OS account that you specified exists on the node, or in the domain, before starting the session. If you attempt to start a session using an OS account that doesn't exist on the node, or in the domain, the connection fails. Note Session Manager does not support using an operating system's root user account to authenticate connections. For sessions that are authenticated using an OS user account, the node's OS-level and directory policies, like login restrictions or system resource usage restrictions, might not apply. How it works If you turn on Run As support for sessions, the system checks for access permissions as follows: 1. For the user who is starting the session, has their IAM entity (user or role) been tagged with SSMSessionRunAs = os user account name? If Yes, does the OS user name exist on the managed node? If it does, start the session. If it doesn't, don't allow a session to start. If the IAM entity has not been tagged with SSMSessionRunAs = os user account name, continue to step 2. 2. If the IAM entity hasn't been tagged with SSMSessionRunAs = os user account name, has an OS user name been specified in the AWS account's Session Manager preferences? If Yes, does the OS user name exist on the managed node? If it does, start the session. If it doesn't, don't allow a session to start. Session Manager 879 AWS Systems Manager Note User Guide When you activate Run As support, it prevents Session Manager from starting sessions using the ssm-user account on a managed node. This means that if Session Manager fails to connect using the specified OS user account, it doesn't fall back to connecting using the default method. If you activate Run As without specifying an OS account or tagging an IAM entity, and you have not specified an OS account in
|
systems-manager-ug-275
|
systems-manager-ug.pdf
| 275 |
name exist on the managed node? If it does, start the session. If it doesn't, don't allow a session to start. Session Manager 879 AWS Systems Manager Note User Guide When you activate Run As support, it prevents Session Manager from starting sessions using the ssm-user account on a managed node. This means that if Session Manager fails to connect using the specified OS user account, it doesn't fall back to connecting using the default method. If you activate Run As without specifying an OS account or tagging an IAM entity, and you have not specified an OS account in Session Manager preferences, session connection attempts will fail. To turn on Run As support for Linux and macOS managed nodes 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Session Manager. 3. Choose the Preferences tab, and then choose Edit. 4. Select the check box next to Enable Run As support for Linux instances. 5. Do one of the following: • Option 1: In the Operating system user name field, enter the name of the OS user account that you want to use to start sessions. Using this option, all sessions are run by the same OS user for all users in your AWS account who connect using Session Manager. • Option 2 (Recommended): Choose the Open the IAM console link. In the navigation pane, choose either Users or Roles. Choose the entity (user or role) to add tags to, and then choose the Tags tab. Enter SSMSessionRunAs for the key name. Enter the name of an OS user account for the key value. Choose Save changes. Using this option, you can specify unique OS users for different IAM entities if you choose. For more information about tagging IAM entities (users or roles), see Tagging IAM resources in the IAM User Guide. The following is an example. Session Manager 880 AWS Systems Manager User Guide 6. Choose Save. Turn on KMS key encryption of session data (console) Use AWS Key Management Service (AWS KMS) to create and manage encryption keys. With AWS KMS, you can control the use of encryption across a wide range of AWS services and in your applications. You can specify that session data transmitted between your managed nodes and the local machines of users in your AWS account is encrypted using KMS key encryption. (This is in addition to the TLS 1.2/1.3 encryption that AWS already provides by default.) To encrypt Session Manager session data, create a symmetric KMS key using AWS KMS. AWS KMS encryption is available for Standard_Stream, InteractiveCommands, and NonInteractiveCommands session types. To use the option to encrypt session data using a key created in AWS KMS, version 2.3.539.0 or later of AWS Systems Manager SSM Agent must be installed on the managed node. Note You must allow AWS KMS encryption in order to reset passwords on your managed nodes from the AWS Systems Manager console. For more information, see Reset a password on a managed node. You can use a key that you created in your AWS account. You can also use a key that was created in a different AWS account. The creator of the key in a different AWS account must provide you with the permissions needed to use the key. Session Manager 881 AWS Systems Manager User Guide After you turn on KMS key encryption for your session data, both the users who start sessions and the managed nodes that they connect to must have permission to use the key. You provide permission to use the KMS key with Session Manager through AWS Identity and Access Management (IAM) policies. For information, see the following topics: • Add AWS KMS permissions for users in your account: Sample IAM policies for Session Manager. • Add AWS KMS permissions for managed nodes in your account: Step 2: Verify or add instance permissions for Session Manager. For more information about creating and managing KMS keys, see the AWS Key Management Service Developer Guide. For information about using the AWS CLI to turn on KMS key encryption of session data in your account, see Create a Session Manager preferences document (command line) or Update Session Manager preferences (command line). Note There is a charge to use KMS keys. For information, see AWS Key Management Service pricing. To turn on KMS key encryption of session data (console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Session Manager. 3. Choose the Preferences tab, and then choose Edit. 4. Select the check box next to Enable KMS encryption. 5. Do one of the following: • Choose the button next to Select a KMS key in my current account, then select a key from the list. -or- Session Manager 882 AWS Systems Manager
|
systems-manager-ug-276
|
systems-manager-ug.pdf
| 276 |
(command line). Note There is a charge to use KMS keys. For information, see AWS Key Management Service pricing. To turn on KMS key encryption of session data (console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Session Manager. 3. Choose the Preferences tab, and then choose Edit. 4. Select the check box next to Enable KMS encryption. 5. Do one of the following: • Choose the button next to Select a KMS key in my current account, then select a key from the list. -or- Session Manager 882 AWS Systems Manager User Guide Choose the button next to Enter a KMS key alias or KMS key ARN. Manually enter a KMS key alias for a key created in your current account, or enter the key Amazon Resource Name (ARN) for a key in another account. The following are examples: • Key alias: alias/my-kms-key-alias • Key ARN: arn:aws:kms:us- west-2:111122223333:key/1234abcd-12ab-34cd-56ef-12345EXAMPLE -or- Choose Create new key to create a new KMS key in your account. After you create the new key, return to the Preferences tab and select the key for encrypting session data in your account. For more information about sharing keys, see Allowing External AWS accounts to Access a key in the AWS Key Management Service Developer Guide. 6. Choose Save. Create a Session Manager preferences document (command line) Use the following procedure to create SSM documents that define your preferences for AWS Systems Manager Session Manager sessions. You can use the document to configure session options including data encryption, session duration, and logging. For example, you can specify whether to store session log data in an Amazon Simple Storage Service (Amazon S3) bucket or Amazon CloudWatch Logs log group. You can create documents that define general preferences for all sessions for an AWS account and AWS Region, or that define preferences for individual sessions. Note You can also configure general session preferences by using the Session Manager console. Documents used to set Session Manager preferences must have a sessionType of Standard_Stream. For more information about Session documents, see the section called “Session document schema”. For information about using the command line to update existing Session Manager preferences, see Update Session Manager preferences (command line). Session Manager 883 AWS Systems Manager User Guide For an example of how to create session preferences using AWS CloudFormation, see Create a Systems Manager document for Session Manager preferences in the AWS CloudFormation User Guide. Note This procedure describes how to create documents for setting Session Manager preferences at the AWS account level. To create documents that will be used for setting session-level preferences, specify a value other than SSM-SessionManagerRunShell for the file name related command inputs . To use your document to set preferences for sessions started from the AWS Command Line Interface (AWS CLI), provide the document name as the --document-name parameter value. To set preferences for sessions started from the Session Manager console, you can type or select the name of your document from a list. To create Session Manager preferences (command line) 1. Create a JSON file on your local machine with a name such as SessionManagerRunShell.json, and then paste the following content into it. { "schemaVersion": "1.0", "description": "Document to hold regional settings for Session Manager", "sessionType": "Standard_Stream", "inputs": { "s3BucketName": "", "s3KeyPrefix": "", "s3EncryptionEnabled": true, "cloudWatchLogGroupName": "", "cloudWatchEncryptionEnabled": true, "cloudWatchStreamingEnabled": false, "kmsKeyId": "", "runAsEnabled": false, "runAsDefaultUser": "", "idleSessionTimeout": "", "maxSessionDuration": "", "shellProfile": { "windows": "date", "linux": "pwd;ls" } Session Manager 884 AWS Systems Manager } } User Guide You can also pass values to your session preferences using parameters instead of hardcoding the values as shown in the following example. { "schemaVersion":"1.0", "description":"Session Document Parameter Example JSON Template", "sessionType":"Standard_Stream", "parameters":{ "s3BucketName":{ "type":"String", "default":"" }, "s3KeyPrefix":{ "type":"String", "default":"" }, "s3EncryptionEnabled":{ "type":"Boolean", "default":"false" }, "cloudWatchLogGroupName":{ "type":"String", "default":"" }, "cloudWatchEncryptionEnabled":{ "type":"Boolean", "default":"false" } }, "inputs":{ "s3BucketName":"{{s3BucketName}}", "s3KeyPrefix":"{{s3KeyPrefix}}", "s3EncryptionEnabled":"{{s3EncryptionEnabled}}", "cloudWatchLogGroupName":"{{cloudWatchLogGroupName}}", "cloudWatchEncryptionEnabled":"{{cloudWatchEncryptionEnabled}}", "kmsKeyId":"" } } Session Manager 885 AWS Systems Manager User Guide 2. Specify where you want to send session data. You can specify an S3 bucket name (with an optional prefix) or a CloudWatch Logs log group name. If you want to further encrypt data between local client and managed nodes, provide the KMS key to use for encryption. The following is an example. { "schemaVersion": "1.0", "description": "Document to hold regional settings for Session Manager", "sessionType": "Standard_Stream", "inputs": { "s3BucketName": "amzn-s3-demo-bucket", "s3KeyPrefix": "MyS3Prefix", "s3EncryptionEnabled": true, "cloudWatchLogGroupName": "MyLogGroupName", "cloudWatchEncryptionEnabled": true, "cloudWatchStreamingEnabled": false, "kmsKeyId": "MyKMSKeyID", "runAsEnabled": true, "runAsDefaultUser": "MyDefaultRunAsUser", "idleSessionTimeout": "20", "maxSessionDuration": "60", "shellProfile": { "windows": "MyCommands", "linux": "MyCommands" } } } Note If you don't want to encrypt the session log data, change true to false for s3EncryptionEnabled. If you aren't sending logs to either an Amazon S3 bucket or a CloudWatch Logs log group, don't want to encrypt active session data, or
|
systems-manager-ug-277
|
systems-manager-ug.pdf
| 277 |
KMS key to use for encryption. The following is an example. { "schemaVersion": "1.0", "description": "Document to hold regional settings for Session Manager", "sessionType": "Standard_Stream", "inputs": { "s3BucketName": "amzn-s3-demo-bucket", "s3KeyPrefix": "MyS3Prefix", "s3EncryptionEnabled": true, "cloudWatchLogGroupName": "MyLogGroupName", "cloudWatchEncryptionEnabled": true, "cloudWatchStreamingEnabled": false, "kmsKeyId": "MyKMSKeyID", "runAsEnabled": true, "runAsDefaultUser": "MyDefaultRunAsUser", "idleSessionTimeout": "20", "maxSessionDuration": "60", "shellProfile": { "windows": "MyCommands", "linux": "MyCommands" } } } Note If you don't want to encrypt the session log data, change true to false for s3EncryptionEnabled. If you aren't sending logs to either an Amazon S3 bucket or a CloudWatch Logs log group, don't want to encrypt active session data, or don't want to turn on Run As support for the sessions in your account, you can delete the lines for those options. Make sure the last line in the inputs section doesn't end with a comma. If you add a KMS key ID to encrypt your session data, both the users who start sessions and the managed nodes that they connect to must have permission to use the key. You provide permission to use the KMS key with Session Manager through IAM policies. For information, see the following topics: Session Manager 886 AWS Systems Manager User Guide • Add AWS KMS permissions for users in your account: Sample IAM policies for Session Manager • Add AWS KMS permissions for managed nodes in your account: Step 2: Verify or add instance permissions for Session Manager 3. 4. Save the file. In the directory where you created the JSON file, run the following command. Linux & macOS aws ssm create-document \ --name SSM-SessionManagerRunShell \ --content "file://SessionManagerRunShell.json" \ --document-type "Session" \ --document-format JSON Windows aws ssm create-document ^ --name SSM-SessionManagerRunShell ^ --content "file://SessionManagerRunShell.json" ^ --document-type "Session" ^ --document-format JSON PowerShell New-SSMDocument ` -Name "SSM-SessionManagerRunShell" ` -Content (Get-Content -Raw SessionManagerRunShell.json) ` -DocumentType "Session" ` -DocumentFormat JSON If successful, the command returns output similar to the following. { "DocumentDescription": { "Status": "Creating", "Hash": "ce4fd0a2ab9b0fae759004ba603174c3ec2231f21a81db8690a33eb66EXAMPLE", Session Manager 887 AWS Systems Manager User Guide "Name": "SSM-SessionManagerRunShell", "Tags": [], "DocumentType": "Session", "PlatformTypes": [ "Windows", "Linux" ], "DocumentVersion": "1", "HashType": "Sha256", "CreatedDate": 1547750660.918, "Owner": "111122223333", "SchemaVersion": "1.0", "DefaultVersion": "1", "DocumentFormat": "JSON", "LatestVersion": "1" } } Update Session Manager preferences (command line) The following procedure describes how to use your preferred command line tool to make changes to the AWS Systems Manager Session Manager preferences for your AWS account in the selected AWS Region. Use Session Manager preferences to specify options for logging session data in an Amazon Simple Storage Service (Amazon S3) bucket or Amazon CloudWatch Logs log group. You can also use Session Manager preferences to encrypt your session data. To update Session Manager preferences (command line) 1. Create a JSON file on your local machine with a name such as SessionManagerRunShell.json, and then paste the following content into it. { "schemaVersion": "1.0", "description": "Document to hold regional settings for Session Manager", "sessionType": "Standard_Stream", "inputs": { "s3BucketName": "", "s3KeyPrefix": "", "s3EncryptionEnabled": true, "cloudWatchLogGroupName": "", "cloudWatchEncryptionEnabled": true, Session Manager 888 AWS Systems Manager User Guide "cloudWatchStreamingEnabled": false, "kmsKeyId": "", "runAsEnabled": true, "runAsDefaultUser": "", "idleSessionTimeout": "", "maxSessionDuration": "", "shellProfile": { "windows": "date", "linux": "pwd;ls" } } } 2. Specify where you want to send session data. You can specify an S3 bucket name (with an optional prefix) or a CloudWatch Logs log group name. If you want to further encrypt data between local client and managed nodes, provide the AWS KMS key to use for encryption. The following is an example. { "schemaVersion": "1.0", "description": "Document to hold regional settings for Session Manager", "sessionType": "Standard_Stream", "inputs": { "s3BucketName": "amzn-s3-demo-bucket", "s3KeyPrefix": "MyS3Prefix", "s3EncryptionEnabled": true, "cloudWatchLogGroupName": "MyLogGroupName", "cloudWatchEncryptionEnabled": true, "cloudWatchStreamingEnabled": false, "kmsKeyId": "MyKMSKeyID", "runAsEnabled": true, "runAsDefaultUser": "MyDefaultRunAsUser", "idleSessionTimeout": "20", "maxSessionDuration": "60", "shellProfile": { "windows": "MyCommands", "linux": "MyCommands" } } } Session Manager 889 AWS Systems Manager Note User Guide If you don't want to encrypt the session log data, change true to false for s3EncryptionEnabled. If you aren't sending logs to either an Amazon S3 bucket or a CloudWatch Logs log group, don't want to encrypt active session data, or don't want to turn on Run As support for the sessions in your account, you can delete the lines for those options. Make sure the last line in the inputs section doesn't end with a comma. If you add a KMS key ID to encrypt your session data, both the users who start sessions and the managed nodes that they connect to must have permission to use the key. You provide permission to use the KMS key with Session Manager through AWS Identity and Access Management (IAM) policies. For information, see the following topics: • Add AWS KMS permissions for users in your account: Sample IAM policies for Session Manager. • Add AWS KMS permissions for managed nodes in your account: Step 2: Verify or add instance permissions for Session Manager. 3.
|
systems-manager-ug-278
|
systems-manager-ug.pdf
| 278 |
end with a comma. If you add a KMS key ID to encrypt your session data, both the users who start sessions and the managed nodes that they connect to must have permission to use the key. You provide permission to use the KMS key with Session Manager through AWS Identity and Access Management (IAM) policies. For information, see the following topics: • Add AWS KMS permissions for users in your account: Sample IAM policies for Session Manager. • Add AWS KMS permissions for managed nodes in your account: Step 2: Verify or add instance permissions for Session Manager. 3. 4. Save the file. In the directory where you created the JSON file, run the following command. Linux & macOS aws ssm update-document \ --name "SSM-SessionManagerRunShell" \ --content "file://SessionManagerRunShell.json" \ --document-version "\$LATEST" Windows aws ssm update-document ^ --name "SSM-SessionManagerRunShell" ^ --content "file://SessionManagerRunShell.json" ^ --document-version "$LATEST" PowerShell Update-SSMDocument ` Session Manager 890 AWS Systems Manager User Guide -Name "SSM-SessionManagerRunShell" ` -Content (Get-Content -Raw SessionManagerRunShell.json) ` -DocumentVersion '$LATEST' If successful, the command returns output similar to the following. { "DocumentDescription": { "Status": "Updating", "Hash": "ce4fd0a2ab9b0fae759004ba603174c3ec2231f21a81db8690a33eb66EXAMPLE", "Name": "SSM-SessionManagerRunShell", "Tags": [], "DocumentType": "Session", "PlatformTypes": [ "Windows", "Linux" ], "DocumentVersion": "2", "HashType": "Sha256", "CreatedDate": 1537206341.565, "Owner": "111122223333", "SchemaVersion": "1.0", "DefaultVersion": "1", "DocumentFormat": "JSON", "LatestVersion": "2" } } Step 5: (Optional) Restrict access to commands in a session You can restrict the commands that a user can run in an AWS Systems Manager Session Manager session by using a custom Session type AWS Systems Manager (SSM) document. In the document, you define the command that is run when the user starts a session and the parameters that the user can provide to the command. The Session document schemaVersion must be 1.0, and the sessionType of the document must be InteractiveCommands. You can then create AWS Identity and Access Management (IAM) policies that allow users to access only the Session documents that you define. For more information about using IAM policies to restrict access to commands in a session, see IAM policy examples for interactive commands. Session Manager 891 AWS Systems Manager User Guide Documents with the sessionType of InteractiveCommands are only supported for sessions started from the AWS Command Line Interface (AWS CLI). The user provides the custom document name as the --document-name parameter value and provides any command parameter values using the --parameters option. For more information about running interactive commands, see Starting a session (interactive and noninteractive commands). Use following procedure to create a custom Session type SSM document that defines the command a user is allowed to run. Restrict access to commands in a session (console) To restrict the commands a user can run in a Session Manager session (console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Documents. 3. Choose Create command or session. 4. 5. 6. For Name, enter a descriptive name for the document. For Document type, choose Session document. Enter your document content that defines the command a user can run in a Session Manager session using JSON or YAML, as shown in the following example. YAML --- schemaVersion: '1.0' description: Document to view a log file on a Linux instance sessionType: InteractiveCommands parameters: logpath: type: String description: The log file path to read. default: "/var/log/amazon/ssm/amazon-ssm-agent.log" allowedPattern: "^[a-zA-Z0-9-_/]+(.log)$" properties: linux: commands: "tail -f {{ logpath }}" runAsElevated: true Session Manager 892 AWS Systems Manager JSON { User Guide "schemaVersion": "1.0", "description": "Document to view a log file on a Linux instance", "sessionType": "InteractiveCommands", "parameters": { "logpath": { "type": "String", "description": "The log file path to read.", "default": "/var/log/amazon/ssm/amazon-ssm-agent.log", "allowedPattern": "^[a-zA-Z0-9-_/]+(.log)$" } }, "properties": { "linux": { "commands": "tail -f {{ logpath }}", "runAsElevated": true } } } 7. Choose Create document. Restrict access to commands in a session (command line) Before you begin If you haven't already, install and configure the AWS Command Line Interface (AWS CLI) or the AWS Tools for PowerShell. For information, see Installing or updating the latest version of the AWS CLI and Installing the AWS Tools for PowerShell. To restrict the commands a user can run in a Session Manager session (command line) 1. Create a JSON or YAML file for your document content that defines the command a user can run in a Session Manager session, as shown in the following example. YAML --- schemaVersion: '1.0' Session Manager 893 AWS Systems Manager User Guide description: Document to view a log file on a Linux instance sessionType: InteractiveCommands parameters: logpath: type: String description: The log file path to read. default: "/var/log/amazon/ssm/amazon-ssm-agent.log" allowedPattern: "^[a-zA-Z0-9-_/]+(.log)$" properties: linux: commands: "tail -f {{ logpath }}" runAsElevated: true JSON { "schemaVersion": "1.0", "description": "Document to view a log file on a Linux instance", "sessionType": "InteractiveCommands", "parameters": { "logpath": { "type": "String", "description": "The log file path to read.", "default": "/var/log/amazon/ssm/amazon-ssm-agent.log", "allowedPattern":
|
systems-manager-ug-279
|
systems-manager-ug.pdf
| 279 |
the command a user can run in a Session Manager session, as shown in the following example. YAML --- schemaVersion: '1.0' Session Manager 893 AWS Systems Manager User Guide description: Document to view a log file on a Linux instance sessionType: InteractiveCommands parameters: logpath: type: String description: The log file path to read. default: "/var/log/amazon/ssm/amazon-ssm-agent.log" allowedPattern: "^[a-zA-Z0-9-_/]+(.log)$" properties: linux: commands: "tail -f {{ logpath }}" runAsElevated: true JSON { "schemaVersion": "1.0", "description": "Document to view a log file on a Linux instance", "sessionType": "InteractiveCommands", "parameters": { "logpath": { "type": "String", "description": "The log file path to read.", "default": "/var/log/amazon/ssm/amazon-ssm-agent.log", "allowedPattern": "^[a-zA-Z0-9-_/]+(.log)$" } }, "properties": { "linux": { "commands": "tail -f {{ logpath }}", "runAsElevated": true } } } 2. Run the following commands to create an SSM document using your content that defines the command a user can run in a Session Manager session. Linux & macOS aws ssm create-document \ --content file://path/to/file/documentContent.json \ --name "exampleAllowedSessionDocument" \ Session Manager 894 AWS Systems Manager User Guide --document-type "Session" Windows aws ssm create-document ^ --content file://C:\path\to\file\documentContent.json ^ --name "exampleAllowedSessionDocument" ^ --document-type "Session" PowerShell $json = Get-Content -Path "C:\path\to\file\documentContent.json" | Out-String New-SSMDocument ` -Content $json ` -Name "exampleAllowedSessionDocument" ` -DocumentType "Session" Interactive command parameters and the AWS CLI There are a variety of ways you can provide interactive command parameters when using the AWS CLI. Depending on the operating system (OS) of your client machine that you use to connect to managed nodes with the AWS CLI, the syntax you provide for commands that contain special or escape characters might differ. The following examples show some of the different ways you can provide command parameters when using the AWS CLI, and how to handle special or escape characters. Parameters stored in Parameter Store can be referenced in the AWS CLI for your command parameters as shown in the following example. Linux & macOS aws ssm start-session \ --target instance-id \ --document-name MyInteractiveCommandDocument \ --parameters '{"command":["{{ssm:mycommand}}"]}' Windows aws ssm start-session ^ Session Manager 895 AWS Systems Manager User Guide --target instance-id ^ --document-name MyInteractiveCommandDocument ^ --parameters '{"command":["{{ssm:mycommand}}"]}' The following example shows how you can use a shorthand syntax with the AWS CLI to pass parameters. Linux & macOS aws ssm start-session \ --target instance-id \ --document-name MyInteractiveCommandDocument \ --parameters command="ifconfig" Windows aws ssm start-session ^ --target instance-id ^ --document-name MyInteractiveCommandDocument ^ --parameters command="ipconfig" You can also provide parameters in JSON as shown in the following example. Linux & macOS aws ssm start-session \ --target instance-id \ --document-name MyInteractiveCommandDocument \ --parameters '{"command":["ifconfig"]}' Windows aws ssm start-session ^ --target instance-id ^ --document-name MyInteractiveCommandDocument ^ --parameters '{"command":["ipconfig"]}' Session Manager 896 AWS Systems Manager User Guide Parameters can also be stored in a JSON file and provided to the AWS CLI as shown in the following example. For more information about using AWS CLI parameters from a file, see Loading AWS CLI parameters from a file in the AWS Command Line Interface User Guide. { "command": [ "my command" ] } Linux & macOS aws ssm start-session \ --target instance-id \ --document-name MyInteractiveCommandDocument \ --parameters file://complete/path/to/file/parameters.json Windows aws ssm start-session ^ --target instance-id ^ --document-name MyInteractiveCommandDocument ^ --parameters file://complete/path/to/file/parameters.json You can also generate an AWS CLI skeleton from a JSON input file as shown in the following example. For more information about generating AWS CLI skeletons from JSON input files, see Generating AWS CLI skeleton and input parameters from a JSON or YAML input file in the AWS Command Line Interface User Guide. { "Target": "instance-id", "DocumentName": "MyInteractiveCommandDocument", "Parameters": { "command": [ "my command" ] } } Session Manager 897 AWS Systems Manager Linux & macOS User Guide aws ssm start-session \ --cli-input-json file://complete/path/to/file/parameters.json Windows aws ssm start-session ^ --cli-input-json file://complete/path/to/file/parameters.json To escape characters inside quotation marks, you must add additional backslashes to the escape characters as shown in the following example. Linux & macOS aws ssm start-session \ --target instance-id \ --document-name MyInteractiveCommandDocument \ --parameters '{"command":["printf \"abc\\\\tdef\""]}' Windows aws ssm start-session ^ --target instance-id ^ --document-name MyInteractiveCommandDocument ^ --parameters '{"command":["printf \"abc\\\\tdef\""]}' For information about using quotation marks with command parameters in the AWS CLI, see Using quotation marks with strings in the AWS CLI in the AWS Command Line Interface User Guide. IAM policy examples for interactive commands You can create IAM policies that allow users to access only the Session documents you define. This restricts the commands a user can run in a Session Manager session to only the commands defined in your custom Session type SSM documents. Allow a user to run an interactive command on a single managed node { Session Manager 898 AWS Systems Manager User Guide "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":"ssm:StartSession", "Resource":[ "arn:aws:ec2:region:987654321098:instance/i-02573cafcfEXAMPLE", "arn:aws:ssm:region:987654321098:document/exampleAllowedSessionDocument" ] } ] }, { "Effect": "Allow", "Action": ["ssmmessages:OpenDataChannel"], "Resource": ["arn:aws:ssm:*:*:session/${aws:userid}-*"] } Allow a user to run an interactive command on all managed nodes { "Version":"2012-10-17", "Statement":[ {
|
systems-manager-ug-280
|
systems-manager-ug.pdf
| 280 |
commands You can create IAM policies that allow users to access only the Session documents you define. This restricts the commands a user can run in a Session Manager session to only the commands defined in your custom Session type SSM documents. Allow a user to run an interactive command on a single managed node { Session Manager 898 AWS Systems Manager User Guide "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":"ssm:StartSession", "Resource":[ "arn:aws:ec2:region:987654321098:instance/i-02573cafcfEXAMPLE", "arn:aws:ssm:region:987654321098:document/exampleAllowedSessionDocument" ] } ] }, { "Effect": "Allow", "Action": ["ssmmessages:OpenDataChannel"], "Resource": ["arn:aws:ssm:*:*:session/${aws:userid}-*"] } Allow a user to run an interactive command on all managed nodes { "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":"ssm:StartSession", "Resource":[ "arn:aws:ec2:us-west-2:987654321098:instance/*", "arn:aws:ssm:us- west-2:987654321098:document/exampleAllowedSessionDocument" ] } ] }, { "Effect": "Allow", "Action": ["ssmmessages:OpenDataChannel"], "Resource": ["arn:aws:ssm:*:*:session/${aws:userid}-*"] } Allow a user to run multiple interactive commands on all managed nodes { Session Manager 899 AWS Systems Manager User Guide "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":"ssm:StartSession", "Resource":[ "arn:aws:ec2:us-west-2:987654321098:instance/*", "arn:aws:ssm:us- west-2:987654321098:document/exampleAllowedSessionDocument", "arn:aws:ssm:us- west-2:987654321098:document/exampleAllowedSessionDocument2" ] } ] }, { "Effect": "Allow", "Action": ["ssmmessages:OpenDataChannel"], "Resource": ["arn:aws:ssm:*:*:session/${aws:userid}-*"] } Step 6: (Optional) Use AWS PrivateLink to set up a VPC endpoint for Session Manager You can further improve the security posture of your managed nodes by configuring AWS Systems Manager to use an interface virtual private cloud (VPC) endpoint. Interface endpoints are powered by AWS PrivateLink, a technology that allows you to privately access Amazon Elastic Compute Cloud (Amazon EC2) and Systems Manager APIs by using private IP addresses. AWS PrivateLink restricts all network traffic between your managed nodes, Systems Manager, and Amazon EC2 to the Amazon network. (Managed nodes don't have access to the internet.) Also, you don't need an internet gateway, a NAT device, or a virtual private gateway. For information about creating a VPC endpoint, see Improve the security of EC2 instances by using VPC endpoints for Systems Manager. The alternative to using a VPC endpoint is to allow outbound internet access on your managed nodes. In this case, the managed nodes must also allow HTTPS (port 443) outbound traffic to the following endpoints: • ec2messages.region.amazonaws.com • ssm.region.amazonaws.com Session Manager 900 AWS Systems Manager User Guide • ssmmessages.region.amazonaws.com Systems Manager uses the last of these endpoints, ssmmessages.region.amazonaws.com, to make calls from SSM Agent to the Session Manager service in the cloud. To use optional features like AWS Key Management Service (AWS KMS) encryption, streaming logs to Amazon CloudWatch Logs (CloudWatch Logs), and sending logs to Amazon Simple Storage Service (Amazon S3) you must allow HTTPS (port 443) outbound traffic to the following endpoints: • kms.region.amazonaws.com • logs.region.amazonaws.com • s3.region.amazonaws.com For more information about required endpoints for Systems Manager, see Reference: ec2messages, ssmmessages, and other API operations. Step 7: (Optional) Turn on or turn off ssm-user account administrative permissions Starting with version 2.3.50.0 of AWS Systems Manager SSM Agent, the agent creates a local user account called ssm-user and adds it to /etc/sudoers (Linux and macOS) or to the Administrators group (Windows). On agent versions earlier than 2.3.612.0, the account is created the first time SSM Agent starts or restarts after installation. On version 2.3.612.0 and later, the ssm-user account is created the first time a session is started on a node. This ssm-user is the default operating system (OS) user when a AWS Systems Manager Session Manager session is started. SSM Agent version 2.3.612.0 was released on May 8th, 2019. If you want to prevent Session Manager users from running administrative commands on a node, you can update the ssm-user account permissions. You can also restore these permissions after they have been removed. Topics • Managing ssm-user sudo account permissions on Linux and macOS • Managing ssm-user Administrator account permissions on Windows Server Managing ssm-user sudo account permissions on Linux and macOS Use one of the following procedures to turn on or turn off the ssm-user account sudo permissions on Linux and macOS managed nodes. Session Manager 901 AWS Systems Manager User Guide Use Run Command to modify ssm-user sudo permissions (console) • Use the procedure in Running commands from the console with the following values: • For Command document, choose AWS-RunShellScript. • To remove sudo access, in the Command parameters area, paste the following in the Commands box. cd /etc/sudoers.d echo "#User rules for ssm-user" > ssm-agent-users -or- To restore sudo access, in the Command parameters area, paste the following in the Commands box. cd /etc/sudoers.d echo "ssm-user ALL=(ALL) NOPASSWD:ALL" > ssm-agent-users Use the command line to modify ssm-user sudo permissions (AWS CLI) 1. Connect to the managed node and run the following command. sudo -s 2. Change the working directory using the following command. cd /etc/sudoers.d 3. Open the file named ssm-agent-users for editing. 4. To remove sudo access, delete the following line. ssm-user ALL=(ALL) NOPASSWD:ALL -or- To restore sudo access, add the following line. Session Manager 902 AWS Systems Manager User Guide ssm-user ALL=(ALL) NOPASSWD:ALL 5. Save the file. Managing ssm-user
|
systems-manager-ug-281
|
systems-manager-ug.pdf
| 281 |
the Command parameters area, paste the following in the Commands box. cd /etc/sudoers.d echo "ssm-user ALL=(ALL) NOPASSWD:ALL" > ssm-agent-users Use the command line to modify ssm-user sudo permissions (AWS CLI) 1. Connect to the managed node and run the following command. sudo -s 2. Change the working directory using the following command. cd /etc/sudoers.d 3. Open the file named ssm-agent-users for editing. 4. To remove sudo access, delete the following line. ssm-user ALL=(ALL) NOPASSWD:ALL -or- To restore sudo access, add the following line. Session Manager 902 AWS Systems Manager User Guide ssm-user ALL=(ALL) NOPASSWD:ALL 5. Save the file. Managing ssm-user Administrator account permissions on Windows Server Use one of the following procedures to turn on or turn off the ssm-user account Administrator permissions on Windows Server managed nodes. Use Run Command to modify Administrator permissions (console) • Use the procedure in Running commands from the console with the following values: For Command document, choose AWS-RunPowerShellScript. To remove administrative access, in the Command parameters area, paste the following in the Commands box. net localgroup "Administrators" "ssm-user" /delete -or- To restore administrative access, in the Command parameters area, paste the following in the Commands box. net localgroup "Administrators" "ssm-user" /add Use the PowerShell or command prompt window to modify Administrator permissions 1. Connect to the managed node and open the PowerShell or Command Prompt window. 2. To remove administrative access, run the following command. net localgroup "Administrators" "ssm-user" /delete -or- To restore administrative access, run the following command. Session Manager 903 AWS Systems Manager User Guide net localgroup "Administrators" "ssm-user" /add Use the Windows console to modify Administrator permissions 1. Connect to the managed node and open the PowerShell or Command Prompt window. 2. From the command line, run lusrmgr.msc to open the Local Users and Groups console. 3. Open the Users directory, and then open ssm-user. 4. On the Member Of tab, do one of the following: • To remove administrative access, select Administrators, and then choose Remove. -or- To restore administrative access, enter Administrators in the text box, and then choose Add. 5. Choose OK. Step 8: (Optional) Allow and control permissions for SSH connections through Session Manager You can allow users in your AWS account to use the AWS Command Line Interface (AWS CLI) to establish Secure Shell (SSH) connections to managed nodes using AWS Systems Manager Session Manager. Users who connect using SSH can also copy files between their local machines and managed nodes using Secure Copy Protocol (SCP). You can use this functionality to connect to managed nodes without opening inbound ports or maintaining bastion hosts. After allowing SSH connections, you can use AWS Identity and Access Management (IAM) policies to explicitly allow or deny users, groups, or roles to make SSH connections using Session Manager. Note Logging isn't available for Session Manager sessions that connect through port forwarding or SSH. This is because SSH encrypts all session data, and Session Manager only serves as a tunnel for SSH connections. Topics Session Manager 904 AWS Systems Manager User Guide • Allowing SSH connections for Session Manager • Controlling user permissions for SSH connections through Session Manager Allowing SSH connections for Session Manager Use the following steps to allow SSH connections through Session Manager on a managed node. To allow SSH connections for Session Manager 1. On the managed node to which you want to allow SSH connections, do the following: • Ensure that SSH is running on the managed node. (You can close inbound ports on the node.) • Ensure that SSM Agent version 2.3.672.0 or later is installed on the managed node. For information about installing or updating SSM Agent on a managed node, see the following topics: • Manually installing and uninstalling SSM Agent on EC2 instances for Windows Server. • Manually installing and uninstalling SSM Agent on EC2 instances for Linux • Manually installing and uninstalling SSM Agent on EC2 instances for macOS • How to install the SSM Agent on hybrid Windows nodes • How to install the SSM Agent on hybrid Linux nodes Note To use Session Manager with on-premises servers, edge devices, and virtual machines (VMs) that you activated as managed nodes, you must use the advanced- instances tier. For more information about advanced instances, see Configuring instance tiers. 2. On the local machine from which you want to connect to a managed node using SSH, do the following: • Ensure that version 1.1.23.0 or later of the Session Manager plugin is installed. For information about installing the Session Manager plugin, see Install the Session Manager plugin for the AWS CLI. Session Manager 905 AWS Systems Manager User Guide • Update the SSH configuration file to allow running a proxy command that starts a Session Manager session and transfer all data through the connection. Linux and macOS Tip The SSH configuration
|
systems-manager-ug-282
|
systems-manager-ug.pdf
| 282 |
information about advanced instances, see Configuring instance tiers. 2. On the local machine from which you want to connect to a managed node using SSH, do the following: • Ensure that version 1.1.23.0 or later of the Session Manager plugin is installed. For information about installing the Session Manager plugin, see Install the Session Manager plugin for the AWS CLI. Session Manager 905 AWS Systems Manager User Guide • Update the SSH configuration file to allow running a proxy command that starts a Session Manager session and transfer all data through the connection. Linux and macOS Tip The SSH configuration file is typically located at ~/.ssh/config. Add the following to the configuration file on the local machine. # SSH over Session Manager Host i-* mi-* ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS- StartSSHSession --parameters 'portNumber=%p'" User ec2-user Windows Tip The SSH configuration file is typically located at C:\Users\<username>\.ssh \config. Add the following to the configuration file on the local machine. # SSH over Session Manager Host i-* mi-* ProxyCommand C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters portNumber=%p" • Create or verify that you have a Privacy Enhanced Mail certificate (a PEM file), or at minimum a public key, to use when establishing connections to managed nodes. This must be a key that is already associated with the managed node. The permissions of your private key file must be set so that only you can read it. You can use the following command to set the permissions of your private key file so that only you can read it. Session Manager 906 AWS Systems Manager User Guide chmod 400 <my-key-pair>.pem For example, for an Amazon Elastic Compute Cloud (Amazon EC2) instance, the key pair file you created or selected when you created the instance. (You specify the path to the certificate or key as part of the command to start a session. For information about starting a session using SSH, see Starting a session (SSH).) Controlling user permissions for SSH connections through Session Manager After you enable SSH connections through Session Manager on a managed node, you can use IAM policies to allow or deny users, groups, or roles the ability to make SSH connections through Session Manager. To use an IAM policy to allow SSH connections through Session Manager • Use one of the following options: • Option 1: Open the IAM console at https://console.aws.amazon.com/iam/. In the navigation pane, choose Policies, and then update the permissions policy for the user or role you want to allow to start SSH connections through Session Manager. For example, add the following element to the Quickstart policy you created in Quickstart end user policies for Session Manager. Replace each example resource placeholder with your own information. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "ssm:StartSession", "Resource": [ "arn:aws:ec2:region:account-id:instance/instance-id", "arn:aws:ssm:*:*:document/AWS-StartSSHSession" ] } ] }, { Session Manager 907 AWS Systems Manager User Guide "Effect": "Allow", "Action": ["ssmmessages:OpenDataChannel"], "Resource": ["arn:aws:ssm:*:*:session/${aws:userid}-*"] } • Option 2: Attach an inline policy to a user policy by using the AWS Management Console, the AWS CLI, or the AWS API. Using the method of your choice, attach the policy statement in Option 1 to the policy for an AWS user, group, or role. For information, see Adding and Removing IAM Identity Permissions in the IAM User Guide. To use an IAM policy to deny SSH connections through Session Manager • Use one of the following options: • Option 1: Open the IAM console at https://console.aws.amazon.com/iam/. In the navigation pane, choose Policies, and then update the permissions policy for the user or role to block from starting Session Manager sessions. For example, add the following element to the Quickstart policy you created in Quickstart end user policies for Session Manager. { "Version": "2012-10-17", "Statement": [ { "Effect": "Deny", "Action": "ssm:StartSession", "Resource": "arn:aws:ssm:*:*:document/AWS-StartSSHSession" } ] }, { "Effect": "Allow", "Action": ["ssmmessages:OpenDataChannel"], "Resource": ["arn:aws:ssm:*:*:session/${aws:userid}-*"] } • Option 2: Attach an inline policy to a user policy by using the AWS Management Console, the AWS CLI, or the AWS API. Session Manager 908 AWS Systems Manager User Guide Using the method of your choice, attach the policy statement in Option 1 to the policy for an AWS user, group, or role. For information, see Adding and Removing IAM Identity Permissions in the IAM User Guide. Working with Session Manager You can use the AWS Systems Manager console, the Amazon Elastic Compute Cloud (Amazon EC2) console, or the AWS Command Line Interface (AWS CLI) to start sessions that connect you to the managed nodes your system administrator has granted you access to using AWS Identity and Access Management (IAM) policies. Depending on your permissions, you can also view information about sessions, resume inactive sessions that haven't timed out, and end sessions. After a session is established, it is not affected
|
systems-manager-ug-283
|
systems-manager-ug.pdf
| 283 |
or role. For information, see Adding and Removing IAM Identity Permissions in the IAM User Guide. Working with Session Manager You can use the AWS Systems Manager console, the Amazon Elastic Compute Cloud (Amazon EC2) console, or the AWS Command Line Interface (AWS CLI) to start sessions that connect you to the managed nodes your system administrator has granted you access to using AWS Identity and Access Management (IAM) policies. Depending on your permissions, you can also view information about sessions, resume inactive sessions that haven't timed out, and end sessions. After a session is established, it is not affected by IAM role session duration. For information about limiting session duration with Session Manager, see Specify an idle session timeout value and Specify maximum session duration. For more information about sessions, see What is a session? Topics • Install the Session Manager plugin for the AWS CLI • Start a session • End a session • View session history Install the Session Manager plugin for the AWS CLI To initiate Session Manager sessions with your managed nodes by using the AWS Command Line Interface (AWS CLI), you must install the Session Manager plugin on your local machine. You can install the plugin on supported versions of Microsoft Windows Server, macOS, Linux, and Ubuntu Server. Note To use the Session Manager plugin, you must have AWS CLI version 1.16.12 or later installed on your local machine. For more information, see Installing or updating the latest version of the AWS Command Line Interface. Session Manager 909 User Guide AWS Systems Manager Topics • Session Manager plugin latest version and release history • Install the Session Manager plugin on Windows • Install the Session Manager plugin on macOS • Install the Session Manager plugin on Linux • Verify the Session Manager plugin installation • Session Manager plugin on GitHub • (Optional) Turn on Session Manager plugin logging Session Manager plugin latest version and release history Your local machine must be running a supported version of the Session Manager plugin. The current minimum supported version is 1.1.17.0. If you're running an earlier version, your Session Manager operations might not succeed. To see if you have the latest version, run the following command in the AWS CLI. Note The command returns results only if the plugin is located in the default installation directory for your operating system type. You can also check the version in the contents of the VERSION file in the directory where you have installed the plugin. session-manager-plugin --version The following table lists all releases of the Session Manager plugin and the features and enhancements included with each version. Important We recommend you always run the latest version. The latest version includes enhancements that improve the experience of using the plugin. Session Manager 910 AWS Systems Manager User Guide Version Release date Details 1.2.707.0 February 6, 2025 Enhancement: Upgraded the Go version to 1.23 in the Dockerfile. Updated the version configuration step in the README. 1.2.694.0 November 20, 2024 Bug fix: Rolled back change that added credentials to OpenDataChannel requests. 1.2.688.0 November 6, 2024 This version was deprecated on 11/20/2024. Enhancements: • Added credentials to OpenDataChannel requests. • Upgraded the testify and objx dependent packages. 1.2.677.0 October 10, 2024 Enhancement: Added support for passing the plugin version with OpenDataChannel requests. 1.2.650.0 July 02, 2024 Enhancement: Upgraded aws-sdk-go to 1.54.10. Bug fix: Reformated comments for gofmt check. 1.2.633.0 May 30, 2024 Enhancement: Updated the Dockerfile to use an Amazon Elastic Container Registry (Amazon ECR) image. 1.2.553.0 January 10, 2024 Enhancement: Upgraded aws-sdk-go and dependent Golang packages. 1.2.536.0 December 4, 2023 Enhancement: Added support for passing a StartSession API response as an environment variable to session-manager-pl ugin. 1.2.497.0 August 1, 2023 Enhancement: Upgraded Go SDK to v1.44.302. 1.2.463.0 March 15, 2023 Enhancement: Added Mac with Apple silicon support for Apple Mac (M1) in macOS bundle installer and signed installer. Session Manager 911 AWS Systems Manager User Guide Version Release date Details 1.2.398.0 October 14, 2022 Enhancement: Support golang version 1.17. Update default session-manager-plugin runner for macOS to use python3. Update import path from SSMCLI to session-manager-pl ugin. 1.2.339.0 June 16, 2022 Bug fix: Fix idle session timeout for port sessions. 1.2.331.0 May 27, 2022 Bug fix: Fix port sessions closing prematurely when the local server doesn't connect before timeout. 1.2.323.0 May 19, 2022 Bug fix: Disable smux keep alive to use idle session timeout feature. 1.2.312.0 March 31, 2022 Enhancement: Supports more output message payload types. 1.2.295.0 January 12, 2022 Bug fix: Hung sessions caused by client resending stream data when agent becomes inactive, and incorrect logs for start_publication and pause_publication messages. 1.2.279.0 October 27, 2021 Enhancement: Zip packaging for Windows platform. 1.2.245.0 August 19, 2021 Enhancement: Upgrade aws-sdk-go to latest version (v1.40.17) to support AWS IAM Identity Center. 1.2.234.0 July 26, 2021 Bug
|
systems-manager-ug-284
|
systems-manager-ug.pdf
| 284 |
Bug fix: Fix port sessions closing prematurely when the local server doesn't connect before timeout. 1.2.323.0 May 19, 2022 Bug fix: Disable smux keep alive to use idle session timeout feature. 1.2.312.0 March 31, 2022 Enhancement: Supports more output message payload types. 1.2.295.0 January 12, 2022 Bug fix: Hung sessions caused by client resending stream data when agent becomes inactive, and incorrect logs for start_publication and pause_publication messages. 1.2.279.0 October 27, 2021 Enhancement: Zip packaging for Windows platform. 1.2.245.0 August 19, 2021 Enhancement: Upgrade aws-sdk-go to latest version (v1.40.17) to support AWS IAM Identity Center. 1.2.234.0 July 26, 2021 Bug fix: Handle session abruptly terminated scenario in interactive session type. 1.2.205.0 June 10, 2021 Enhancement: Added support for signed macOS installer. 1.2.54.0 January 29, 2021 Enhancement: Added support for running sessions in NonInteractiveCommands execution mode. 1.2.30.0 November 24, 2020 Enhancement: (Port forwarding sessions only) Improved overall performance. Session Manager 912 AWS Systems Manager User Guide Version Release date Details 1.2.7.0 October 15, 2020 Enhancement: (Port forwarding sessions only) Reduced latency and improved overall performance. 1.1.61.0 April 17, 2020 Enhancement: Added ARM support for Linux and Ubuntu. 1.1.54.0 January 6, 2020 Bug fix: Handle race condition scenario of packets being dropped when the Session Manager plugin isn't ready. 1.1.50.0 November 19, 2019 Enhancement: Added support for forwarding a port to a local unix socket. 1.1.35.0 November 7, 2019 Enhancement: (Port forwarding sessions only) Send a TerminateSession command to SSM Agent when the local user presses Ctrl+C. 1.1.33.0 September 26, 2019 Enhancement: (Port forwarding sessions only) Send a disconnect signal to the server when the client drops the TCP connection. 1.1.31.0 September 6, 2019 Enhancement: Update to keep port forwarding session open until remote server closes the connection. 1.1.26.0 July 30, 2019 Enhancement: Update to limit the rate of data transfer during a session. 1.1.23.0 July 9, 2019 Enhancement: Added support for running SSH sessions using Session Manager. 1.1.17.0 April 4, 2019 1.0.37.0 1.0.0.0 September 20, 2018 September 11, 2018 Enhancement: Added support for further encryption of session data using AWS Key Management Service (AWS KMS). Enhancement: Bug fix for Windows version. Initial release of the Session Manager plugin. Session Manager 913 AWS Systems Manager User Guide Install the Session Manager plugin on Windows You can install the Session Manager plugin on Windows Vista or later using the standalone installer. When updates are released, you must repeat the installation process to get the latest version of the Session Manager plugin. Note Note the following information. • The Session Manager plugin installer needs Administrator rights to install the plugin. • For best results, we recommend that you start sessions on Windows clients using Windows PowerShell, version 5 or later. Alternatively, you can use the Command shell in Windows 10. The Session Manager plugin only supports PowerShell and the Command shell. Third-party command line tools might not be compatible with the plugin. To install the Session Manager plugin using the EXE installer 1. Download the installer using the following URL. https://s3.amazonaws.com/session-manager-downloads/plugin/latest/windows/ SessionManagerPluginSetup.exe Alternatively, you can download a zipped version of the installer using the following URL. https://s3.amazonaws.com/session-manager-downloads/plugin/latest/windows/ SessionManagerPlugin.zip 2. Run the downloaded installer, and follow the on-screen instructions. If you downloaded the zipped version of the installer, you must unzip the installer first. Leave the install location box blank to install the plugin to the default directory. • %PROGRAMFILES%\Amazon\SessionManagerPlugin\bin\ 3. Verify that the installation was successful. For information, see Verify the Session Manager plugin installation. Session Manager 914 AWS Systems Manager Note User Guide If Windows is unable to find the executable, you might need to re-open the command prompt or add the installation directory to your PATH environment variable manually. For information, see the troubleshooting topic Session Manager plugin not automatically added to command line path (Windows). Install the Session Manager plugin on macOS Choose one of the following topics to install the Session Manager plugin on macOS. Note The signed installer is a signed .pkg file. The bundled installer uses a .zip file. After the file is unzipped, you can install the plugin using the binary. Install the Session Manager plugin on macOS with the signed installer This section describes how to install the Session Manager plugin on macOS using the signed installer. To install the Session Manager plugin using the signed installer (macOS) 1. Download the signed installer. x86_64 curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/mac/ session-manager-plugin.pkg" -o "session-manager-plugin.pkg" Mac with Apple silicon curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ mac_arm64/session-manager-plugin.pkg" -o "session-manager-plugin.pkg" 2. Run the install commands. If the command fails, verify that the /usr/local/bin folder exists. If it doesn't, create it and run the command again. Session Manager 915 AWS Systems Manager User Guide sudo installer -pkg session-manager-plugin.pkg -target / sudo ln -s /usr/local/sessionmanagerplugin/bin/session-manager-plugin /usr/local/ bin/session-manager-plugin 3. Verify that the installation was successful. For information, see Verify the Session Manager plugin installation. Install the Session Manager plugin on macOS
|
systems-manager-ug-285
|
systems-manager-ug.pdf
| 285 |
installer. To install the Session Manager plugin using the signed installer (macOS) 1. Download the signed installer. x86_64 curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/mac/ session-manager-plugin.pkg" -o "session-manager-plugin.pkg" Mac with Apple silicon curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ mac_arm64/session-manager-plugin.pkg" -o "session-manager-plugin.pkg" 2. Run the install commands. If the command fails, verify that the /usr/local/bin folder exists. If it doesn't, create it and run the command again. Session Manager 915 AWS Systems Manager User Guide sudo installer -pkg session-manager-plugin.pkg -target / sudo ln -s /usr/local/sessionmanagerplugin/bin/session-manager-plugin /usr/local/ bin/session-manager-plugin 3. Verify that the installation was successful. For information, see Verify the Session Manager plugin installation. Install the Session Manager plugin on macOS This section describes how to install the Session Manager plugin on macOS using the bundled installer. Important Note the following important information. • By default, the installer requires sudo access to run, because the script installs the plugin to the /usr/local/sessionmanagerplugin system directory. If you don't want to install the plugin using sudo, manually update the installer script to install the plugin to a directory that doesn't require sudo access. • The bundled installer doesn't support installing to paths that contain spaces. To install the Session Manager plugin using the bundled installer (macOS) 1. Download the bundled installer. x86_64 curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/mac/ sessionmanager-bundle.zip" -o "sessionmanager-bundle.zip" Mac with Apple silicon curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ mac_arm64/sessionmanager-bundle.zip" -o "sessionmanager-bundle.zip" 2. Unzip the package. Session Manager 916 AWS Systems Manager User Guide unzip sessionmanager-bundle.zip 3. Run the install command. sudo ./sessionmanager-bundle/install -i /usr/local/sessionmanagerplugin -b /usr/ local/bin/session-manager-plugin Note The plugin requires either Python 2.6.5 or later, or Python 3.3 or later. By default, the install script runs under the system default version of Python. If you have installed an alternative version of Python and want to use that to install the Session Manager plugin, run the install script with that version by absolute path to the Python executable. The following is an example. sudo /usr/local/bin/python3.8 sessionmanager-bundle/install -i /usr/local/ sessionmanagerplugin -b /usr/local/bin/session-manager-plugin The installer installs the Session Manager plugin at /usr/local/sessionmanagerplugin and creates the symlink session-manager-plugin in the /usr/local/bin directory. This eliminates the need to specify the install directory in the user's $PATH variable. To see an explanation of the -i and -b options, use the -h option. ./sessionmanager-bundle/install -h 4. Verify that the installation was successful. For information, see Verify the Session Manager plugin installation. Note To uninstall the plugin, run the following two commands in the order shown. sudo rm -rf /usr/local/sessionmanagerplugin Session Manager 917 AWS Systems Manager User Guide sudo rm /usr/local/bin/session-manager-plugin Install the Session Manager plugin on Linux This section includes information about verifying the signature of the Session Manager plugin installer package and installing the plugin on the following Linux distributions: • Amazon Linux 2 • AL2023 • RHEL • Debian • Ubuntu Topics • Verify the signature of the Session Manager plugin • Install the Session Manager plugin on Amazon Linux 2, Amazon Linux 2023, and Red Hat Enterprise Linux distributions • Install the Session Manager plugin on Debian Server and Ubuntu Server Verify the signature of the Session Manager plugin The Session Manager plugin RPM and Debian installer packages for Linux instances are cryptographically signed. You can use a public key to verify that the plugin binary and package is original and unmodified. If the file is altered or damaged, the verification fails. You can verify the signature of the installer package using the GNU Privacy Guard (GPG) tool. The following information is for Session Manager plugin versions 1.2.707.0 or later. Complete the following steps to verify the signature of the Session Manager plugin installer package. Topics • Step 1: Download the Session Manager plugin installer package • Step 2: Download the associated signature file • Step 3: Install the GPG tool Session Manager 918 AWS Systems Manager User Guide • Step 4: Verify the Session Manager plugin installer package on a Linux server Step 1: Download the Session Manager plugin installer package Download the Session Manager plugin installer package you want to verify. Amazon Linux 2, AL2023, and RHEL RPM packages x86_64 curl -o "session-manager-plugin.rpm" "https://s3.amazonaws.com/session-manager- downloads/plugin/latest/linux_64bit/session-manager-plugin.rpm" x86 curl -o "session-manager-plugin.rpm" "https://s3.amazonaws.com/session-manager- downloads/plugin/latest/linux_32bit/session-manager-plugin.rpm" ARM64 curl -o "session-manager-plugin.rpm" "https://s3.amazonaws.com/session-manager- downloads/plugin/latest/linux_arm64/session-manager-plugin.rpm" Debian and Ubuntu Deb packages x86_64 curl -o "session-manager-plugin.deb" "https://s3.amazonaws.com/session-manager- downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb" x86 curl -o "session-manager-plugin.deb" "https://s3.amazonaws.com/session-manager- downloads/plugin/latest/ubuntu_32bit/session-manager-plugin.deb" ARM64 curl -o "session-manager-plugin.deb" "https://s3.amazonaws.com/session-manager- downloads/plugin/latest/ubuntu_arm64/session-manager-plugin.deb" Session Manager 919 AWS Systems Manager User Guide Step 2: Download the associated signature file After you download the installer package, download the associated signature file for package verification. To provide an extra layer of protection against unauthorized copying or use of the session-manager-plugin binary file inside the package, we also offer binary signatures, which you can use to validate individual binary files. You can choose to use these binary signatures based on your security needs. Amazon Linux 2, AL2023, and RHEL signature packages x86_64 Package: curl -o "session-manager-plugin.rpm.sig" "https://s3.amazonaws.com/session-manager- downloads/plugin/latest/linux_64bit/session-manager-plugin.rpm.sig" Binary: curl -o "session-manager-plugin.sig" "https://s3.amazonaws.com/session-manager- downloads/plugin/latest/linux_64bit/session-manager-plugin.sig" x86 Package:
|
systems-manager-ug-286
|
systems-manager-ug.pdf
| 286 |
downloads/plugin/latest/ubuntu_arm64/session-manager-plugin.deb" Session Manager 919 AWS Systems Manager User Guide Step 2: Download the associated signature file After you download the installer package, download the associated signature file for package verification. To provide an extra layer of protection against unauthorized copying or use of the session-manager-plugin binary file inside the package, we also offer binary signatures, which you can use to validate individual binary files. You can choose to use these binary signatures based on your security needs. Amazon Linux 2, AL2023, and RHEL signature packages x86_64 Package: curl -o "session-manager-plugin.rpm.sig" "https://s3.amazonaws.com/session-manager- downloads/plugin/latest/linux_64bit/session-manager-plugin.rpm.sig" Binary: curl -o "session-manager-plugin.sig" "https://s3.amazonaws.com/session-manager- downloads/plugin/latest/linux_64bit/session-manager-plugin.sig" x86 Package: curl -o "session-manager-plugin.rpm.sig" "https://s3.amazonaws.com/session-manager- downloads/plugin/latest/linux_32bit/session-manager-plugin.rpm.sig" Binary: curl -o "session-manager-plugin.sig" "https://s3.amazonaws.com/session-manager- downloads/plugin/latest/linux_32bit/session-manager-plugin.sig" ARM64 Package: curl -o "session-manager-plugin.rpm.sig" "https://s3.amazonaws.com/session-manager- downloads/plugin/latest/linux_arm64/session-manager-plugin.rpm.sig" Session Manager 920 AWS Systems Manager Binary: User Guide curl -o "session-manager-plugin.sig" "https://s3.amazonaws.com/session-manager- downloads/plugin/latest/linux_arm64/session-manager-plugin.sig" Debian and Ubuntu Deb signature packages x86_64 Package: curl -o "session-manager-plugin.deb.sig" "https://s3.amazonaws.com/session-manager- downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb.sig" Binary: curl -o "session-manager-plugin.sig" "https://s3.amazonaws.com/session-manager- downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.sig" x86 Package: curl -o "session-manager-plugin.deb.sig" "https://s3.amazonaws.com/session-manager- downloads/plugin/latest/ubuntu_32bit/session-manager-plugin.deb.sig" Binary: curl -o "session-manager-plugin.sig" "https://s3.amazonaws.com/session-manager- downloads/plugin/latest/ubuntu_32bit/session-manager-plugin.sig" ARM64 Package: curl -o "session-manager-plugin.deb.sig" "https://s3.amazonaws.com/session-manager- downloads/plugin/latest/ubuntu_arm64/session-manager-plugin.deb.sig" Binary: Session Manager 921 AWS Systems Manager User Guide curl -o "session-manager-plugin.sig" "https://s3.amazonaws.com/session-manager- downloads/plugin/latest/ubuntu_arm64/session-manager-plugin.sig" Step 3: Install the GPG tool To verify the signature of the Session Manager plugin, you must have the GNU Privacy Guard (GPG) tool installed on your system. The verification process requires GPG version 2.1 or later. You can check your GPG version by running the following command: gpg --version If your GPG version is older than 2.1, update it before proceeding with the verification process. For most systems, you can update the GPG tool using your package manager. For example, on Amazon Linux and RHEL systems, you can use the following commands: sudo yum update sudo yum install gnupg2 On Ubuntu or Debian systems, you can use the following commands: sudo apt-get update sudo apt-get install gnupg2 Ensure you have the required GPG version before continuing with the verification process. Step 4: Verify the Session Manager plugin installer package on a Linux server Use the following procedure to verify the Session Manager plugin installer package on a Linux server. Note Amazon Linux 2 doesn't support the gpg tool version 2.1 or higher. If the following procedure doesn't work on your Amazon Linux 2 instances, verify the signature on a different platform before installing it on your Amazon Linux 2 instances. 1. Copy the following public key, and save it to a file named session-manager-plugin.gpg. Session Manager 922 AWS Systems Manager User Guide -----BEGIN PGP PUBLIC KEY BLOCK----- mFIEZ5ERQxMIKoZIzj0DAQcCAwQjuZy+IjFoYg57sLTGhF3aZLBaGpzB+gY6j7Ix P7NqbpXyjVj8a+dy79gSd64OEaMxUb7vw/jug+CfRXwVGRMNtIBBV1MgU1NNIFNl c3Npb24gTWFuYWdlciA8c2Vzc2lvbi1tYW5hZ2VyLXBsdWdpbi1zaWduZXJAYW1h em9uLmNvbT4gKEFXUyBTeXN0ZW1zIE1hbmFnZXIgU2Vzc2lvbiBNYW5hZ2VyIFBs dWdpbiBMaW51eCBTaWduZXIgS2V5KYkBAAQQEwgAqAUCZ5ERQ4EcQVdTIFNTTSBT ZXNzaW9uIE1hbmFnZXIgPHNlc3Npb24tbWFuYWdlci1wbHVnaW4tc2lnbmVyQGFt YXpvbi5jb20+IChBV1MgU3lzdGVtcyBNYW5hZ2VyIFNlc3Npb24gTWFuYWdlciBQ bHVnaW4gTGludXggU2lnbmVyIEtleSkWIQR5WWNxJM4JOtUB1HosTUr/b2dX7gIe AwIbAwIVCAAKCRAsTUr/b2dX7rO1AQCa1kig3lQ78W/QHGU76uHx3XAyv0tfpE9U oQBCIwFLSgEA3PDHt3lZ+s6m9JLGJsy+Cp5ZFzpiF6RgluR/2gA861M= =2DQm -----END PGP PUBLIC KEY BLOCK----- 2. Import the public key into your keyring. The returned key value should be 2C4D4AFF6F6757EE. $ gpg --import session-manager-plugin.gpg gpg: key 2C4D4AFF6F6757EE: public key "AWS SSM Session Manager <session-manager- [email protected]> (AWS Systems Manager Session Manager Plugin Linux Signer Key)" imported gpg: Total number processed: 1 gpg: imported: 1 3. Run the following command to verify the fingerprint. gpg --fingerprint 2C4D4AFF6F6757EE The fingerprint for the command output should match the following. 7959 6371 24CE 093A D501 D47A 2C4D 4AFF 6F67 57EE pub nistp256 2025-01-22 [SC] 7959 6371 24CE 093A D501 D47A 2C4D 4AFF 6F67 57EE uid [ unknown] AWS Systems Manager Session Manager plugin <session- [email protected]> (AWS Systems Manager Session Manager Plugin Linux Signer Key) If the fingerprint doesn't match, don't install the plugin. Contact AWS Support. Session Manager 923 AWS Systems Manager User Guide 4. Verify the installer package signature. Replace the signature-filename and downloaded- plugin-filename with the values you specified when downloading the signature file and session-manager-plugin, as listed in the table earlier in this topic. gpg --verify signature-filename downloaded-plugin-filename For example, for the x86_64 architecture on Amazon Linux 2, the command is as follows: gpg --verify session-manager-plugin.rpm.sig session-manager-plugin.rpm This command returns output similar to the following. gpg: Signature made Mon Feb 3 20:08:32 2025 UTC gpg: using ECDSA key 2C4D4AFF6F6757EE gpg: Good signature from "AWS Systems Manager Session Manager <session-manager- [email protected]> (AWS Systems Manager Session Manager Plugin Linux Signer Key)" [unknown] gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: 7959 6371 24CE 093A D501 D47A 2C4D 4AFF 6F67 57EE If the output includes the phrase BAD signature, check whether you performed the procedure correctly. If you continue to get this response, contact AWS Support and don't install the package. The warning message about the trust doesn't mean that the signature isn't valid, only that you haven't verified the public key. A key is trusted only if you or someone who you trust has signed it. If the output includes the phrase Can't check signature: No public key, verify you downloaded Session Manager plugin with version 1.2.707.0 or later. Install the Session Manager plugin on Amazon Linux 2, Amazon Linux 2023, and
|
systems-manager-ug-287
|
systems-manager-ug.pdf
| 287 |
output includes the phrase BAD signature, check whether you performed the procedure correctly. If you continue to get this response, contact AWS Support and don't install the package. The warning message about the trust doesn't mean that the signature isn't valid, only that you haven't verified the public key. A key is trusted only if you or someone who you trust has signed it. If the output includes the phrase Can't check signature: No public key, verify you downloaded Session Manager plugin with version 1.2.707.0 or later. Install the Session Manager plugin on Amazon Linux 2, Amazon Linux 2023, and Red Hat Enterprise Linux distributions Use the following procedure to install the Session Manager plugin on Amazon Linux 2, Amazon Linux 2023 (AL2023), and RHEL distributions. Note The Session Manager plugin is not supported on Amazon Linux 1. It is supported on Amazon Linux 2 and later distributions. Session Manager 924 AWS Systems Manager User Guide 1. Download and install the Session Manager plugin RPM package. x86_64 On Amazon Linux 2 and RHEL 7, run the following command: sudo yum install -y https://s3.amazonaws.com/session-manager-downloads/plugin/ latest/linux_64bit/session-manager-plugin.rpm On AL2023 and RHEL 8 and 9, run the following command: sudo dnf install -y https://s3.amazonaws.com/session-manager-downloads/plugin/ latest/linux_64bit/session-manager-plugin.rpm x86 On RHEL 7, run the following command: sudo yum install -y https://s3.amazonaws.com/session-manager-downloads/plugin/ latest/linux_32bit/session-manager-plugin.rpm On RHEL 8 and 9, run the following command: sudo dnf install -y https://s3.amazonaws.com/session-manager-downloads/plugin/ latest/linux_32bit/session-manager-plugin.rpm ARM64 On Amazon Linux 2 and RHEL 7, run the following command: sudo yum install -y https://s3.amazonaws.com/session-manager-downloads/plugin/ latest/linux_arm64/session-manager-plugin.rpm On AL2023 and RHEL 8 and 9, run the following command: sudo dnf install -y https://s3.amazonaws.com/session-manager-downloads/plugin/ latest/linux_arm64/session-manager-plugin.rpm 2. Verify that the installation was successful. For information, see Verify the Session Manager Session Manager plugin installation. 925 AWS Systems Manager Note User Guide If you want to uninstall the plugin, run sudo yum erase session-manager-plugin - y Install the Session Manager plugin on Debian Server and Ubuntu Server 1. Download the Session Manager plugin deb package. x86_64 curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ ubuntu_64bit/session-manager-plugin.deb" -o "session-manager-plugin.deb" x86 curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ ubuntu_32bit/session-manager-plugin.deb" -o "session-manager-plugin.deb" ARM64 curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ ubuntu_arm64/session-manager-plugin.deb" -o "session-manager-plugin.deb" 2. Run the install command. sudo dpkg -i session-manager-plugin.deb 3. Verify that the installation was successful. For information, see Verify the Session Manager plugin installation. Note If you ever want to uninstall the plugin, run sudo dpkg -r session-manager-plugin Session Manager 926 AWS Systems Manager User Guide Verify the Session Manager plugin installation Run the following commands to verify that the Session Manager plugin installed successfully. session-manager-plugin If the installation was successful, the following message is returned. The Session Manager plugin is installed successfully. Use the AWS CLI to start a session. You can also test the installation by running the start-session command in the the AWS Command Line Interface (AWS CLI). In the following command, replace instance-id with your own information. aws ssm start-session --target instance-id This command will work only if you have installed and configured the AWS CLI, and if your Session Manager administrator has granted you the necessary IAM permissions to access the target managed node using Session Manager. Session Manager plugin on GitHub The source code for Session Manager plugin is available on GitHub so that you can adapt the plugin to meet your needs. We encourage you to submit pull requests for changes that you would like to have included. However, Amazon Web Services doesn't provide support for running modified copies of this software. (Optional) Turn on Session Manager plugin logging The Session Manager plugin includes an option to allow logging for sessions that you run. By default, logging is turned off. If you allow logging, the Session Manager plugin creates log files for both application activity (session-manager-plugin.log) and errors (errors.log) on your local machine. Topics • Turn on logging for the Session Manager plugin (Windows) • Enable logging for the Session Manager plugin (Linux and macOS) Session Manager 927 AWS Systems Manager User Guide Turn on logging for the Session Manager plugin (Windows) 1. Locate the seelog.xml.template file for the plugin. The default location is C:\Program Files\Amazon\SessionManagerPlugin \seelog.xml.template. 2. Change the name of the file to seelog.xml. 3. Open the file and change minlevel="off" to minlevel="info" or minlevel="debug". Note By default, log entries about opening a data channel and reconnecting sessions are recorded at the INFO level. Data flow (packets and acknowledgement) entries are recorded at the DEBUG level. 4. Change other configuration options you want to modify. Options you can change include: • Debug level: You can change the debug level from formatid="fmtinfo" to formatid="fmtdebug". • Log file options: You can make changes to the log file options, including where the logs are stored, with the exception of the log file names. Important Don't change the file names or logging won't work correctly. <rollingfile type="size" filename="C:\Program Files\Amazon\SessionManagerPlugin \Logs\session-manager-plugin.log" maxsize="30000000" maxrolls="5"/> <filter levels="error,critical" formatid="fmterror"> <rollingfile type="size" filename="C:\Program Files\Amazon\SessionManagerPlugin \Logs\errors.log" maxsize="10000000" maxrolls="5"/> 5.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.