Back to Blog

Multi-Account & Cross-Region CI/CD for the AWS DevOps Engineer Professional (DOP-C02): Cross-Account CodePipeline, StackSets & Deployment Governance

A practitioner's guide to multi-account and cross-region delivery for the DOP-C02 exam: why teams split into AWS accounts, cross-account CodePipeline with the required customer-managed KMS key, CloudFormation StackSets (self-managed vs service-managed), cross-region actions and artifact buckets, approval gates, and org-wide guardrails — with IAM policies and CLI examples.

By Sailor Team , July 26, 2026

Introduction

By the time an organization is large enough to send someone to sit the AWS Certified DevOps Engineer – Professional (DOP-C02) exam, it has almost certainly stopped running everything in one account. Production lives in its own account, development in another, security tooling in a third, and a shared “deployment” account runs the pipelines that push code into all of them. This multi-account shape is not an architecture curiosity — it is the environment the DOP-C02 assumes in its scenarios, and questions constantly hinge on the mechanics that make delivery work across account boundaries.

The exam rarely asks “what is AWS Organizations?” Instead it asks: a pipeline in the tools account must deploy a CloudFormation stack into the production account — what does it need? Or: a new account joins an organizational unit and must automatically receive the baseline guardrail stack — which feature does that? These are delivery-governance questions, and they reward engineers who know the specific wiring: the cross-account IAM roles, the customer-managed KMS key that cross-account CodePipeline cannot live without, the difference between self-managed and service-managed StackSets, and how cross-region actions move artifacts.

This guide walks that wiring end to end. It builds on the single-account pipeline mechanics in the SDLC automation guide and the templating details in the configuration management and IaC guide, and extends them to the multi-account, multi-region reality the professional exam tests.

Why Split into Multiple Accounts at All

The AWS account is the strongest isolation boundary the platform offers. Splitting workloads across accounts, all grouped under AWS Organizations, buys you several things the exam expects you to recognize:

  • Blast-radius containment. A runaway process, a compromised credential, or a service-limit exhaustion is confined to one account instead of taking down everything.
  • Clean separation of environments. Dev, staging, and prod in separate accounts means IAM, quotas, and billing are naturally partitioned — no risk of a dev role touching prod data.
  • Centralized governance. Organizational Units (OUs) group accounts so policy can be applied to many at once, and Service Control Policies (SCPs) set the maximum permissions any account (even its root user) can have.
  • Delegated autonomy. Teams get their own accounts to move fast, while guardrails keep them inside the lines.

A typical layout has a management account (billing and Organizations only — you don’t run workloads there), a shared services / tools account that hosts CI/CD, a security/log-archive account, and one workload account per environment. The pipeline’s job is to reach out of the tools account and deploy into the workload accounts. Everything below is about doing that safely.

Cross-Account CodePipeline: The Wiring That Trips People Up

Picture a pipeline in the Tools account that must deploy to Dev, Staging, and Prod accounts. Three pieces have to line up, and the exam tests each one:

1. Cross-Account IAM Roles

The pipeline doesn’t get magic access to another account. In each target account you create a deployment role that trusts the Tools account, and the pipeline action assumes it. The trust policy on the target-account role looks like this:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": { "AWS": "arn:aws:iam::111111111111:root" },
      "Action": "sts:AssumeRole"
    }
  ]
}

Here 111111111111 is the Tools account. The pipeline’s action references the target role via its RoleArn, and CodePipeline uses STS to assume it for the deploy. Least privilege still applies — the role grants only what the deployment needs (for example, CloudFormation and the specific resource permissions).

2. A Customer-Managed KMS Key — the Classic Exam Gotcha

CodePipeline passes build output between stages as artifacts in an S3 bucket in the Tools account. When a target account needs to read those artifacts, it must be able to decrypt them. Here is the single most tested fact in this topic:

Cross-account CodePipeline requires a customer-managed KMS key (CMK) to encrypt artifacts. The default AWS-managed S3 key (aws/s3) cannot be shared with another account.

So you create a CMK in the Tools account and:

  • Add the target-account deployment roles to the KMS key policy with kms:Decrypt and kms:GenerateDataKey.
  • Add a bucket policy on the artifact bucket granting those roles s3:GetObject.
  • Point the pipeline’s artifactStore at that CMK via encryptionKey.

If a DOP-C02 scenario says “a cross-account deploy fails with access denied on the artifact bucket,” the answer is almost always a missing or misconfigured customer-managed KMS key policy, not an S3 permission alone.

3. The Deploy Action Itself

For a CloudFormation deployment there are actually two roles in play, and confusing them is a common mistake:

RolePurpose
CodePipeline action role (RoleArn)The cross-account role the pipeline assumes to invoke the action in the target account.
CloudFormation service role (RoleArn on the CFN action config)The role CloudFormation itself assumes to create the resources in the stack.

A cross-account CloudFormation deploy action, in pipeline JSON, references the target account’s role and the template artifact:

{
  "name": "DeployToProd",
  "actionTypeId": {
    "category": "Deploy", "owner": "AWS",
    "provider": "CloudFormation", "version": "1"
  },
  "roleArn": "arn:aws:iam::333333333333:role/CrossAccountPipelineRole",
  "configuration": {
    "ActionMode": "CREATE_UPDATE",
    "StackName": "app-prod",
    "TemplatePath": "BuildOutput::template.yaml",
    "RoleArn": "arn:aws:iam::333333333333:role/CfnDeployRole",
    "Capabilities": "CAPABILITY_NAMED_IAM"
  }
}

Deploying to Many Accounts at Once: CloudFormation StackSets

Cross-account CodePipeline is ideal for promoting one application through environments. But some deployments need to hit dozens of accounts at once — a baseline IAM role, a Config rule, a logging bucket, a guardrail. Doing that with one pipeline action per account doesn’t scale. CloudFormation StackSets solve exactly this: one template, deployed as stack instances across a chosen set of accounts and regions in a single operation.

The exam cares most about the two permission models:

ModelHow permissions workAuto-deploy to new accounts?
Self-managedYou manually create an AWSCloudFormationStackSetAdministrationRole in the admin account and an AWSCloudFormationStackSetExecutionRole in every target account (trusting the admin).No — you add target accounts by hand.
Service-managedIntegrated with AWS Organizations; you deploy to an OU and CloudFormation uses service-linked roles. Requires trusted access between CloudFormation and Organizations.Yes — new accounts added to the OU automatically get the stacks.

That last column is the differentiator the exam loves. If a question says “any account added to the Sandbox OU in the future must automatically receive the security baseline stack,” the answer is a service-managed StackSet with automatic deployment enabled — not a Lambda that watches for new accounts.

A service-managed StackSet deploying to an OU across two regions looks like this on the CLI:

aws cloudformation create-stack-set \
  --stack-set-name security-baseline \
  --template-body file://baseline.yaml \
  --permission-model SERVICE_MANAGED \
  --auto-deployment Enabled=true,RetainStacksOnAccountRemoval=false \
  --capabilities CAPABILITY_NAMED_IAM

aws cloudformation create-stack-instances \
  --stack-set-name security-baseline \
  --deployment-targets OrganizationalUnitIds=ou-abcd-12345678 \
  --regions us-east-1 eu-west-1 \
  --operation-preferences FailureToleranceCount=2,MaxConcurrentCount=5

Those operation preferences matter too: FailureToleranceCount and MaxConcurrentCount control how many accounts can fail or deploy in parallel, and you can order regions to roll out to a canary region first. For the template mechanics underneath StackSets, see the CloudFormation guide.

Going Cross-Region

Multi-region delivery shows up both for latency and for disaster recovery. Two mechanics are testable:

  • CodePipeline cross-region actions. A single pipeline can run an action in a region different from the pipeline’s own region. The requirement to remember: CodePipeline needs an artifact store (S3 bucket) in every region the pipeline touches. CodePipeline replicates the input artifacts into the action’s region automatically, but the bucket must exist and be configured in the pipeline’s artifactStores map. Forgetting the per-region bucket is the cross-region equivalent of the KMS gotcha.
  • StackSet regions. A StackSet deploys the same template to a list of regions in one operation, which is how you roll a guardrail or a regional stack out consistently.

Multi-region delivery pairs naturally with the resilience patterns — Route 53 failover, multi-region data, and RTO/RPO — covered in the resilient cloud solutions guide. On the exam, keep the two ideas distinct: cross-region delivery (getting the deployment there) versus cross-region resilience (surviving a regional failure).

Approval Gates and Deployment Governance

Pushing to production across accounts usually needs a human checkpoint and an auditable trail.

  • Manual approval actions. Insert a Manual approval action before the prod stage. It can publish to an SNS topic so reviewers are notified with a link to review, and the pipeline pauses until someone approves or rejects — with the decision recorded.
  • Guardrails with SCPs. Service Control Policies applied to an OU cap what every account under it can do, regardless of that account’s own IAM. Even if a pipeline’s deploy role is over-permissioned, an SCP can forbid, say, disabling CloudTrail or launching in a banned region. SCPs and the broader security automation story are covered in the security and compliance automation guide.
  • Landing zones with Control Tower. AWS Control Tower sets up a multi-account landing zone with pre-built guardrails (detective and preventive), a shared log archive, and account factory for provisioning new accounts consistently. For the exam, know what it is and that it automates the org-wide baseline you’d otherwise assemble from Organizations, SCPs, Config, and StackSets by hand.
  • Org-wide compliance visibility. An AWS Config aggregator rolls compliance data from all accounts and regions into one view, so you can answer “is every account compliant with rule X?” centrally.

Putting It Together: A Reference Flow

A production-grade DOP-C02 delivery model ties these pieces into one flow:

  1. Code merges in the Tools account; CodePipeline starts.
  2. CodeBuild builds and tests, writing artifacts to an S3 bucket encrypted with a customer-managed KMS key.
  3. The pipeline deploys to Dev by assuming a cross-account role there; automated tests run.
  4. A manual approval (SNS-notified) gates promotion to Prod.
  5. The Prod deploy assumes the Prod account’s CloudFormation role and updates the stack.
  6. A separate service-managed StackSet keeps a security baseline deployed across every account in the OU, auto-applying to new accounts.
  7. SCPs, Config aggregation, and Control Tower guardrails enforce and report compliance the whole time.

If you can narrate that flow and name what each hop requires, you can answer the majority of multi-account questions on the exam.

Common DOP-C02 Multi-Account Traps to Watch For

  • Cross-account CodePipeline needs a customer-managed KMS key. The default aws/s3 key can’t be shared across accounts.
  • Cross-region pipelines need an artifact bucket per region. CodePipeline replicates artifacts, but the buckets must exist.
  • Service-managed StackSets auto-deploy to new OU accounts; self-managed don’t. Match the model to the “future accounts” requirement.
  • Two roles in a cross-account CFN deploy: the pipeline action role (to invoke) and the CloudFormation service role (to create resources).
  • SCPs cap permissions; they don’t grant them. An SCP can only restrict what IAM otherwise allows.
  • The management account is for Organizations/billing — don’t run workloads or pipelines there.

Conclusion

Multi-account, cross-region delivery is where the DOP-C02 separates engineers who have only run a single-account pipeline from those who operate at organizational scale. The concepts are not exotic — a pipeline in one account assumes a role in another and deploys — but the details are unforgiving. Cross-account artifacts demand a customer-managed KMS key. Cross-region pipelines demand a bucket in each region. “Automatically cover future accounts” demands a service-managed StackSet. Miss one of those and the scenario’s answer changes.

Study this the way the exam frames it: as delivery-governance problems. For each scenario, ask what the deployment needs to reach the target (roles, keys, buckets) and what keeps it inside the guardrails (SCPs, Control Tower, Config). Learn the two-role CloudFormation pattern, the StackSet permission models, and the KMS requirement cold, because they recur.

Then pressure-test that knowledge against realistic questions. Sailor.sh’s AWS Certified DevOps Engineer Professional (DOP-C02) Mock Exam Bundle includes full-length, timed exams with detailed explanations across all six domains — including the multi-account CI/CD, StackSets, and cross-region deployment scenarios this guide covered. Working through them is the fastest way to close the gap between recognizing a concept and picking the right answer under a 180-minute clock.

To round out your preparation, pair this with the SDLC automation and configuration management & IaC guides for the single-account foundations, the monitoring and observability guide for operating what you deploy, and the DOP-C02 study plan to sequence it all. The official AWS documentation on CloudFormation StackSets is worth reading closely.

Frequently Asked Questions

Why does cross-account CodePipeline require a customer-managed KMS key?

CodePipeline stores build artifacts in an S3 bucket in the pipeline’s account, and a target account must be able to decrypt them to deploy. The default AWS-managed S3 key (aws/s3) cannot be shared across accounts, so you must use a customer-managed KMS key and grant the target-account deployment roles kms:Decrypt and kms:GenerateDataKey in the key policy.

What is the difference between self-managed and service-managed StackSets?

Self-managed StackSets require you to create administration and execution IAM roles in each account manually, and you add target accounts by hand. Service-managed StackSets integrate with AWS Organizations, deploy to an OU using service-linked roles, and can automatically deploy to any account added to that OU later. Choose service-managed when future accounts must be covered without manual steps.

How do I deploy a CloudFormation stack from a pipeline in one account into another account?

Create a deployment role in the target account that trusts the pipeline’s (Tools) account, reference it as the CodePipeline action’s RoleArn, and give the CloudFormation action a CloudFormation service role in the target account. Also encrypt pipeline artifacts with a customer-managed KMS key shared with the target account. The pipeline assumes the cross-account role via STS to run the deploy.

What do I need for a cross-region CodePipeline?

A CodePipeline that runs actions in multiple regions needs an S3 artifact store bucket in every region the pipeline uses, declared in the pipeline’s artifactStores map. CodePipeline replicates the input artifacts into each action’s region automatically, but the regional buckets must exist first.

How do Service Control Policies fit into multi-account deployment governance?

SCPs are applied to organizational units or accounts and set the maximum permissions available in those accounts — they cannot grant permissions, only restrict them. They enforce guardrails (for example, blocking specific regions or preventing anyone from disabling CloudTrail) regardless of what an account’s own IAM policies allow.

What does AWS Control Tower add on top of AWS Organizations?

Control Tower automates the setup of a multi-account landing zone: it provisions a baseline with preventive and detective guardrails, a centralized log archive and audit account, and an Account Factory for consistently vending new accounts. It packages the org-wide governance you would otherwise assemble manually from Organizations, SCPs, AWS Config, and StackSets.

Limited Time Offer: Get 80% off all Mock Exam Bundles | Sale ends in 7 days. Start learning today.

Claim Now