Certopolis

AWS Certified DevOps Engineer – Professional

StackSets self-managed vs service-managed permissions (DOP-C02)

With self-managed permissions you create the IAM roles StackSets needs in the administrator account and every target account, and you can deploy to any account. With service-managed permissions, the CloudFormation User Guide says StackSets creates the roles for you, deploys to accounts managed by AWS Organizations, and can deploy automatically to accounts added later.

What does the self-managed model require?

Two IAM service roles must exist before the StackSet is created. AWSCloudFormationStackSetAdministrationRole goes in the administrator account, the account where the StackSet is created. AWSCloudFormationStackSetExecutionRole goes in every account where stack instances will be created. Together they form the trust relationship between the administrator account and the target accounts.

This model works with any AWS account in which you can create an IAM role, so it does not need AWS Organizations. You target accounts by ID, and you maintain the roles yourself.

What does the service-managed model add?

Trusted access between StackSets and AWS Organizations must be activated first, and only an administrator in the management account can do that. StackSets then creates the execution role in each target account on your behalf. By default that role is named stacksets-exec-* and has the AdministratorAccess policy.

A StackSet can target the whole organization or specific OUs. CloudFormation does not deploy stacks to the management account, even if that account is in a targeted OU.

Member accounts can be registered as delegated administrators, up to five at a time, and can then create and manage service-managed StackSets. On the AWS CLI a delegated administrator must add --call-as DELEGATED_ADMIN to each command. The management account cannot limit a delegated administrator to certain OUs or operations.

How does automatic deployment follow OU membership?

Automatic deployment is available only for service-managed StackSets. When it is on, CloudFormation deploys stacks to accounts that are added to a target organization or OU. When an account leaves a target OU, its stack is removed, and you choose whether the stack's resources are deleted or retained. Moving an account between target OUs runs a delete for the old StackSet and queues a create for the new one.

The setting applies to the whole StackSet and cannot be adjusted per OU, account or Region. Accounts added later use the StackSet's default parameter values, not values that were overridden for existing accounts.

Operation preferences control the pace in either model. Maximum concurrent accounts limits how many accounts are worked on at once. Failure tolerance is the number or percentage of failures allowed per Region before CloudFormation stops the operation. Operations run in one Region at a time, in the deployment order you give.

Where the exam catches people

  • Believing a service-managed StackSet that targets the root also deploys to the management account: CloudFormation never deploys service-managed stacks there.
  • Believing a delegated administrator can run StackSets CLI commands unchanged: each call needs --call-as DELEGATED_ADMIN.
  • Believing service-managed permissions work for accounts outside the organization: they need AWS Organizations. Self-managed permissions reach any account where you can create a role.
  • Believing automatic deployment can be switched on for one OU only: it is set at the StackSet level.
  • Believing failure tolerance is counted across the whole operation: it is counted per Region.

Written from these sources

Try 3 questions on this

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

  1. A managed service provider runs its release pipeline in a deployment account. The pipeline must use AWS CloudFormation StackSets to roll one monitoring template out to 25 customer AWS accounts in two AWS Regions. The customer accounts belong to different companies and are not members of any organization in AWS Organizations. Every customer has agreed to let the provider create IAM roles in its account. The pipeline's IAM role will call CreateStackSet without passing an administration role ARN, so StackSets must use its default role names. Which combination of steps should the DevOps engineer take to meet these requirements? (Select THREE.)

    Right. In the game that’s Renown for your Configuration Management and IaC building.

    Not that one: A,D,E is right. In the game your Configuration Management and IaC building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    The deployment account, which owns the stack set, holds AWSCloudFormationStackSetAdministrationRole; CloudFormation assumes it and from it assumes AWSCloudFormationStackSetExecutionRole in every customer account. Each customer's execution role must trust the deployment account and carry whatever the monitoring template creates. Because the pipeline relies on the default administration role, its own role still needs iam:PassRole on that role, or CreateStackSet is refused even though no ARN was passed.

    Written from docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs-self-managed.html

  2. A company has 140 accounts in an organization in AWS Organizations with all features enabled. The accounts are grouped into OUs by business unit, and accounts move between OUs when teams reorganize. A DevOps engineer must deploy an AWS CloudFormation template that creates a network monitoring baseline to every account in the Finance OU and the Retail OU in three AWS Regions. The platform team does not want to create or maintain any IAM roles in the target accounts for this deployment. The deployment targets must be expressed as OUs, not as lists of account IDs. Which solution will meet these requirements?

    Right. In the game that’s Renown for your Configuration Management and IaC building.

    Not that one: A is right. In the game your Configuration Management and IaC building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    No one on the platform team writes or maintains a role, and nobody keeps account ID lists up to date as teams reorganize.

    Written from docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-concepts.html

  3. A company's security team works only from a security tooling account, which is a member of the company's organization in AWS Organizations. Trusted access for CloudFormation StackSets is already active. The team's pipeline in the tooling account uses the AWS CLI to create service-managed stack sets that deploy detective controls to every OU. Company policy forbids running the pipeline, or any other daily work, in the management account. The first pipeline run fails because the tooling account is not permitted to create service-managed stack sets. Which combination of steps will meet these requirements? (Select TWO.)

    Right. In the game that’s Renown for your Configuration Management and IaC building.

    Not that one: A,D is right. In the game your Configuration Management and IaC building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    Then every StackSets call from the tooling account must say it is acting as that delegated administrator with --call-as DELEGATED_ADMIN; without it the CLI treats the call as the account acting for itself. The stack sets are still created in, and operated by, the management account behind the scenes.

    Written from docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-orgs-delegated-admin.html

Ask for something