9.2 Systems Manager Patch Manager & Session Manager
Key Takeaways
- Patch Manager automates operating system patching across Windows and Linux distributions using the AWS-RunPatchBaseline document with Scan or Install operations.
- Patch Baselines define patch approval rules including vendor release delay buffers, classifications, severities, compliance levels, and explicit approved and rejected patch lists.
- Instances are assigned to specific patch baselines using the reserved tag key Patch Group; an instance can belong to only one patch group at any given time.
- Maintenance Windows define the schedule (cron/rate), duration, cutoff buffer, target instances, and registered tasks, preventing disruptive patch operations during peak business hours.
- Session Manager provides browser-based and CLI shell access without open inbound security group ports, bastion hosts, or SSH keys, logging encrypted sessions to S3 and CloudWatch Logs.
9.2 Systems Manager Patch Manager & Session Manager
CloudOps Blueprint Focus: The AWS Certified CloudOps Engineer – Associate (SOA-C03) exam tests your ability to automate operating system patching with Systems Manager Patch Manager, establish multi-tier approval rules using Patch Groups, schedule update cycles via Maintenance Windows, and eliminate bastion hosts using secure, audited Session Manager access.
Systems Manager Patch Manager Architecture & Baselines
Maintaining operating system security compliance across enterprise server fleets requires automated patch evaluation, testing, and deployment. AWS Systems Manager Patch Manager automates operating system patching for Amazon EC2 instances and hybrid servers across Windows Server and Linux distributions (Amazon Linux, AL2023, Ubuntu, RHEL, Debian, SLES).
Under the hood, Patch Manager orchestrates native operating system package managers (yum, dnf, apt, zypper, Windows Update) using the Systems Manager document AWS-RunPatchBaseline.
Default vs. Custom Patch Baselines
A Patch Baseline defines the specific rules governing which operating system patches are approved for installation.
AWS provides Default Patch Baselines for each supported OS (e.g., AWS-AmazonLinux2023DefaultPatchBaseline, AWS-WindowsPredefinedpatchBaseline-OS). These baselines automatically approve all vendor patches categorized as Critical or Important security updates after an auto-approval wait period of 7 days. However, default baselines cannot be modified, do not support custom package exclusions, and cannot be tailored to specific compliance regimes.
Enterprise cloud operations rely on Custom Patch Baselines, configuring granular controls:
- Product Filtering: Explicitly targets specific operating system versions (such as
WindowsServer2022,Ubuntu22.04, orAmazonLinux2023). - Classification & Severity: Filters updates by classification (Security, Bugfix, Enhancement, CriticalUpdates) and severity (Critical, Important, Moderate, Low).
- Auto-Approval Delay: Specifies the number of days to wait after vendor release before a patch is automatically approved (e.g.,
10 daysor14 days). This delay creates a vital testing soak buffer, preventing untested zero-day updates from breaking production workloads. - Compliance Severity Level: Assigns a compliance status severity (Critical, High, Medium, Low) if an approved patch is missing during a compliance scan.
- Approved Patches List: An explicit allowlist that immediately approves critical patches regardless of auto-approval delay rules.
- Rejected Patches List: An explicit blocklist that prevents designated packages (such as a buggy kernel release or incompatible driver) from ever being installed, overriding general approval criteria.
Patch Groups & Target Segmentation
To safely roll out updates, administrators segment fleets into staged deployment tiers (Development, Staging, Production) using Patch Groups.
A Patch Group links a Patch Baseline to a designated set of managed nodes:
- Instances are assigned to a patch group using the reserved tag key
Patch Group. - The tag value defines the group name (e.g.,
Patch Group = Web-DevorPatch Group = Web-Prod). - A managed node can belong to only one Patch Group at any given time.
- Each Patch Group is registered to exactly one Patch Baseline within an AWS Region.
| Deployment Tier | Patch Group Tag Value | Auto-Approval Delay | Baseline Rules |
|---|---|---|---|
| Development | Web-Dev | 0 days (immediate) | Approves all security and bugfix patches immediately for rapid testing. |
| Staging | Web-Staging | 7 days | Validates patch stability against pre-production traffic. |
| Production | Web-Prod | 14 days | Applies proven patches; enforces explicit Rejected Patches blocklists. |
Maintenance Windows: Scheduled Execution Windows
While Patch Baselines define what patches to install, Systems Manager Maintenance Windows dictate when and how patching operations execute, preventing business disruption.
A Maintenance Window consists of five core components:
- Schedule: Defined using timezone-aware cron expressions (e.g.,
cron(0 2 ? * SUN *)) or rate expressions. - Duration: The total window duration (between 1 and 24 hours, e.g., 4 hours).
- Cutoff Buffer: The hours before window end (e.g., 1 hour) when Systems Manager stops scheduling tasks. In a 4-hour window with a 1-hour cutoff, tasks dispatch only during the first 3 hours, leaving the final hour for active tasks and reboots to finish safely.
- Registered Targets: Instances targeted by tags (e.g.,
Patch Group = Web-Prod), Resource Groups, or explicit IDs. - Registered Tasks: Configured tasks specifying:
- Task Document: Typically
AWS-RunPatchBaseline. - Operation Parameter:
Scan(evaluates missing patches and reports compliance without changes) orInstall(downloads and applies approved missing patches). - Reboot Behavior:
RebootIfNeeded(restarts if an installed update requires it) orNoReboot(installs updates but defers reboot). - Rate Control: Configures Concurrency and Error Thresholds to prevent concurrent patching from causing service outages.
- Task Document: Typically
Systems Manager Session Manager: Secure Bastionless Access
AWS Systems Manager Session Manager replaces bastion hosts, public IP addresses, and SSH key management with fully managed, auditable shell access:
- Zero Inbound Open Ports: The SSM Agent connects outbound over HTTPS (port 443) to the
ssmmessagesendpoint. Instance security groups require no inbound rules for SSH (port 22) or RDP (port 3389). - Centralized IAM Governance: Access permissions are managed entirely through AWS IAM policies. Administrators use tag-based conditions (e.g.,
ssm:resourceTag/Environment: "Development") to grant access while denying production sessions. - RunAs OS User Support: Session Manager can enforce launching sessions under a restricted local OS account (e.g.,
ec2-userorssm-user) rather thanroot. - Auditing & Logging:
- Terminal session streams are logged in real time to Amazon CloudWatch Logs and archived to Amazon S3.
- Logs are encrypted using an AWS KMS customer managed key (CMK) to prevent tampering.
- AWS CloudTrail audits session lifecycle events (
StartSession,ResumeSession,TerminateSession).
Port Forwarding and SSH Tunneling via Session Manager Plugin
Using the AWS CLI Session Manager Plugin (session-manager-plugin), operators tunnel traffic securely to private instances:
- Port Forwarding (
AWS-StartPortForwardingSession): Forwards a local port to a remote instance or private resource (such as an Amazon RDS MySQL database in an isolated subnet) usingAWS-StartPortForwardingSessionToRemoteHostwithout exposing database ports to the internet. - SSH Tunneling (
AWS-StartSSHSession): Proxies standard OpenSSH and SCP commands over Session Manager via the SSHProxyCommanddirective, enabling secure file copy and IDE remote development without public IPs.
A financial services company manages a fleet of 300 Amazon Linux 2023 production EC2 instances. Corporate compliance policy mandates that: (1) security patches must be tested in staging for 10 days after vendor release before production installation, (2) the package kernel-6.1.55-75.123 must never be installed due to a known application driver incompatibility, and (3) patch compliance must be audited weekly. How should the CloudOps engineer configure Systems Manager to fulfill this policy?
An operations team configures a 4-hour Maintenance Window running every Saturday at 23:00 UTC to apply operating system updates to production database proxies using the AWS-RunPatchBaseline task. To ensure that no new patching tasks begin during the final hour so in-flight tasks can finish cleanly and proxies can reboot before midnight traffic increases, how should the Maintenance Window parameters be set?
A security auditor mandates that cloud administrators must access private Amazon EC2 instances without managing SSH keys or deploying bastion hosts. All terminal interactions must be recorded in real-time, encrypted with an AWS KMS customer managed key, and administrators must be restricted from accessing instances tagged with Environment=Production. Which architecture meets these security requirements?