Skip to content

Commit 210b5f9

Browse files
Merge pull request #3 from ThisIsHowieDeWitt/feature/patch-mgmt
Feature/patch mgmt
2 parents 497fd62 + cbf2b36 commit 210b5f9

File tree

7 files changed

+63
-15
lines changed

7 files changed

+63
-15
lines changed

aws_sra_examples/solutions/patch_mgmt/patch_mgmt_org/README.md

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ The SRA Patch Manager solution will automate enabling Systems Manager - Patch ma
2020
- Assumes a role in each member account to enable/disable the Patch Manager Solution.
2121
- Creates 3 Maintenance Windows:
2222
- One updates the SSM Agents on all Managed Instances.
23-
- One scans for, or installs, missing patches on Managed Instances tagged as Windows.
24-
- One scans for, or installs, missing patches on Managed Instances tagged as Linux.
23+
- One scans for, or installs, missing **Security patches rated Critical or Important** and **Bugfixes** on Managed Instances tagged as Windows.
24+
- One scans for, or installs, missing **Security patches rated Critical or Important** and **Bugfixes** on Managed Instances tagged as Linux.
2525
- Configures the [Default Host Configuration](https://docs.aws.amazon.com/systems-manager/latest/userguide/quick-setup-default-host-management-configuration.html) feature.
2626
- Ability to disable Patch Manager within all accounts and regions via a parameter and CloudFormation update event.
2727

@@ -39,25 +39,55 @@ The Patch Manager solution requires:
3939

4040
## Deployed Resource Details
4141

42-
![Architecture](./documentation/patchmgr.png)
42+
![Architecture](./documentation/patch-mgr-deployment.png)
43+
44+
## Solution Details
45+
46+
![Solution](./documentation/patch-mgr-solution.png)
4347

4448
### 1.0 Organization Management Account<!-- omit in toc -->
4549

46-
#### 1.1 AWS Patch Manager<!-- omit in toc -->
50+
#### 1.1 AWS CloudFormation<!-- omit in toc -->
4751

48-
- All resources are deployed via AWS CloudFormation as a `StackSet` and `Stack Instance` within the `management account` or a CloudFormation `Stack` within a specific account.
52+
- All resources are deployed via AWS CloudFormation as a `StackSet` and `Stack Instance` within the management account or a CloudFormation `Stack` within a specific account.
4953
- The [Customizations for AWS Control Tower](https://aws.amazon.com/solutions/implementations/customizations-for-aws-control-tower/) solution deploys all templates as a CloudFormation `StackSet`.
5054
- For parameter details, review the [AWS CloudFormation templates](templates/).
5155

52-
#### 1.2 IAM Roles<!-- omit in toc -->
56+
#### 1.2 AWS Lambda Function<!-- omit in toc -->
57+
58+
- The Lambda function includes logic to enable and configure Patch Manager
59+
60+
#### 1.3 Lambda Execution IAM Role<!-- omit in toc -->
5361

5462
- The `Lambda IAM Role` is used by the Lambda function in the management account to enable the Patch Manager in the management account.
63+
64+
#### 1.4 Lambda CloudWatch Log Group<!-- omit in toc -->
65+
66+
- All the `AWS Lambda Function` logs are sent to a CloudWatch Log Group `</aws/lambda/<LambdaFunctionName>` to help with debugging and traceability of the actions performed.
67+
- By default the `AWS Lambda Function` will create the CloudWatch Log Group and logs are encrypted with a CloudWatch Logs service managed encryption key.
68+
69+
#### 1.5 AWS Patch Manager<!-- omit in toc -->
70+
71+
- Patch Manager is enabled for each existing active account and region during the initial setup.
72+
73+
### 2.0 All Existing Active Accounts and Regions<!-- omit in toc -->
74+
75+
#### 2.1 AWS CloudFormation<!-- omit in toc -->
76+
77+
- All resources are deployed via AWS CloudFormation as a `StackSet` and `Stack Instance` within the management account or a CloudFormation `Stack` within a specific account.
78+
- The [Customizations for AWS Control Tower](https://aws.amazon.com/solutions/implementations/customizations-for-aws-control-tower/) solution deploys all templates as a CloudFormation `StackSet`.
79+
- For parameter details, review the [AWS CloudFormation templates](templates/).
80+
81+
#### 2.2 IAM Roles<!-- omit in toc -->
82+
5583
- The `Patch Management IAM Role` is assumed by the Lambda function in each of the member accounts to to configure Patch Manager.
5684
- The `SSM Automation Role` is used by the Maintenance Window to execute the task.
5785
- The `DefaultHostConfig Role` is used to enable the Default Host Configuration setting.
5886
- The `Patch Mgr EC2 Profile` is used if there are issue with the Default Host Configuration setting.
5987

60-
#### 1.3 Maintenance Windows<!-- omit in toc -->
88+
### 3.0 Patch Manager Solution<!-- omit in toc -->
89+
90+
#### 3.1 Maintenance Windows<!-- omit in toc -->
6191

6292
##### Maintenance Windows Window
6393

@@ -80,14 +110,12 @@ Three target groups are created and registered with each of the Maintenance Wind
80110
- `Windows_Scan` which includes all instances with the tag InstanceOS:Windows
81111
- `Linux_Scan` which includes all instances with the tag InstanceOS:Linux
82112

83-
#### 1.4 Command Documents<!-- omit in toc -->
113+
#### 3.2 Command Documents<!-- omit in toc -->
84114

85115
These AWS Managed SSM Documents are used by the tasks:
86116
- `AWS-UpdateSSMAgent`
87117
- `AWS-RunPatchBaseline`
88118

89-
90-
91119
## Implementation Instructions
92120

93121
### Prerequisites<!-- omit in toc -->
@@ -126,9 +154,26 @@ Choose to deploy the Patch Manager solution from within the chosen deployment ty
126154

127155
---
128156

129-
#### Troubleshooting<!-- omit in toc -->
157+
## Viewing Results
158+
159+
### Viewing Node Compliance<!-- omit in toc -->
160+
161+
Navigate to `Systems Manager` then `Patch Manager`. From the Dashboard select the `Compliance Reporting` tab. This will show you all your managed instances, the Compliance Status, and the Non-Compliant Count of patches.
162+
163+
![Node-Compliance](./documentation/node-compliance.png)
164+
165+
### Viewing Missing Patches<!-- omit in toc -->
166+
167+
Selecting the link on Non-Compliant Count will show you the missing patches for that Managed Instance. Selecting `Patch Now` at the top right of the window will allow you to plan the installation of the patches.
168+
169+
![Missing-Patch-Summary](./documentation/missing-patch-summary.png)
170+
171+
172+
---
173+
174+
## Troubleshooting<!-- omit in toc -->
130175

131-
Q: Its been more than 24 hours and the Instances are still not appearing in Fleet Manager (and therefore not being scanned).
176+
Q: Its been more than 24 hours and the Instances are still not appearing in Fleet Manager (and therefore not being scanned).\
132177
A: Attach the `patch-mgr-ec2-profile` to the EC2 instances.
133178

134179
---
Loading
Loading
Loading
Binary file not shown.

aws_sra_examples/solutions/patch_mgmt/patch_mgmt_org/lambda/src/app.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ def define_maintenance_window_tasks(
291291
task_description = params.get("TASK1_DESCRIPTION", "")
292292
task_run_command = params.get("TASK1_RUN_COMMAND", "")
293293
task_operation = params.get("TASK1_OPERATION", "Scan")
294+
task_rebootoption = params.get("TASK1_REBOOTOPTION", "NoReboot")
294295

295296

296297
for response2 in window_target_response['window1_targets']:
@@ -319,7 +320,7 @@ def define_maintenance_window_tasks(
319320
"RunCommand": {
320321
"Parameters": {
321322
"Operation": [task_operation],
322-
"RebootOption": ["RebootIfNeeded"],
323+
"RebootOption": [task_rebootoption],
323324
},
324325
"DocumentVersion": "$DEFAULT",
325326
"TimeoutSeconds": 3600,
@@ -346,6 +347,7 @@ def define_maintenance_window_tasks(
346347
task_description = params.get("TASK2_DESCRIPTION", "")
347348
task_run_command = params.get("TASK2_RUN_COMMAND", "")
348349
task_operation = params.get("TASK2_OPERATION", "Scan")
350+
task_rebootoption = params.get("TASK2_REBOOTOPTION", "NoReboot")
349351

350352
for response2 in window_target_response['window2_targets']:
351353
LOGGER.info(response2)
@@ -373,7 +375,7 @@ def define_maintenance_window_tasks(
373375
"RunCommand": {
374376
"Parameters": {
375377
"Operation": [task_operation],
376-
"RebootOption": ["RebootIfNeeded"],
378+
"RebootOption": [task_rebootoption],
377379
},
378380
"DocumentVersion": "$DEFAULT",
379381
"TimeoutSeconds": 3600,
@@ -400,6 +402,7 @@ def define_maintenance_window_tasks(
400402
task_description = params.get("TASK3_DESCRIPTION", "")
401403
task_run_command = params.get("TASK3_RUN_COMMAND", "")
402404
task_operation = params.get("TASK3_OPERATION", "Scan")
405+
task_rebootoption = params.get("TASK3_REBOOTOPTION", "NoReboot")
403406

404407
for response2 in window_target_response['window3_targets']:
405408
LOGGER.info(response2)
@@ -427,7 +430,7 @@ def define_maintenance_window_tasks(
427430
"RunCommand": {
428431
"Parameters": {
429432
"Operation": [task_operation],
430-
"RebootOption": ["RebootIfNeeded"],
433+
"RebootOption": [task_rebootoption],
431434
},
432435
"DocumentVersion": "$DEFAULT",
433436
"TimeoutSeconds": 3600,

0 commit comments

Comments
 (0)