Skip to content

Commit 497fd62

Browse files
Merge pull request #2 from ThisIsHowieDeWitt/feature/patch-mgmt
Feature/patch mgmt
2 parents 5608f72 + 7d2cdbd commit 497fd62

File tree

2 files changed

+72
-7
lines changed

2 files changed

+72
-7
lines changed

aws_sra_examples/solutions/patch_mgmt/patch_mgmt_org/README.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ The SRA Patch Manager solution will automate enabling Systems Manager - Patch ma
1818

1919
**Key solution features:**
2020
- Assumes a role in each member account to enable/disable the Patch Manager Solution.
21-
- Creates 3 Maintenance Windows to Scan or Patch Windows or Linux Managed Instances
21+
- Creates 3 Maintenance Windows:
22+
- 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.
2225
- Configures the [Default Host Configuration](https://docs.aws.amazon.com/systems-manager/latest/userguide/quick-setup-default-host-management-configuration.html) feature.
2326
- Ability to disable Patch Manager within all accounts and regions via a parameter and CloudFormation update event.
2427

@@ -52,6 +55,7 @@ The Patch Manager solution requires:
5255
- The `Patch Management IAM Role` is assumed by the Lambda function in each of the member accounts to to configure Patch Manager.
5356
- The `SSM Automation Role` is used by the Maintenance Window to execute the task.
5457
- The `DefaultHostConfig Role` is used to enable the Default Host Configuration setting.
58+
- The `Patch Mgr EC2 Profile` is used if there are issue with the Default Host Configuration setting.
5559

5660
#### 1.3 Maintenance Windows<!-- omit in toc -->
5761

@@ -65,16 +69,16 @@ Three Maintenance Windows are created:
6569
##### Maintenance Windows Tasks
6670

6771
Three tasks are created and registered with each of the Maintenance Windows:
68-
- `Update SSMAgent On Managed Instances` Runs an SSM Agent update on all Managed Instances
69-
- `Scan For Patches On Managed Windows Instances` Runs a scan on all Managed Instances Tagged as Windows
70-
- `Scan For Patches On Managed Linux Instances` Runs a scan on all Managed Instances Tagged as Linux
72+
- `Update_SSM` Runs an SSM Agent update on all Managed Instances
73+
- `Windows_Scan` Runs a scan on all Managed Instances Tagged as Windows
74+
- `Linux_Scan` Runs a scan on all Managed Instances Tagged as Linux
7175

7276
##### Maintenance Window Targets
7377

7478
Three target groups are created and registered with each of the Maintenance Windows:
75-
- `Targets To Update SSMAgent On Managed Instances` which includes all instances with the tag InstanceOS:Windows or InstanceOS:Linux
76-
- `Targets To Scan For Windows Updates On Managed Instances` which includes all instances with the tag InstanceOS:Windows
77-
- `Targets To Scan For Linux Updates On Managed Instances` which includes all instances with the tag InstanceOS:Linux
79+
- `Update_SSM` which includes all instances with the tag InstanceOS:Windows or InstanceOS:Linux
80+
- `Windows_Scan` which includes all instances with the tag InstanceOS:Windows
81+
- `Linux_Scan` which includes all instances with the tag InstanceOS:Linux
7882

7983
#### 1.4 Command Documents<!-- omit in toc -->
8084

@@ -122,6 +126,13 @@ Choose to deploy the Patch Manager solution from within the chosen deployment ty
122126

123127
---
124128

129+
#### Troubleshooting<!-- omit in toc -->
130+
131+
Q: Its been more than 24 hours and the Instances are still not appearing in Fleet Manager (and therefore not being scanned).
132+
A: Attach the `patch-mgr-ec2-profile` to the EC2 instances.
133+
134+
---
135+
125136
## References
126137

127138
- [AWS Systems Manager Patch Manager](https://docs.aws.amazon.com/systems-manager/latest/userguide/patch-manager.html)

aws_sra_examples/solutions/patch_mgmt/patch_mgmt_org/templates/sra-patch_mgmt-configuration-role.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ Parameters:
7474
Default: sra-patch-mgmt-org
7575
Description: The SRA solution name. The default value is the folder name of the solution
7676
Type: String
77+
pPatchMgrEC2Profile:
78+
Default: patch-mgr-ec2-profile
79+
Description: An instance profile that can be used if facing issues with the Default Host Configuration setting.
80+
Type: String
81+
pPatchMgrEC2ProfileRole:
82+
Default: patch-mgr-ec2-profile-role
83+
Description: The Role that the patch-mgr-ec2-profile will use.
84+
Type: String
7785

7886
Resources:
7987
rConfigurationRole:
@@ -266,3 +274,49 @@ Resources:
266274
- Key: sra-solution
267275
Value: !Ref pSRASolutionName
268276

277+
rPatchMgrEC2ProfileRole:
278+
Type: AWS::IAM::Role
279+
Metadata:
280+
cfn_nag:
281+
rules_to_suppress:
282+
- id: F3
283+
reason: Actions require * in permissions policy
284+
- id: W11
285+
reason: Actions require * in resource
286+
- id: W28
287+
reason: Explicit role name provided
288+
Properties:
289+
RoleName: !Ref pPatchMgrEC2ProfileRole
290+
AssumeRolePolicyDocument:
291+
Version: 2012-10-17
292+
Statement:
293+
- Action: sts:AssumeRole
294+
Effect: Allow
295+
Principal:
296+
Service:
297+
- ec2.amazonaws.com
298+
Path: "/"
299+
ManagedPolicyArns:
300+
- !Sub arn:${AWS::Partition}:iam::${AWS::Partition}:policy/AmazonSSMManagedInstanceCore
301+
Tags:
302+
- Key: sra-solution
303+
Value: !Ref pSRASolutionName
304+
305+
rPatchMgrEC2Profile:
306+
Type: AWS::IAM::InstanceProfile
307+
Metadata:
308+
cfn_nag:
309+
rules_to_suppress:
310+
- id: F3
311+
reason: Actions require * in permissions policy
312+
- id: W11
313+
reason: Actions require * in resource
314+
- id: W28
315+
reason: Explicit role name provided
316+
Properties:
317+
InstanceProfileName: !Ref pPatchMgrEC2Profile
318+
Path: "/"
319+
Roles:
320+
-
321+
!Ref pPatchMgrEC2ProfileRole
322+
DependsOn: rPatchMgrEC2ProfileRole

0 commit comments

Comments
 (0)