EC2 managed instance is compliant with Systems Manager patching requirements
SSM-managed EC2 instances report patch compliance against defined baselines. This evaluates each managed node's compliance status from Patch Manager to determine whether required security updates are applied according to policy.
Risk
Unpatched instances expose known CVE vulnerabilities, enabling remote code execution, privilege escalation, and lateral movement.
This threatens confidentiality (data exfiltration), integrity (unauthorized changes), and availability (ransomware, crypto-mining, outages).
Run this check with Prowler
Run in Prowler Cloudprowler aws --checks ssm_managed_compliant_patchingRecommendation
Adopt automated patch management with Systems Manager: enroll EC2 as managed nodes, define strict patch baselines, run frequent compliance scans, and install critical updates promptly.
Apply defense in depth: least-privileged roles for patching, staged rollouts, maintenance windows, and centralized compliance reporting with alerting.
Remediation
CLI
aws ssm send-command --instance-ids <INSTANCE_ID> --document-name AWS-RunPatchBaseline --parameters Operation=InstallTerraform
# Run AWS-RunPatchBaseline to install missing patches on the instance
resource "aws_ssm_association" "<example_resource_name>" {
name = "AWS-RunPatchBaseline"
instance_id = "<example_resource_id>"
parameters = {
Operation = ["Install"] # Critical: installs patches to achieve COMPLIANT status
}
}NativeIaC
# Create an SSM Association to install missing patches on the instance
Resources:
<example_resource_name>:
Type: AWS::SSM::Association
Properties:
Name: AWS-RunPatchBaseline
InstanceId: <example_resource_id>
Parameters:
Operation:
- Install # Critical: installs missing patches so the instance becomes COMPLIANTOther
Check Code
from prowler.lib.check.models import Check, Check_Report_AWS
from prowler.providers.aws.services.ec2.ec2_client import ec2_client
from prowler.providers.aws.services.ssm.ssm_client import ssm_client
from prowler.providers.aws.services.ssm.ssm_service import ResourceStatus
class ssm_managed_compliant_patching(Check):
def execute(self):
findings = []
for resource in ssm_client.compliance_resources.values():
report = Check_Report_AWS(metadata=self.metadata(), resource=resource)
# Find tags of the instance in ec2_client
for instance in ec2_client.instances:
if instance.id == resource.id:
report.resource_tags = instance.tags
if resource.status == ResourceStatus.COMPLIANT:
report.status = "PASS"
report.status_extended = (
f"EC2 managed instance {resource.id} is compliant."
)
else:
report.status = "FAIL"
report.status_extended = (
f"EC2 managed instance {resource.id} is non-compliant."
)
findings.append(report)
return findingsReferences
- https://docs.aws.amazon.com/systems-manager/latest/userguide/patch-compliance-identify.html
- https://support.icompaas.com/support/solutions/articles/62000233554-ensure-ec2-instances-managed-by-systems-manager-are-compliant-with-patching-requirements
- https://docs.aws.amazon.com/systems-manager/latest/userguide/compliance-fixing.html