Home / AWS Certified DevOps Engineer - Professional (DOP-C02) / Mock exam
AWS Certified DevOps Engineer - Professional (DOP-C02) Exam-style mock test

AWS DevOps Engineer Professional (DOP-C02) Practice Exams|Practice test

Full explanations Exam format Pass line 75%
33 USD One-time · lifetime access
Enroll →

Sample questions

Example1 · SDLC Automation
Meridian Trust, a global bank, runs a single CodePipeline in a shared tooling account that must deploy CloudFormation stacks into a separate production account, as required by its audit team. The deploy action fails with an access denied error when the production account tries to read the pipeline artifacts from Amazon S3. What should the DevOps engineer do to make the cross-account deployment work?
・Switch the artifact store to the AWS managed aws/s3 KMS key and add an S3 bucket policy that grants the production account read access to the artifact prefix.
Incorrect. The AWS managed aws/s3 key cannot have its key policy modified, so the production account can never be granted kms:Decrypt on it; the bucket policy alone does not solve the encryption-level denial.
✓Encrypt the artifact store with a customer managed KMS key, grant the production account decrypt rights, and have the deploy action assume a cross-account role.
Correct. Cross-account CodePipeline requires a customer managed KMS key on the artifact store whose key policy grants the target account decrypt access, plus a role in the production account that the deploy action assumes.
・Create a second CodePipeline in the production account, replicate the artifact bucket into that account with S3 replication, and trigger the second pipeline whenever replicated artifact objects arrive in the destination bucket.
Incorrect. A second pipeline in the production account violates the audit requirement of a single centrally governed pipeline in the tooling account and adds replication lag and duplicate release state to manage.
・Add a bucket policy granting the production account access and keep SSE-S3 encryption, because CodePipeline artifacts do not require KMS keys for cross-account reads.
Incorrect. CodePipeline artifact stores used across accounts must be encrypted with a customer managed KMS key; SSE-S3 provides no mechanism to authorize the target account's decryption of pipeline artifacts.
Explanation
Cross-account pipelines hinge on two grants: the artifact store must use a customer managed KMS key that the target account can decrypt, and the action must assume an IAM role in the target account. AWS managed keys cannot be shared across accounts, and duplicating pipelines breaks the centralized governance requirement.
Example2 · Configuration Management and IaC
A global investment bank deploys its trade-settlement platform with CloudFormation templates stored in Git. A PCI DSS audit flagged that the Amazon RDS master credentials are passed as NoEcho parameters whose values live in a pipeline configuration file. The security team now requires that credentials never appear in the repository, parameter files, or stack metadata, and that credential rotation must not require a stack update. Which solution meets these requirements?
・Keep the NoEcho parameters but encrypt the parameter file with a customer managed AWS KMS key, and have the pipeline's build stage decrypt the file just before each deployment runs.
Incorrect. Encrypting the parameter file still leaves the plaintext value in the build environment and passes it to CloudFormation as a parameter, where it remains part of the deployment inputs; rotation would also require re-encrypting the file and re-running a stack update.
✓Store the credentials in AWS Secrets Manager and reference them in the RDS resource properties with a {{resolve:secretsmanager:...}} dynamic reference.
Correct. A Secrets Manager dynamic reference is resolved by CloudFormation at deployment time, so the secret value never appears in the template, parameter files, or stack metadata, and Secrets Manager rotation updates the database credential without any stack update.
・Store the credentials as String parameters in AWS Systems Manager Parameter Store and reference them in the template by using the Fn::ImportValue intrinsic function.
Incorrect. Fn::ImportValue reads cross-stack export values, not Parameter Store entries, and a String (non-SecureString) parameter stores the credential unencrypted, so this fails both mechanically and on the encryption requirement.
・Place the credentials in the template's Mappings section and restrict access to the template with an S3 bucket policy that allows only the CloudFormation service role.
Incorrect. Mappings values are plaintext inside the template itself, which is stored in Git, so the credentials would appear in the repository and in the stack definition regardless of the S3 bucket policy.
Explanation
Dynamic references to AWS Secrets Manager let CloudFormation fetch the secret only at provisioning time, keeping credentials out of source control, parameter files, and stack metadata while supporting rotation that is decoupled from stack updates. The distractors all leave the plaintext value somewhere in the deployment chain or use a mechanism (Fn::ImportValue, Mappings) that cannot retrieve secrets at all.
Example3 · Resilient Cloud Solutions
A global payments company runs its card-authorization API in us-east-1 with a warm standby stack in eu-west-1. A recent game day revealed that failover relied on a Lambda function in us-east-1 calling the Route 53 API to repoint DNS. The updated DR policy requires that failover must not depend on any control-plane API call at the moment of a Regional incident. Which solution meets this requirement?
✓Pre-create primary and secondary failover records with a Route 53 health check on the primary endpoint so DNS answers shift in the data plane
Correct. Failover records and health checks are evaluated by the Route 53 data plane, which is globally distributed and designed for 100 percent availability, so no API call is needed at incident time.
・Keep the CloudWatch alarm in us-east-1 but move the Lambda function that calls ChangeResourceRecordSets into eu-west-1 so the record update runs from the healthy Region
Incorrect. ChangeResourceRecordSets is still a control-plane call, and the Route 53 control plane itself is hosted in us-east-1, so the update could fail during exactly the event it is meant to handle.
・Use a weighted routing policy set to 100/0 and have the on-call engineer update the weights to 0/100 once the primary Region is declared unhealthy
Incorrect. Updating weights requires a ChangeResourceRecordSets control-plane call plus a human in the loop, violating the policy and adding minutes of manual delay.
・Configure AWS Global Accelerator and add the eu-west-1 endpoint group to the accelerator during the incident after confirming the primary stack is down
Incorrect. Adding an endpoint group during the incident is a Global Accelerator control-plane modification, which is exactly the dependency the DR policy prohibits.
Explanation
Static stability means the failover path must already exist and be exercised by data-plane mechanisms alone. Pre-provisioned Route 53 failover records with health checks shift traffic automatically without any API call, whereas every other option mutates configuration through a control plane at incident time.
Example4 · Monitoring and Logging
A healthcare SaaS provider runs a HIPAA-regulated patient portal on Amazon ECS with Fargate. Each request handler must emit per-tenant latency and error-count metrics for roughly 500 hospital tenants so that on-call engineers can set CloudWatch alarms per tenant. Security review prohibits adding sidecar containers to task definitions, and the platform team requires that no synchronous AWS API calls be added to the request path. Which approach meets these requirements?
✓Write log lines in CloudWatch embedded metric format to the task's log group so metrics with a TenantId dimension are extracted asynchronously.
Correct. Embedded metric format turns structured log lines into CloudWatch metrics asynchronously during log ingestion, so no API call runs in the request path and no sidecar is needed; high-cardinality dimensions such as TenantId are supported.
・Call the PutMetricData API from each request handler with TenantId as a dimension, batching up to 20 metric values per call to reduce the total request volume.
Incorrect. PutMetricData is a synchronous AWS API call inside the request path, which the platform team explicitly prohibits, and at 500 tenants the call volume risks API throttling.
・Add a CloudWatch agent sidecar container to every task definition and emit per-tenant metrics over UDP to the agent's StatsD listener.
Incorrect. The security review explicitly prohibits sidecar containers in the task definitions, so running the CloudWatch agent as a StatsD sidecar violates a stated constraint.
・Create a CloudWatch Logs metric filter for each tenant on the task log group and publish a separate custom metric from each matched pattern.
Incorrect. CloudWatch Logs allows a limited number of metric filters per log group (far below 500), so a filter per tenant exceeds the quota and is unmanageable at this cardinality.
Explanation
Embedded metric format is the purpose-built way to publish high-cardinality custom metrics from containers: the application only writes structured log lines, and CloudWatch extracts metrics and dimensions asynchronously. This avoids both the prohibited sidecar and synchronous PutMetricData calls, while per-tenant metric filters break down at 500 tenants due to per-log-group filter quotas.
Example5 · Incident and Event Response
A genomics analytics company subject to HIPAA runs 40 member accounts in AWS Organizations. GuardDuty is enabled organization-wide with a delegated administrator in a central security account. The security operations team wants every finding with severity 7 or higher, from any member account, to start a triage Step Functions state machine in the security account within seconds, with the least per-account configuration. What should a DevOps engineer do?
・Create an EventBridge rule in every member account that matches high-severity GuardDuty findings and set the Step Functions state machine in the security account as the rule's direct cross-account target.
Incorrect. EventBridge cross-account targets must be another event bus, not a Step Functions state machine, and maintaining a rule in all 40 accounts contradicts the least-configuration requirement.
・Enable GuardDuty findings export to an S3 bucket in the security account and schedule a Lambda function that scans newly exported objects for severity 7 or higher findings every 15 minutes.
Incorrect. S3 findings export is batched and periodic, so a scheduled scan adds up to 15 minutes of delay, which violates the within-seconds trigger requirement for triage.
✓Create an EventBridge rule in the delegated administrator account that matches GuardDuty finding events with a severity of 7 or higher and targets the triage Step Functions state machine.
Correct. GuardDuty replicates member findings to the delegated administrator account, where EventBridge emits a finding event for every member finding. A single rule there with a severity filter can invoke the state machine directly with no member-account changes.
・Create a CloudWatch Logs subscription filter on the GuardDuty log group in each member account and stream matching records to a Kinesis stream in the security account.
Incorrect. GuardDuty does not write findings to a CloudWatch Logs log group, so there is no log group to attach a subscription filter to; findings are surfaced through EventBridge, the console, and the API.
Explanation
Because GuardDuty aggregates member findings into the delegated administrator account and generates EventBridge events there, one rule in that account covers all 40 accounts in near real time. The key discriminator is knowing where organization-wide GuardDuty events materialize and that cross-account EventBridge targets must be event buses.
Example6 · Security and Compliance
A streaming media company runs a central tooling account where AWS CodePipeline builds channel-packaging microservices and deploys them with AWS CloudFormation into separate dev, staging, and production accounts. Pipeline artifacts live in an Amazon S3 bucket encrypted with an AWS KMS key in the tooling account. Production deployments fail with KMS access denied errors, and the security team mandates least-privilege cross-account access for the pipeline. What should the DevOps engineer implement?
・Switch the artifact bucket to the AWS managed aws/s3 KMS key, add a bucket policy granting each workload account's root principal s3:GetObject access, and keep using the pipeline's default service role for every deployment stage.
Incorrect. The AWS managed aws/s3 key cannot be used for cross-account access: its key policy cannot be edited, so principals in the workload accounts can never be granted kms:Decrypt on it, and the deployments would still fail.
✓Create a deployment role in each workload account that trusts the tooling account, grant it access to the artifact bucket, add it to the customer managed KMS key policy, and configure the pipeline actions to assume it.
Correct. Cross-account deployment roles trusted by the tooling account, combined with S3 bucket access and an entry in the customer managed KMS key policy, is the standard least-privilege pattern for CodePipeline multi-account deployments.
・Create an IAM user with long-lived access keys in each workload account, store the key pairs in AWS Secrets Manager in the tooling account, and have the pipeline retrieve them at run time for each cross-account deployment.
Incorrect. Long-lived IAM user access keys violate the least-privilege and credential-hygiene mandate; temporary credentials from assumed roles eliminate static secrets and are the required pattern for cross-account pipelines.
・Use CloudFormation StackSets to replicate the whole pipeline, artifact bucket, and customer managed KMS key into every one of the workload accounts so that each account independently builds and deploys its own artifacts without any cross-account role assumption.
Incorrect. Duplicating the pipeline into every account removes the single release control point, multiplies the infrastructure to patch and audit, and causes artifact and version drift between environments instead of fixing the access issue.
Explanation
Multi-account CodePipeline deployments require a cross-account role in each target account that the pipeline assumes, plus artifact bucket and customer managed KMS key policies that grant those roles access. The key discriminator is that AWS managed keys cannot have their key policies edited for cross-account use, and static IAM user keys or duplicated pipelines break least privilege and centralized release control.
Example7 · SDLC Automation
Kurobe Machinery builds firmware update bundles for its CNC controllers in a shared tooling account, where CodePipeline stores artifacts in an S3 artifact bucket encrypted with the default settings. A CodeDeploy action in the production account must install the bundle on an EC2 fleet, but the cross-account action fails with an access denied error when the production account's role downloads the artifact. The DevOps engineer must fix the pipeline with the least disruption. What should the engineer do?
・Enable S3 Same-Region Replication to copy every artifact into a bucket owned by the production account, and reconfigure the CodeDeploy deployment group to read all application revisions from that replica bucket instead.
Incorrect. CodePipeline cross-account actions must read from the pipeline's own artifact store; replicating objects to a second bucket breaks the pipeline's artifact tracking and adds replication lag, and it still does not solve decryption of the KMS-encrypted objects.
✓Create a dedicated customer managed AWS KMS key for the pipeline artifact store, and grant the production account's cross-account CodeDeploy action role permission to use that key for decryption and to read the artifact bucket objects.
Correct. Cross-account CodePipeline actions require a customer managed KMS key on the artifact store, because the key policy must grant the other account decrypt permissions; combined with bucket access for the cross-account role, the download succeeds.
・Keep the default AWS managed encryption key and add an S3 bucket policy that grants the production account's CodeDeploy service role s3:GetObject on the artifact bucket.
Incorrect. The default artifact encryption uses an AWS managed KMS key whose key policy cannot be edited, so the production account can never be granted kms:Decrypt; a bucket policy alone still leaves the objects unreadable.
・Create an S3 gateway VPC endpoint in the production account with an endpoint policy that lets the CodeDeploy fleet's instance profile reach the tooling account's artifact bucket.
Incorrect. A gateway VPC endpoint only controls the network path to S3; it grants no S3 or KMS permissions, so the cross-account role still cannot decrypt the artifact objects.
Explanation
Cross-account artifact sharing in CodePipeline hinges on encryption: the artifact store must use a customer managed KMS key whose policy grants the consuming account decrypt access, plus matching bucket permissions. Replication, bucket policies on AWS managed keys, and VPC endpoints all fail because none of them can authorize the other account to decrypt the artifacts.
Example8 · SDLC Automation
A freight-forwarding platform keeps three services in a single GitHub monorepo: /tracking-api, /route-optimizer, and /warehouse-ui. Each service has its own CodePipeline V2 pipeline connected through AWS CodeConnections, and today any push to main starts all three pipelines, tripling CodeBuild cost and blocking the release queue. The team wants each pipeline to start only when its own service changes, with the least custom code to maintain. Which solution meets these requirements?
・Create a Lambda function behind a GitHub webhook that computes the diff of every push and calls StartPipelineExecution only for the pipelines whose service directories contain modified files.
Incorrect. A webhook-driven Lambda that diffs commits and starts pipelines works, but it is custom code the team must secure, test, and maintain, which violates the least-custom-code requirement when a native trigger filter exists.
・Move each service onto its own long-lived dedicated Git branch and configure each pipeline's CodeConnections source trigger to watch only that service's branch.
Incorrect. Per-service branches abandon the monorepo trunk-based workflow the team already uses; cross-service changes would need multiple branch merges, and the restructuring does nothing a native path filter cannot do.
・Create EventBridge rules that match repository push events from the connection and route each event to the pipeline whose service name the commit message contains.
Incorrect. Push events delivered through EventBridge do not reliably carry changed file paths, and keying execution off commit-message text is convention-based and silently fails whenever a developer forgets the service name.
✓Define Git trigger file-path filters on each pipeline so it starts only when the push modifies that service's directory.
Correct. CodePipeline V2 pipelines support Git trigger file-path filters on CodeConnections sources, so each pipeline starts only for pushes that touch its directory, with no custom infrastructure.
Explanation
CodePipeline V2 natively supports trigger filters on file paths for CodeConnections sources, which is purpose-built for monorepos: each pipeline fires only when its directory changes. Lambda webhooks and EventBridge routing recreate this with fragile custom logic, and per-service branches change the team's workflow rather than the trigger.
Example9 · SDLC Automation
An industrial IoT manufacturer runs an Amazon EKS cluster in each of 12 plant accounts to process sensor telemetry. Plant technicians occasionally run kubectl edits during night shifts, so clusters drift from the approved configuration. Leadership mandates a GitOps model: a Git repository is the single source of truth, and any divergence between a cluster and the repository must be corrected automatically without an engineer starting a deployment. Which approach satisfies the mandate?
✓Run a GitOps controller such as Flux or Argo CD inside each cluster that pulls the configuration repository and continuously reconciles live state; CI pipelines only build images and update manifests.
Correct. A pull-based GitOps controller watches the repository and the cluster, detecting and reverting any drift within its reconciliation loop, which is exactly the continuous enforcement the mandate requires.
・Build one CodePipeline per plant account in which a CodeBuild action assumes a cluster admin role and runs kubectl apply against the cluster every time a change is pushed to the manifest repository branch.
Incorrect. A push-based pipeline only acts when a commit lands; a technician's out-of-band kubectl edit leaves the cluster drifted until the next push, so divergence is not corrected automatically.
・Use CloudFormation StackSets with drift detection enabled to distribute the Kubernetes manifests to all plant accounts from the organization's management account.
Incorrect. StackSets manages CloudFormation stacks, not arbitrary in-cluster Kubernetes objects; its drift detection reports differences for stack resources but does not continuously watch or revert kubectl edits inside EKS.
・Create an SSM State Manager association in each plant account that reapplies a copy of the manifests stored in Amazon S3 on a fixed daily schedule.
Incorrect. A daily scheduled reapply leaves clusters drifted for up to 24 hours, uses S3 copies rather than Git as the live source of truth, and overwrites rather than reconciles declarative state.
Explanation
The requirement to auto-correct divergence without a triggered deployment is the signature of pull-based GitOps: an in-cluster controller such as Flux or Argo CD continuously reconciles live state against Git. Push pipelines, StackSets, and scheduled reapplies all act only at discrete moments, leaving night-shift drift in place between runs.
Example10 · SDLC Automation
An online gaming studio runs CodePipeline in a shared tooling account. The pipeline must deploy a CloudFormation stack into the production account, but the CloudFormation action running in the production account fails with access-denied errors when reading the deployment artifact from the S3 artifact store. The security team prohibits public buckets and requires encryption at rest for all artifacts. What should a DevOps engineer do?
・Keep the default AWS managed KMS key on the artifact store and add a bucket policy that grants s3:GetObject on the artifact prefix to the production account's CloudFormation action role.
Incorrect. The AWS managed aws/s3 key has a fixed key policy that cannot grant cross-account kms:Decrypt, so the production account role can list objects but can never decrypt the encrypted artifacts.
・Enable S3 Same-Region Replication from the artifact store to a new bucket in the production account and reconfigure the production CloudFormation deploy action to read the replicated artifact objects from that local bucket instead of the tooling account store.
Incorrect. CodePipeline actions must consume input artifacts from the pipeline's configured artifact store; a replicated copy is not referenced by the action, and replication lag would also race against the deploy stage.
✓Encrypt the artifact store with a customer managed KMS key, grant the production role decrypt in the key and bucket policies, and assume a cross-account deploy role.
Correct. Cross-account CodePipeline requires a customer managed KMS key whose key policy can grant decrypt to the production account, plus a bucket policy for object access and a cross-account deploy role the pipeline assumes.
・Attach an S3 gateway endpoint policy in the production account that allows access to the tooling account artifact bucket and run the CloudFormation deployment through that VPC endpoint.
Incorrect. A VPC endpoint policy only constrains which S3 resources traffic through the endpoint may reach; it grants no cross-account IAM permission and does not solve the KMS decrypt denial on the artifact objects.
Explanation
Cross-account artifact consumption hinges on the KMS key: only a customer managed key can extend decrypt rights to the production account via its key policy, combined with a bucket policy and an assumable cross-account action role. Replication, endpoint policies, or bucket policies alone never fix the encryption-side denial.
Example11 · SDLC Automation
A multi-tenant B2B SaaS provider keeps 12 microservices in a single monorepo connected to AWS through CodeConnections. Every push currently starts one large pipeline that rebuilds all 12 services, wasting about 35 minutes per commit. Each service team wants its own pipeline to start only when files under that service's directory change, and leadership wants minimal custom code to maintain. What should the DevOps engineer implement?
✓Create a CodePipeline V2 pipeline per service and configure Git trigger filters on the CodeConnections source so each pipeline starts only for pushes that modify its service's file paths.
Correct. CodePipeline V2 supports trigger filters on file paths (plus branches and tags) for CodeConnections sources, so per-service pipelines start natively only when their directory changes, with no custom code.
・Keep the single V1 pipeline and add a Lambda function, invoked by an EventBridge rule on repository events, that diffs each commit through the provider API and calls StartPipelineExecution for the matching services.
Incorrect. This works mechanically but requires writing and operating a commit-diffing Lambda, violating the minimal-custom-code requirement when path-based trigger filtering is a built-in V2 pipeline feature.
・Split the monorepo into 12 separate repositories and attach a standard CodePipeline source action to each repository so pushes naturally trigger only that service's pipeline.
Incorrect. Repository splitting forces a disruptive migration, breaks shared-library commits that span services, and abandons the monorepo workflow the teams explicitly want to keep.
・Configure a single V2 pipeline with 12 parallel build actions and use branch-based trigger filters so each team pushes changes to a dedicated branch named after its service.
Incorrect. Branch filters key on ref names, not changed paths, so a per-service branching convention changes the team workflow and the single pipeline would still rebuild everything it contains on each trigger.
Explanation
Monorepo selective builds are a native capability of CodePipeline V2: Git trigger filters on file paths with a CodeConnections source start only the affected service pipelines. Custom diff Lambdas and repo splits solve the same problem with far more operational burden, and branch filters cannot see which paths changed.
Example12 · SDLC Automation
A state university system maintains 12 microservices for its student portal in a single GitHub monorepo connected through AWS CodeConnections, and campus governance requires the monorepo to remain intact for shared-library management. Each service has its own CodePipeline, and today a push to any path starts all 12 pipelines, wasting build minutes and delaying urgent fixes during enrollment week. Each pipeline must start only when files under its service's directory change on the main branch. What is the MOST operationally efficient solution?
・Create an Amazon EventBridge rule for repository push events that starts all 12 pipelines, and add an early manual approval action so engineers can abandon the pipeline executions that are not actually needed.
Incorrect. Every push would still launch all 12 pipelines and then wait on humans to abandon them, which keeps consuming pipeline executions and adds manual toil instead of removing the unnecessary starts.
・Split the monorepo into 12 separate GitHub repositories and point each pipeline at its own repository's main branch for isolation.
Incorrect. Repository splitting would achieve path isolation, but it directly violates the governance requirement that the monorepo remain intact for shared-library management.
✓Migrate each pipeline to CodePipeline V2 and configure Git trigger filters on the CodeConnections source to match the main branch and that service's directory file paths.
Correct. CodePipeline V2 supports Git-based trigger filters on branches and file paths for CodeConnections sources, so each pipeline starts natively only when its service's directory changes on main, with no extra compute or custom logic.
・Add a CodeBuild action at the start of every pipeline that runs git diff against the prior commit and calls StopPipelineExecution whenever no files in that service's directory were modified.
Incorrect. Every pipeline still starts on every push and burns a CodeBuild invocation to decide whether to stop itself, so build minutes and execution noise are reduced far less than with native path-filtered triggers.
Explanation
CodePipeline V2 Git trigger filters evaluate branch and file-path conditions before an execution is created, which is exactly what a monorepo with per-service pipelines needs. The alternatives either start pipelines anyway and cancel them with custom or manual steps, or restructure the repository in violation of the stated governance constraint.
Example13 · SDLC Automation
A regional electric utility uses AWS Organizations with a shared tooling account that hosts a central CodePipeline. Security mandates that all releases flow from this tooling account into a separate production account, where a deploy action must run CloudFormation stack updates. The pipeline's S3 artifact store and build stages already work inside the tooling account. Which additional configurations are required to make the cross-account deployment work? (Choose THREE.)
✓Attach a bucket policy to the artifact S3 bucket that allows the production account's deployment role to get objects from it.
Correct. The production account's role reads input artifacts directly from the tooling account's artifact bucket, so the bucket policy must explicitly allow that cross-account principal.
✓Create an IAM role in the production account that trusts the tooling account, and configure the pipeline's deploy action to assume that role.
Correct. CodePipeline performs cross-account actions by assuming a role in the target account; that role must trust the tooling account and hold the permissions the CloudFormation deployment needs.
・Enable S3 replication from the artifact bucket into a new bucket owned by the production account and reconfigure the CloudFormation deploy action to read its templates from the replicated copy.
Incorrect. CodePipeline deploy actions consume input artifacts from the pipeline's own artifact store, not from an arbitrary replicated bucket, so replication adds copies and cost without enabling the cross-account action.
✓Encrypt the pipeline artifact store with a customer managed AWS KMS key whose key policy grants usage to the production account.
Correct. Cross-account actions cannot decrypt artifacts protected by the default key, so the artifact store must use a customer managed KMS key with a key policy that authorizes the production account.
・Keep the default aws/s3 AWS managed encryption key on the artifact store and enable S3 Transfer Acceleration so the production account can retrieve the build artifacts with lower latency.
Incorrect. The aws/s3 AWS managed key cannot have its key policy edited to grant another account decrypt permission, so the production account's role could never read the encrypted artifacts; Transfer Acceleration only affects transfer speed, not authorization.
Explanation
Cross-account CodePipeline deployments hinge on three authorizations: a customer managed KMS key the target account can use, an artifact bucket policy that permits the target account's role, and a deploy-action role in the target account that trusts the pipeline account. Options that rely on the AWS managed S3 key or on bucket replication fail because neither grants the target account the required decrypt and artifact-access path.
Example14 · SDLC Automation
A life insurance carrier operates a central tooling account that hosts a single CodePipeline deploying CloudFormation stacks into a separate production account, as required by its audit team (one pipeline, no duplicated pipelines per account). The CloudFormation deploy action in the production account fails with access denied errors when reading the pipeline artifacts. What should the DevOps engineer do?
✓Encrypt the artifact store with a customer managed AWS KMS key shared with production, and have the deploy action assume a cross-account IAM role granted access to the bucket and key.
Correct. Cross-account CodePipeline requires a customer managed KMS key on the artifact store whose key policy grants the target account decrypt access, a bucket policy allowing that account, and a deploy action role in the production account that the pipeline assumes.
・Keep the default SSE-S3 encryption on the artifact bucket and add a bucket policy that grants s3:GetObject on the artifact prefix to the production account root principal.
Incorrect. The default artifact encryption uses an AWS managed key (aws/s3-style) whose key policy cannot be edited, so the production account can never be granted kms:Decrypt on the artifacts even if the bucket policy allows s3:GetObject.
・Use S3 replication to copy the pipeline artifacts into a bucket owned by the production account and point the CloudFormation deploy action at the replicated bucket.
Incorrect. CodePipeline actions can only consume artifacts from the pipeline's configured artifact store; a replicated bucket in another account cannot be referenced as the input artifact location for a deploy action.
・Create a second CodePipeline in the production account that starts when artifacts land in an S3 bucket there, and have the tooling pipeline copy the artifacts across with a dedicated CodeBuild step.
Incorrect. A second pipeline in the production account would deploy successfully, but it duplicates pipelines across accounts, which directly violates the audit team's single-pipeline requirement.
Explanation
Cross-account pipelines hinge on three pieces: a customer managed KMS key (the default AWS managed key cannot grant cross-account decrypt), an artifact bucket policy for the target account, and a cross-account action role the pipeline assumes in production. The key discriminator is recognizing that the encryption key, not just the bucket policy, blocks cross-account artifact reads.
Example15 · SDLC Automation
An airline keeps its booking, check-in, and loyalty microservices in a single GitHub monorepo connected to AWS through CodeConnections. Each service has its own CodePipeline, but today every push to main starts all three pipelines, wasting build minutes and delaying urgent fixes. The team wants each pipeline to start only when files under its service's directory change, with no custom code to maintain. What should the DevOps engineer do?
・Create an EventBridge rule for repository push events emitted through the connection and use the changed file paths in the event detail to route to the matching pipeline.
Incorrect. Push notification events delivered through the connection identify the repository and branch but do not include a list of changed file paths, so an EventBridge rule has nothing to filter directories on.
・Deploy a Lambda function behind a repository webhook that clones the repo, diffs the pushed commits to find changed directories, and calls StartPipelineExecution for each affected service pipeline.
Incorrect. A webhook-plus-Lambda router works, but it introduces custom diffing code, credentials, and a function the team must patch and monitor, which violates the no-custom-code-to-maintain requirement.
・Keep V1 pipelines with source polling enabled and add a first CodeBuild stage to every pipeline that inspects the commit diff and stops its own execution when no relevant paths changed.
Incorrect. Every push still starts all three pipelines and consumes an execution before the CodeBuild diff check aborts it, so build minutes are still wasted and pipeline history fills with no-op runs.
✓Migrate each service's pipeline to CodePipeline V2 and define Git push triggers on the CodeConnections source with branch and file path filters that match that service's own directory in the monorepo, so each pipeline starts only on relevant changes.
Correct. CodePipeline V2 supports Git-based triggers on CodeConnections sources with branch and file path filters, so each pipeline starts only when its directory changes, with no code to operate.
Explanation
File path filtering for monorepos is a native capability of CodePipeline V2 Git triggers on CodeConnections sources, which eliminates both wasted executions and custom routing code. The discriminator is knowing that V2 trigger filters evaluate changed paths before any execution starts, unlike EventBridge events (no path data) or in-pipeline diff checks (execution already consumed).
▶ Try 10 free questions (graded)
Measure your readiness with a full mock exam
All questions · full explanations · lifetime access
Enroll(33 USD)