Certopolis

AWS Certified Solutions Architect – Professional

Systems Manager Automation across accounts and Regions: SAP-C03

The Systems Manager User Guide says a central account starts one automation that runs the runbook in each target account and Region. To target OUs, the central account must be the management account or a delegated administrator. Location concurrency limits how many account-Region pairs run at once. Concurrency and the error threshold limit resources inside each pair.

How a multi-account and multi-Region automation is set up

You run the automation from one central account. To target OUs, that account must be able to list the accounts in them, which only the organization's management account or a delegated administrator can do. AWS recommends a delegated administrator, registered for the ssm.amazonaws.com service principal. For accounts outside AWS Organizations, AWS recommends a dedicated automation account.

Two IAM roles are needed. AWS-SystemsManager-AutomationAdministrationRole exists only in the central account. AWS-SystemsManager-AutomationExecutionRole must exist in every target account, and AWS recommends CloudFormation StackSets to create it there. A custom runbook must also be shared with all target accounts.

You choose the runbook, the Regions, and the accounts or OUs. When resources are targeted by tags or a resource group, the automation finds the matching resources in each account and Region, so you do not list instance IDs. The central automation's step outputs are the IDs of the child automations in the target accounts.

Two levels of rate control

The first level counts locations. Five accounts in four Regions make 20 account-Region pairs. Location concurrency sets how many pairs run the automation at the same time, as a number or a percentage. AWS states that these options do not restrict the number of resources that run the automation.

The second level applies inside each pair. Concurrency sets how many targets run the automation at once, as a number or as a percentage of the target set. The most resources that can be running at one moment is therefore the number of concurrent pairs multiplied by the concurrency inside each pair.

The error threshold is how many automations may fail before Systems Manager stops sending the automation to more resources. With a threshold of 3 it stops at the fourth error. With 0 it stops after the first error. Automations that are already running are allowed to finish, and some of them may fail too. To be sure the failures never exceed the threshold, set concurrency to 1.

EventBridge triggers, approvals and Run Command

A runbook can be the target of an Amazon EventBridge rule, on a schedule or on an event such as an EC2 instance entering the running state. Events from AWS services in an account always go to that account's default event bus, so the rule belongs on the default bus. Every required runbook parameter needs a value. If one is missing, the rule is created but does not run.

The aws:approve action pauses an automation until the named approvers approve or reject it. It waits 7 days by default and 30 days at most. It does not support multi-account and Region automations.

Run Command has the same two controls for a command sent to many managed nodes, targeted by tags, resource groups or node IDs. max-concurrency defaults to 50 and max-errors defaults to 0. Invocations already running when the error limit is reached are allowed to complete.

Where the exam catches people

  • Believing location concurrency limits how many instances run at once: it limits account-Region pairs only. The per-pair concurrency limits resources.
  • Believing an error threshold of 0 guarantees a single failure: automations already in progress finish and can fail. Set concurrency to 1 as well.
  • Believing the execution role is needed only in the central account: AWS-SystemsManager-AutomationExecutionRole must exist in every target account.
  • Believing an aws:approve step can gate a multi-account and Region automation: that action does not support them.
  • Believing a rule on a custom event bus receives EC2 state-change events: AWS service events go to the account's default event bus.

Written from these sources

Try 3 questions on this

Pick an answer to see why each option is right or wrong.

  1. A retailer's operations account is the delegated administrator for AWS Systems Manager in its organization. The AWS-SystemsManager-AutomationExecutionRole role is deployed to all 12 accounts in the Stores organizational unit (OU), and each account runs about 150 store servers tagged Role=pos in each of two Regions. The team will restart those servers by running the AWS-RestartEC2Instance runbook once from the operations account as a multi-account and multi-Region automation that targets the OU and the tag. Every restarted server reconnects to a single license service, which rejects reconnections when more than 10 servers reconnect at the same time. The restarts must never have more than 10 servers reconnecting at once anywhere in the organization. Which combination of steps will meet these requirements? (Select TWO.)

    Right. In the game that’s Renown for your Operational Excellence and Automation building.

    Not that one: B,C is right. In the game your Operational Excellence and Automation building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    A multi-account and multi-Region automation has a separate control for each factor. Location concurrency sets how many account-Region pairs run at once, and AWS notes that it places no limit on how many resources run the automation. The rate control concurrency sets how many targets run at once inside each pair, either as a number or as a percentage of that pair's targets. Holding location concurrency at 1 and target concurrency at 10 makes the product 1 times 10, so the organization never has more than 10 servers reconnecting. The cost is time: 24 pairs are worked through one after another.

    Written from docs.aws.amazon.com/systems-manager/latest/userguide/running-automations-multiple-accounts-regions.html

  2. An operations team must run a custom AWS Systems Manager Automation runbook that rewrites a configuration file and restarts a service on 200 production instances. A runbook bug last quarter broke 30 instances before anyone could react. For this run, if the runbook fails on any instance, the run must not reach further instances, and no more than one instance may be left in a failed state in total. The change window allows 5 hours, and each instance takes about 1 minute. Which solution will meet these requirements?

    Right. In the game that’s Renown for your Operational Excellence and Automation building.

    Not that one: B is right. In the game your Operational Excellence and Automation building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    A concurrency of 1 means nothing else is in flight when the first failure arrives, so at most one instance is left broken. At about a minute per instance, 200 instances fit in the 5-hour window.

    Written from docs.aws.amazon.com/systems-manager/latest/userguide/running-automations-scale-controls.html

  3. A company wants each Amazon EC2 instance in its production account to be tagged and registered in its asset inventory as soon as the instance enters the running state. An engineer has written an AWS Systems Manager Automation runbook that takes the instance ID as a required parameter and does both tasks. The platform team already keeps its own application event routing on a custom event bus named ops-bus. No custom code may be added. Which solution will meet these requirements with the LEAST operational overhead?

    Right. In the game that’s Renown for your Operational Excellence and Automation building.

    Not that one: B is right. In the game your Operational Excellence and Automation building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    Automation runbooks are a supported EventBridge target, and an input transformer copies the instance ID from the event into the runbook's required InstanceId parameter, so one rule starts the runbook for each instance with no code.

    Written from docs.aws.amazon.com/systems-manager/latest/userguide/running-automations-event-bridge.html

Ask for something