Configuration Management and IaC · Topic 5 of 5

Systems Manager and Workflow Automation

Automate operations at scale with Systems Manager Run Command, Automation, State Manager, Patch Manager and Parameter Store, plus Step Functions workflows.

  • 5 min
In a nutshell
  • Instances need the SSM Agent, AmazonSSMManagedInstanceCore and network access to Systems Manager.
  • Run Command is for one off actions; State Manager keeps a state; Automation runs multi step runbooks.
  • max-concurrency and max-errors throttle Run Command.

What it is

AWS Systems Manager is a set of operations tools for managing fleets of EC2 instances, on premises servers and other resources without logging in to each one. Each capability solves a different problem, and the exam expects you to match the problem to the capability.

For work that spans many steps or services, AWS Step Functions orchestrates the flow with branching, retries and waiting.

Targetstags or resource groupsSystems ManagerActioncommand, patch, runbookresultsS3 and CloudWatchlogs

How it works

The agent and the role

Managed instances run the SSM Agent and have an instance profile with the AmazonSSMManagedInstanceCore policy. The instance needs a network path to the Systems Manager endpoints, either through the internet or through VPC endpoints. Servers outside AWS register with a hybrid activation.

The main capabilities

CapabilityWhat it does
Run CommandRuns a one off command or script on many targets
AutomationRuns a multi step runbook against AWS resources
State ManagerKeeps a desired configuration applied on a schedule
Patch ManagerScans and installs patches using baselines
Maintenance WindowsSchedules tasks in an approved time window
Parameter StoreHolds configuration and secrets in a hierarchy
Session ManagerGives a shell through IAM, with no inbound ports or SSH keys
InventoryCollects software and configuration data from instances

Run Command

Run Command targets instances by ID or by tag. Rate controls limit the blast radius.

aws ssm send-command --document-name "AWS-RunShellScript" \
  --targets "Key=tag:Environment,Values=prod" \
  --parameters 'commands=["systemctl restart app"]' \
  --max-concurrency "10%" --max-errors "1"

max-concurrency caps how many targets run at once and max-errors stops the run after that many failures. Output can go to S3 or CloudWatch Logs.

Automation runbooks

An Automation runbook is a document with steps such as aws:executeAwsApi, aws:runCommand, aws:approve, aws:branch, aws:waitForAwsResourceProperty and aws:executeScript. AWS provides many ready made runbooks, and you can write your own in YAML.

aws ssm start-automation-execution --document-name AWS-RestartEC2Instance \
  --parameters "InstanceId=i-0123456789abcdef0"

Automation can run across several accounts and Regions with rate control, which suits fleet wide fixes. A runbook runs with an assume role, so it can act on resources the caller cannot touch directly, and an approval step can hold it for a human.

State Manager and Patch Manager

State Manager associations apply a document to targets on a schedule, for example to keep the CloudWatch agent installed and configured. If someone removes it, the next run puts it back.

Patch Manager uses a patch baseline to define which patches are approved. Instances join a patch group by tag, and the AWS-RunPatchBaseline document either scans or installs. Run it inside a maintenance window for controlled timing.

Baselineapproved patchespatch group tagInstancesprod fleetmaintenance windowInstalland reboot

Parameter Store

Parameters use a path hierarchy such as /myapp/prod/db-url. Types are String, StringList and SecureString, which is encrypted with KMS.

Parameters are versioned, and the advanced tier adds policies such as expiration. Use Secrets Manager instead when you need built in rotation.

Orchestration with Step Functions

Step Functions runs state machines defined in the Amazon States Language. Each state can invoke Lambda, start a build, call another AWS service directly, wait, branch or run work in parallel, and the service handles Retry and Catch for errors.

Workflow typeFit
StandardLong running, up to a year, exactly once execution, full history
ExpressHigh volume and short, running up to five minutes

Pick Step Functions over chained Lambda functions when a process has many steps, needs waits for human approval, or needs durable state and error handling. Pick EventBridge Scheduler or a rule on a schedule to start recurring workflows.

Large scale thinking

At scale, target by tag or resource group, never by a hand maintained list of IDs. Roll out in stages with rate controls, log every run, and make each step safe to run twice. Wrap repeatable work in runbooks or state machines so it can be triggered by an event, by a schedule or by a person.

What to remember for the exam

  • Instances need the SSM Agent, AmazonSSMManagedInstanceCore and network access to Systems Manager.
  • Run Command is for one off actions; State Manager keeps a state; Automation runs multi step runbooks.
  • max-concurrency and max-errors throttle Run Command.
  • Patch groups use the tag Patch Group with a patch baseline, and AWS-RunPatchBaseline installs or scans.
  • Session Manager needs no inbound port, no bastion and no SSH key, and can log sessions to S3 or CloudWatch Logs.
  • Parameter Store SecureString uses KMS; Secrets Manager adds rotation.
  • Hybrid activations bring on premises servers under Systems Manager.
  • Step Functions suits long, branching workflows with retries and approvals.
Exam tip

If a question needs fleet wide changes with no SSH access and a full audit trail, Systems Manager Run Command or Session Manager is usually the answer.

Common mistakes

Opening port 22 for administration. Session Manager removes that exposure and logs every session.

Targeting instance IDs by hand. New instances are missed, whereas tags catch them.

Confusing Automation and Run Command. Run Command works inside instances, while Automation drives AWS APIs and can include Run Command steps.

Letting a long process live in one Lambda function. Functions have a time limit, so split the work into states.

Watch out

Patching an entire production fleet in one run can take it all down together, so use rate controls and maintenance windows.

Check yourself

  • Which tool keeps the CloudWatch agent installed on every instance over time?

    A State Manager association that applies the install document on a schedule.

  • How do you limit the damage of a bad Run Command script?

    Set a low max-concurrency and max-errors so the run stops early.

  • When do you prefer Step Functions to chained Lambda functions?

    For multi step flows needing branching, retries, waiting or human approval with durable state.

Topic 5 of 5 in Configuration Management and IaC

Test yourself on Configuration Management and IaC

The full AWS DOP-C02 question bank has 844 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by AWS. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.