AWS Systems Manager for Fleet Operations: Session Manager, Run Command, Patch Manager, State Manager and Inventory

AWS SysOps Associate 60 min min read Updated: Nov 17, 2026 Intermediate
AWS Systems Manager for Fleet Operations: Session Manager, Run Command, Patch Manager, State Manager and Inventory
Intermediate Topic 3 of 4

What Systems Manager Is

AWS Systems Manager (SSM) is the operations hub to view, control and patch EC2 instances, on-premises servers and VMs without SSH keys or open inbound ports. It is central to the SysOps exam.

GroupCapabilities
Node managementFleet Manager, Inventory, Compliance, Session Manager, Run Command, State Manager, Patch Manager, Distributor, Hybrid Activations
Operations managementExplorer, OpsCenter, CloudWatch dashboards, Incident Manager
Change managementAutomation, Change Manager, Maintenance Windows, Change Calendar
Application managementParameter Store, AppConfig, Application Manager

Making an Instance a Managed Node

  1. SSM Agent installed and running (preinstalled on Amazon Linux 2/2023, recent Ubuntu and Windows AMIs)
  2. Instance profile with AmazonSSMManagedInstanceCore policy (or Default Host Management Configuration for the account)
  3. Network path to SSM endpoints: internet/NAT, or VPC interface endpoints ssm, ssmmessages, ec2messages (and S3 gateway endpoint for some features)
  4. The instance appears under Fleet Manager as Online
bash aws ssm describe-instance-information --query 'InstanceInformationList[].[InstanceId,PingStatus,PlatformName,AgentVersion]' --output table # On-premises servers: create a hybrid activation, then register the agent with the code and id aws ssm create-activation --default-instance-name onprem --iam-role SSMServiceRole --registration-limit 20
Not showing in Fleet Manager?Fix
No instance profileAttach a role with AmazonSSMManagedInstanceCore
Agent stoppedStart amazon-ssm-agent, check /var/log/amazon/ssm/amazon-ssm-agent.log
No network pathAdd NAT or the three VPC endpoints and allow HTTPS 443 outbound in the security group
Wrong Region or old AMIUse a supported AMI and check the Region

Session Manager

  • Browser or CLI shell to instances through IAM. No SSH key, no bastion, no inbound port 22
  • Every session can be logged to S3 and CloudWatch Logs and audited in CloudTrail
  • Restrict with IAM (ssm:StartSession on tagged instances) and session documents
  • Port forwarding to reach private databases or RDP
bash aws ssm start-session --target i-0abc aws ssm start-session --target i-0abc --document-name AWS-StartPortForwardingSession --parameters '{"portNumber":["3306"],"localPortNumber":["13306"]}'

Run Command

Run a command document on many instances at once, selected by instance ids, tags or resource groups, with rate controls, output to S3 and SNS notifications.

bash aws ssm send-command --document-name AWS-RunShellScript --targets Key=tag:env,Values=prod \ --parameters 'commands=["df -h","sudo systemctl restart nginx"]' --max-concurrency 10% --max-errors 1 \ --output-s3-bucket-name ops-command-logs --comment "restart nginx" aws ssm list-command-invocations --command-id <id> --details --query 'CommandInvocations[].[InstanceId,Status]' aws ssm get-command-invocation --command-id <id> --instance-id i-0abc
  • AWS-RunShellScript (Linux) and AWS-RunPowerShellScript (Windows) are common documents. Others: AWS-ConfigureAWSPackage, AWS-UpdateSSMAgent, AWS-RunPatchBaseline
  • **MaxConcurrency and MaxErrors** limit blast radius
  • Custom documents (JSON/YAML) become reusable runbooks

Patch Manager

ConceptMeaning
Patch baselineRules about which patches are approved: OS, classification (Security, Bugfix), severity, auto-approval delay in days, approved and rejected lists. AWS provides default baselines per OS. Create custom baselines
Patch group / tagTag Patch Group (or newer tag-based targeting) links instances to a baseline
OperationScan (report only) or Install (apply, reboot if needed)
DocumentAWS-RunPatchBaseline
Maintenance windowScheduled time period to run tasks safely
ComplianceShows which instances are compliant with the baseline
Patch policies (Quick Setup)Org-wide patching configuration across accounts and Regions
bash aws ssm create-patch-baseline --name prod-linux --operating-system AMAZON_LINUX_2023 \ --approval-rules 'PatchRules=[{PatchFilterGroup={PatchFilters=[{Key=CLASSIFICATION,Values=[Security]},{Key=SEVERITY,Values=[Critical,Important]}]},ApproveAfterDays=3,ComplianceLevel=CRITICAL}]' aws ssm register-patch-baseline-for-patch-group --baseline-id pb-0abc --patch-group prod-web aws ssm create-maintenance-window --name sat-night --schedule "cron(0 22 ? * SAT *)" --duration 3 --cutoff 1 --allow-unassociated-targets aws ssm describe-instance-patch-states --instance-ids i-0abc aws ssm describe-patch-group-state --patch-group prod-web
  • Patch dev first, then prod with an approval delay
  • Use rate control in the maintenance window task so only a few instances reboot at a time and Auto Scaling or the load balancer keeps service up
  • For immutable fleets, patch the golden AMI and replace instances (instance refresh) instead of patching in place

State Manager

State Manager keeps instances in a desired state with associations: a document + targets + schedule. Examples: install or update the CloudWatch agent, ensure antivirus is running, run AWS-GatherSoftwareInventory, join a domain. It reapplies at each schedule so drift is corrected.

bash aws ssm create-association --name AmazonCloudWatch-ManageAgent --targets Key=tag:env,Values=prod \ --parameters action=configure,mode=ec2,optionalConfigurationSource=ssm,optionalConfigurationLocation=/cwagent/config --schedule-expression "rate(1 day)"

Inventory, Compliance and Explorer

  • Inventory collects installed applications, network config, Windows updates, files and custom data. Use Resource Data Sync to send it to S3 for Athena queries
  • Compliance shows patch and association status
  • Explorer is a customizable dashboard of operational data and OpsItems across accounts and Regions

Distributor and Parameter Store

  • Distributor packages and installs software (agents) on instances, versioned
  • Parameter Store holds configuration and secrets (SecureString) used by scripts and documents

Typical Ops Workflow

text 1. Tag instances (env, patch-group) → targets 2. State Manager keeps CloudWatch agent + SSM agent updated 3. Maintenance window Saturday 22:00: Scan, then Install on dev; after 3 days approve and Install on prod (10% at a time) 4. Compliance dashboard reviewed Monday; failures become OpsItems 5. Session Manager for break/fix, all sessions logged

Practice Tasks

  1. Make an instance a managed node and confirm it is Online
  2. Open a Session Manager session and review the session log in S3
  3. Run df -h on all instances with a tag using Run Command
  4. Create a patch baseline, assign a patch group and run a scan
  5. Create an association that installs the CloudWatch agent and check its compliance

Conclusion

Systems Manager gives key-less access and fleet control: it needs the SSM Agent, an instance profile and a network path. Use Session Manager instead of SSH, Run Command with rate limits, Patch Manager baselines with maintenance windows, State Manager associations for desired state, and Inventory and Compliance for visibility.

Quick Summary: SSM overview; managed node setup; Session Manager; Run Command; Patch Manager; State Manager; Inventory; workflow.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators