DOP-C02 Practice Question 94: CDK Bootstrap Trust Cross Account
AWS Certified DevOps Engineer – Professional (DOP-C02) · Test 10 · question 4 of 10
A central tooling account runs a CDK Pipelines pipeline that deploys stacks into a separate production account. A DevOps engineer needs the production account to allow the tooling account's pipeline to assume the CDK bootstrap roles created there, so the pipeline can deploy without storing long-lived credentials for the production account.
Which command accomplishes this?
Show answer and explanation
Answer:
Bootstrapping is run once per target environment, so it must run against the production account (the one being deployed into), and --trust names the account that is allowed to assume the bootstrap roles created there, which is the tooling account that hosts the pipeline. The --cloudformation-execution-policies flag sets the managed policy attached to the CloudFormation execution role that CDK deployments will run under in the target account. This is exactly the standard pattern CDK Pipelines documents for cross-account deployment.
Option A tries to use cdk deploy with a role assumption flag as a substitute for bootstrapping; it does not create or configure the trust relationship between accounts that the bootstrap roles depend on, and CDK Pipelines does not work this way.
Option B manually assumes a role from the build stage, which bypasses the CDK Pipelines cross-account mechanism entirely and would require the pipeline to already have a way to obtain credentials in the production account, which is the exact problem bootstrapping solves.
Option D reverses the accounts: it bootstraps the tooling account and trusts the production account, which is backwards. The environment being deployed into (production) is the one that needs the bootstrap stack and the trust policy pointing back at the account that deploys to it (tooling).
Reference: Customize AWS CDK bootstrapping