Patch Manager uses patch baselines, which include rules for auto-approving patches within days of their release, as well as a list of approved and rejected patches. Later in this lab we will schedule patching to occur on a regular basis using a Systems Manager Maintenance Window task. Patch Manager integrates with AWS Identity and Access Management (IAM), AWS CloudTrail, and Amazon CloudWatch Events to provide a secure patching experience that includes event notifications and the ability to audit usage.
AWS does not test patches for Windows or Linux before making them available in Patch Manager. If any updates are installed by Patch Manager the patched instance is rebooted. Always test patches thoroughly before deploying to production environments. This is a customer owned responsibility
In this lab we will create Patch Baselines and Patch Groups. These will be used to decide which patches to apply to our instances and which instances to target.
Create a custom patch baseline
Create a patch group to associate with the custom patch baseline
Under Instances and Nodes in the AWS Systems Manager navigation bar, select Patch Manager.
Select the View predefined patch baselines link under the Configure patching button on the upper right.
Select Create patch baseline.
On the Create patch baseline page in the Provide patch baseline details section:
AmazonLinuxSecAndNonSecBaseline
.In the Approval rules section:
If an approved patch is reported as missing, the option you select in Compliance reporting, such as Critical or Medium, determines the severity of the compliance violation reported in System Manager Compliance.
In the Patch exceptions section in the Rejected patches - optional text box, enter system-release.*
For Linux operating systems, you can optionally define an alternative patch source repository. Select the X in the Patch sources area to remove the empty patch source definition.
Select Create patch baseline and you will go to the Patch Baselines page where the AWS provided default patch baselines, and your custom baseline, are displayed.
A patch group is an optional method to organize instances for patching. For example, you can create patch groups for different operating systems (Linux or Windows), different environments (Development, Test, and Production), or different server functions (web servers, file servers, databases). Patch groups can help you avoid deploying patches to the wrong set of instances. They can also help you avoid deploying patches before they have been adequately tested.
You create a patch group by using Amazon EC2 tags. Unlike other tagging scenarios across Systems Manager, a patch group must be defined with the tag key: Patch Group (tag keys are case sensitive). You can specify any value (for example, web servers) but the key must be Patch Group. Note: An instance can only be in one patch group.
Navigate to the EC2 Console
Go to tags on the left navigation panel.
Select Manage Tags
Select instances with Name App1 and App2
Add Tag
Key: Patch Group
Value: App
Select instances with Name Web1 and Web2
Add Tag
Key: Patch Group
Value: Web
Navigate back to Systems Manager > Patch Manager > Patch Baselines
Select the Baseline you created in the previous part (AmazonLinuxSecAndNonSecBaseline)
Go to Actions and Modify Patch Group
Type in App and Add the Patch Group to the Baseline
From here you could utilize AWS-RunPatchBaseline pre-defined document to scan or patch your instances. Instead we are going to chain the capabilities together and utilize a Maintenance Window to execute the Run command and document mentioned above.
You can also Select Configure Patching and link the Patch Baseline to the Maintenance Window, it will register the run task with the maintenance window and also register the Patch Group as targets. It utilizes the existing role AWSServiceRoleforAmazonSSM.