Skip to content

Commit

Permalink
[Improvement] ec2/* - Remove SSM AWS-RunPatchBaseline hourly invocati…
Browse files Browse the repository at this point in the history
…on to reduce spam because of uncompliant instances (you can still use the MaintenanceWindowSchedule parameter for patching) (#716)
  • Loading branch information
michaelwittig authored Nov 1, 2023
1 parent eb5363f commit 7394934
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
14 changes: 1 addition & 13 deletions ec2/al2-mutable-private.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1136,9 +1136,7 @@ Resources:
- !Sub 'arn:${AWS::Partition}:ssm:${AWS::Region}:${AWS::AccountId}:managed-instance-inventory/${VirtualMachine}'
- Effect: Allow
Action: 'ssm:UpdateInstanceAssociationStatus'
Resource:
- !Sub 'arn:${AWS::Partition}:ec2:${AWS::Region}:${AWS::AccountId}:instance/${VirtualMachine}'
- !Sub 'arn:${AWS::Partition}:ssm:${AWS::Region}:${AWS::AccountId}:association/${AssociationRunPatchBaselineScan}'
Resource: !Sub 'arn:${AWS::Partition}:ec2:${AWS::Region}:${AWS::AccountId}:instance/${VirtualMachine}'
IAMPolicySSHAccess:
Type: 'AWS::IAM::Policy'
Condition: HasIAMUserSSHAccess
Expand Down Expand Up @@ -1542,16 +1540,6 @@ Resources:
Operation: [Install]
TaskType: 'RUN_COMMAND'
WindowId: !Ref MaintenanceWindow
AssociationRunPatchBaselineScan:
Type: 'AWS::SSM::Association'
Properties:
Name: 'AWS-RunPatchBaseline'
Parameters:
Operation: [Scan]
ScheduleExpression: 'rate(1 hour)'
Targets:
- Key: InstanceIds
Values: [!Ref VirtualMachine]
BackupVault: # cannot be deleted with data
Condition: HasBackupRetentionPeriod
Type: 'AWS::Backup::BackupVault'
Expand Down
14 changes: 1 addition & 13 deletions ec2/al2-mutable-public.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1145,9 +1145,7 @@ Resources:
- !Sub 'arn:${AWS::Partition}:ssm:${AWS::Region}:${AWS::AccountId}:managed-instance-inventory/${VirtualMachine}'
- Effect: Allow
Action: 'ssm:UpdateInstanceAssociationStatus'
Resource:
- !Sub 'arn:${AWS::Partition}:ec2:${AWS::Region}:${AWS::AccountId}:instance/${VirtualMachine}'
- !Sub 'arn:${AWS::Partition}:ssm:${AWS::Region}:${AWS::AccountId}:association/${AssociationRunPatchBaselineScan}'
Resource: !Sub 'arn:${AWS::Partition}:ec2:${AWS::Region}:${AWS::AccountId}:instance/${VirtualMachine}'
IAMPolicySSHAccess:
Type: 'AWS::IAM::Policy'
Condition: HasIAMUserSSHAccess
Expand Down Expand Up @@ -1552,16 +1550,6 @@ Resources:
Operation: [Install]
TaskType: 'RUN_COMMAND'
WindowId: !Ref MaintenanceWindow
AssociationRunPatchBaselineScan:
Type: 'AWS::SSM::Association'
Properties:
Name: 'AWS-RunPatchBaseline'
Parameters:
Operation: [Scan]
ScheduleExpression: 'rate(1 hour)'
Targets:
- Key: InstanceIds
Values: [!Ref VirtualMachine]
BackupVault: # cannot be deleted with data
Condition: HasBackupRetentionPeriod
Type: 'AWS::Backup::BackupVault'
Expand Down

0 comments on commit 7394934

Please sign in to comment.