Easy ReviewDOP-C02
SDLC Automation55

CodePipeline

Coordinate source changes, tests, approvals, and deployments across accounts and Regions.

CodePipeline arranges release work into stages and actions. These sections explain how revisions, artifacts, permissions, and execution controls determine what reaches the next environment.

Stages, actions, and triggers

CodePipeline coordinates a software release through stages, which group related work, and actionsA configured operation performed at a particular point in a pipeline., which perform that work. An executionOne identified run of a set of changes through a pipeline. is one trip through this workflow.

How it works

  1. A source integration detects a change. For CodeCommit, configure EventBridge and turn off polling with PollForSourceChanges: false.
  2. For external Git repositories, AWS CodeConnections links the repository to a CodeStarSourceConnection action. A webhookAn event notification sent by a repository provider to trigger connected release processing. is the provider’s event notification to that connection.
  3. The source produces files for later actions. Connections output a ZIP by default; a full-clone reference, which lets a build retrieve Git history, works only with CodeBuild.
  4. Stages run in order. Within a stageA group of related release actions that can isolate an environment., equal runOrder values run together; higher values wait for the earlier actions to succeed.
  5. In V2, use connections trigger filters for tags, branches, paths, or pull requests. Branch and path filters combine with AND; excludes win over includes.

Exam cues

  • If the question says GitHub events should start releases, think CodeConnections, because its source action receives provider webhooks.
  • If the question says CodeCommit pushes start duplicate executions, think disable polling, because EventBridge and polling can both start the pipelineA workflow describing how software changes move through a release process..
  • If the question says only one application’s files on a release branch should trigger a run, think V2 branch and path filters, because both conditions must match.

Remember

  • Omitting CodeCommit’s PollForSourceChanges enables polling.
  • A change to one source runs every source action in the pipeline.
  • Equal runOrder values mean parallel actions within a stage.

Trap: A CodeCommit source in PARALLEL mode clones the latest commitA particular version of source content processed by a pipeline., called HEAD, when the source action starts. It can differ from the triggering commit. A connections source captures the pushed revision.

A source revision moves through release actions
source artifact1build artifact2SourceBuild and testDeploy
  1. The source action provides the revision as an artifact.

  2. After build and test succeed, the deployment action consumes the build artifact.

From the AWS docs (14)
  • A pipeline describes a release workflow made of stages containing actions.
  • Actions in a stage with equal runOrder values run in parallel; higher values wait for lower values to succeed.
  • For a CodeCommit source, use EventBridge change detection and set PollForSourceChanges to false to avoid duplicate executions.
  • Omitting PollForSourceChanges from a CodeCommit action configuration enables polling.
  • CodeStarSourceConnection uses AWS CodeConnections to retrieve external repository changes and start a pipeline from provider webhook events.
  • A connections source produces a ZIP artifact by default; its full-clone reference can be consumed only by CodeBuild actions.
  • V2 supports Git tag, branch, file path, and pull request trigger filtering.
  • Git trigger filters apply to CodeStarSourceConnection source actions.
  • Branch and file path filters within one filter type combine with AND.
  • Within a trigger filter, excludes take precedence over includes.
  • When a pipeline has multiple source actions, all source actions run even if only one detected a change.
  • In PARALLEL mode a CodeCommit source clones HEAD when its source action starts, which can differ from the triggering commit.
  • For a connections source, the revision is captured when the commit is pushed, including in PARALLEL mode.
  • A pipeline execution is one identified run of a set of changes through a pipeline.

Pipeline types and execution modes

A pipelineA workflow describing how software changes move through a release process. type selects CodePipeline features. An executionOne identified run of a set of changes through a pipeline. mode controls how overlapping releases share stages. These are separate settings.

How it works

  1. Choose V1 for its supported release features or V2 when you need features such as pipeline-level inputs, trigger filters, or stageA group of related release actions that can isolate an environment. recovery controls.
  2. Choose how waiting executions should proceed at stages.
  3. With SUPERSEDED, a stage locks for one execution and a newer run can replace an older waiting run between stages.
  4. With QUEUED, each locked stage keeps waiting runs in arrival order. Different stages can still process different executions.
  5. With PARALLEL, runs proceed independently without queues.
Mode Waiting behavior Type
SUPERSEDED Newer runs can replace waiting runs between stages V1 or V2; default mode
QUEUED Waiting runs retain arrival order at each stage V2
PARALLEL Independent runs without queues V2

Exam cues

  • If the question says every revisionA particular version of source content processed by a pipeline. must test against one shared environment, think QUEUED, because waiting runs are preserved and the stage serializes access.
  • If the question says older waiting revisions may be skipped, think SUPERSEDED, because only the newest waiting revision needs to enter the stage.
  • If the question says releases use independent environments concurrently, think PARALLEL, because executions do not wait for each other.

Remember

  • Both V1 and V2 support action-level variables.
  • V2 adds pipeline-level variables, source revision overrides, Git filters, stage conditions, rollback, automatic retry, and Commands.
  • PARALLEL does not support stage rollback or rollback failure conditions.

Trap: QUEUED does not restrict the whole pipeline to one execution. It serializes executions at each stage. A source stage and a deployment stage can work on different executions.

From the AWS docs (7)
  • V1 supports action-level variables but not pipeline-level variables, QUEUED mode, or PARALLEL mode.
  • V2 supports pipeline-level variables, source revision overrides, Git trigger filters, stage rollback, stage conditions, automatic stage retry, and the Commands action.
  • SUPERSEDED is the default execution mode.
  • In SUPERSEDED mode a stage handles one execution at a time and newer executions can overtake waiting executions only between stages.
  • QUEUED requires V2 and preserves arrival order at locked stages without superseding waiting executions.
  • PARALLEL requires V2 and runs independent executions without queues.
  • PARALLEL mode does not support stage rollback or failure conditions with a rollback result.

Artifacts and variables

CodePipeline passes files as artifactsA file or set of files that an action produces or consumes. and small configuration values as variables. An artifact is a named bundle of files; a namespaceA name used to identify a set of variables when another action references them. is the name that identifies a producer’s variables.

How it works

  1. Give an actionA configured operation performed at a particular point in a pipeline.’s output artifact a name. A later action lists that name as an input. CodePipeline stores the files in S3.
  2. Assign a namespace to an action that produces variables. Reference a value as #{namespace.variable_key} in a later action’s configuration.
  3. For CodeBuild values, list exported names under env/exported-variables in the buildspecA file containing the commands and settings used by a CodeBuild build., the file containing build instructions. CloudFormation can expose stackA collection of resources managed together from a CloudFormation template. Outputs, and CodeCommit exposes CommitId.
  4. Make the consumer run at a higher runOrder or in a later stageA group of related release actions that can isolate an environment. so the producer finishes first.
  5. For V2 executionOne identified run of a set of changes through a pipeline. inputs, declare pipeline-level variables and reference #{variables.variable_name}. Supply required values when starting the run.

Exam cues

  • If the question says pass a generated image tag without a file, think exported CodeBuild variable and action namespace, because the next action needs a configuration value.
  • If the question says deploy the same pipelineA workflow describing how software changes move through a release process. with a different runtime input, think V2 pipeline-level variables, because their values resolve for each execution.

Remember

  • Files: named input and output artifacts in S3.
  • Generated values: producer namespace and a later consumer.
  • A pipeline variable without a default requires a value at execution start.

Trap: Pipeline-level variables cannot be used in Source actions. Action variables also cannot be consumed by an action that runs in parallel with their producer.

From the AWS docs (13)
  • Artifacts are files or file sets passed between actions through named inputs and outputs.
  • CodePipeline stores pipeline artifacts in an S3 artifact bucket.
  • Action variables require a namespace on the producer and use the reference syntax #{namespace.variable_key}.
  • An action consuming another action variable must run in a later stage or at a higher runOrder in the same stage.
  • CodeBuild action output variables come from environment variables exported during the build.
  • CodeBuild lists environment variable names to export under env/exported-variables in the buildspec.
  • CloudFormation action variables come from stack Outputs.
  • V2 supports pipeline-level variables supplied at execution time.
  • Pipeline-level variables use the variables namespace, as in #{variables.variable_name}.
  • A pipeline-level variable without a default must have a value supplied when the execution starts.
  • Pipeline-level variables cannot be used in Source actions.
  • A buildspec contains the build commands and related settings used by CodeBuild.
  • CodeCommit source actions expose the CommitId output variable.

Manual approvals

A manual approval actionA configured operation performed at a particular point in a pipeline. holds a CodePipeline release for a human decision. It lets a reviewer inspect a change before later actions run.

How it works

  1. Place the approval where the release needs review, such as after staging tests and before production deployment.
  2. Grant the reviewer codepipeline:PutApprovalResult on that action. Console users also need read permissions to view the pipelineA workflow describing how software changes move through a release process..
  3. Optionally publish an SNS notification. SNS distributes messages to subscribed recipients; its topic must be in the pipeline’s Region.
  4. Include a review URL and comments so the reviewer can inspect the change.
  5. Approval resumes the executionOne identified run of a set of changes through a pipeline.. Rejection or an unanswered timeout fails the action. Set timeoutInMinutes on the action if the account default is unsuitable.

Exam cues

  • If the question says staging must pass before a person permits release, think manual approval before deployment, because the execution waits for an authorized decision.
  • If the question says reviewers need email when a release waits, think an SNS approval topic in the pipeline Region, because the approval action publishes notifications there.
  • If the question says review needs more than seven days, think an action timeout override, because the account default can be changed for the approval action.

Remember

  • Unanswered approval timeout: seven days by default; the action override accepts 5 through 86400 minutes.
  • Approval permission: codepipeline:PutApprovalResult on the action.
  • SNS approval topic: same Region as the pipeline.

Trap: An email subscription does not grant approval permission. The reviewer still needs the IAM permission to submit a result.

From the AWS docs (8)
  • A manual approval action pauses an execution until an authorized identity approves or rejects it.
  • Approval resumes execution; rejection fails the action and prevents continuation.
  • An unanswered manual approval fails at its timeout; the account-level default is seven days.
  • A manual approval action can override its timeout from 5 to 86400 minutes.
  • Approval notifications can publish to an SNS topic in the same Region as the pipeline.
  • Manual approval configuration can include a review URL and comments for the reviewer.
  • An approver needs codepipeline:PutApprovalResult permission on the approval action.
  • Console approval access also requires pipeline read permissions; ListPipelines is needed to view the dashboard list.

CloudFormation actions

A CloudFormation actionA configured operation performed at a particular point in a pipeline. lets CodePipeline create, update, or delete a stackA collection of resources managed together from a CloudFormation template., a group of resources managed from a template. A change setA preview of proposed stack changes that can be inspected before resources are changed. is a preview of changes that can be reviewed before resources change.

How it works

  1. Supply TemplatePath as ArtifactName::TemplateFileName. Use TemplateConfiguration for a file of parameter values and an optional stack policyA document that restricts which stack resources can be updated., which restricts stack updates.
  2. Put values known only during the run in ParameterOverrides. This JSON overrides matching values in the configuration file.
  3. For review before applying changes, run CHANGE_SET_REPLACE, manual approval, then CHANGE_SET_EXECUTE.
  4. Set the CloudFormation configuration RoleArn for resource operations. This differs from the action role that reads artifactsA file or set of files that an action produces or consumes. and calls CloudFormation. Both roles must be in the same account.
  5. Acknowledge IAM creation or macrosA template transformation that expands or changes CloudFormation template content., which transform templates, through the applicable Capabilities value.
ActionMode Behavior
CREATE_UPDATE Create a missing stack or update an existing one
CHANGE_SET_REPLACE Create or recreate the named change set
CHANGE_SET_EXECUTE Apply the existing change set
DELETE_ONLY Delete the stack; succeed if it is absent
REPLACE_ON_FAILURE Delete and recreate a failed stack; recommended for testing only

Exam cues

  • If the question says review infrastructure before applying it, think change set, approval, executionOne identified run of a set of changes through a pipeline., because a preview does not change resources.
  • If the question says remove a temporary test stack, think DELETE_ONLY, because it handles deletion and an already absent stack.
  • If the question says a generated parameter must replace a configured value, think ParameterOverrides, because runtime overrides take precedence.

Remember

  • IAM and macro acknowledgments: CAPABILITY_IAM, CAPABILITY_NAMED_IAM, and CAPABILITY_AUTO_EXPAND, as applicable.
  • The action role reads artifacts to generate a signed template URL. The CloudFormation role does not need artifact bucket access for that template URL.

Trap: The configuration RoleArn is not applied for CHANGE_SET_EXECUTE. The change set or stack must already have the intended role.

Preview, review, then apply a change set
review change set1approval2Create previewManual approvalApply changes
  1. CHANGE_SET_REPLACE prepares the change set without applying it.

  2. After approval, CHANGE_SET_EXECUTE applies the changes.

From the AWS docs (17)
  • A CloudFormation stack is a group of resources managed together from a template.
  • A change set previews stack changes without changing the resources.
  • CHANGE_SET_REPLACE creates a change set or deletes and recreates an existing change set with that name.
  • CHANGE_SET_EXECUTE applies an existing change set to a stack.
  • CREATE_UPDATE creates a missing stack or updates an existing stack without deleting a failed stack to replace it.
  • DELETE_ONLY deletes a stack and succeeds if the stack does not exist.
  • REPLACE_ON_FAILURE can delete and recreate a failed stack; AWS recommends it for testing only.
  • TemplatePath identifies a template inside an input artifact using ArtifactName::TemplateFileName.
  • TemplateConfiguration points to an input artifact file containing parameter values and an optional stack policy.
  • ParameterOverrides is JSON that overrides template configuration parameter values and is intended for values known only at pipeline runtime.
  • The configuration RoleArn is the role assumed by CloudFormation to change resources; it is not applied when executing a change set.
  • The CloudFormation configuration RoleArn must be in the same account as the role running the action.
  • The action role needs artifact bucket access to generate a signed template URL; the CloudFormation configuration role does not need that bucket access for the template.
  • Capabilities acknowledges IAM resource creation or macro processing with CAPABILITY_IAM, CAPABILITY_NAMED_IAM, or CAPABILITY_AUTO_EXPAND as applicable.
  • A manual approval pauses a pipeline for an authorized review.
  • A stack policy defines which update actions may affect designated stack resources.
  • A CloudFormation macro performs custom processing and transformation of template content.

Test and invoke actions

Test actionsA configured operation performed at a particular point in a pipeline. check a release before it progresses. Invoke actions run functions or workflows that can perform custom checks. A custom action connects a tool that has no built-in provider.

How it works

  1. For a shared test environment in a stage-locking mode, put deployment and its following test in the same stageA group of related release actions that can isolate an environment.. A later executionOne identified run of a set of changes through a pipeline. cannot replace the environment while that stage is locked.
  2. Choose the action provider that matches the check.
  3. For Lambda, use the job ID from the event to report PutJobSuccessResult or PutJobFailureResult. For a cross-Region function, report to its Region.
  4. For an internal tool, register a custom action. Its workerA process that polls for custom action jobs, performs them, and returns results., the process that performs jobs, polls with PollForJobs, claims a job with AcknowledgeJob, runs the check, and reports the result.
Provider Category What it does
CodeBuild Build or Test Runs buildspecA file containing the commands and settings used by a CodeBuild build. commands in a container
DeviceFarm Test Tests an application on a device pool
Lambda Invoke Runs custom function code and requires a job-result callback
StepFunctions Invoke Starts a workflow; Standard waits for its result, Express only confirms it started
Custom worker Custom action Polls for jobs and reports results from a reachable host

Exam cues

  • If the question says a pipelineA workflow describing how software changes move through a release process. check needs AWS API calls, think Lambda, because function code can perform the check and report the job result.
  • If the question says release must wait for a multi-step workflow, think Standard Step Functions, because its final status determines the action result.
  • If the question says an internal tool runs on a separate host, think custom action worker, because it can poll CodePipeline and execute there.

Remember

  • Stage locking applies to SUPERSEDED and QUEUED, not independent PARALLEL runs.
  • Custom workers need access to the public CodePipeline endpoint.
  • Do not log the full Lambda job event: it contains temporary artifactA file or set of files that an action produces or consumes. credentials.

Trap: Returning normally from Lambda does not finish its pipeline job. An Express workflow’s eventual failure also does not fail an action that already succeeded when starting it.

A custom worker claims and completes a pipeline job
poll and claim1run test2report result3Job workerCodePipelineCustom test
  1. The worker calls PollForJobs and AcknowledgeJob.

  2. The worker performs the custom test on its host.

  3. The worker reports success or failure to CodePipeline.

From the AWS docs (16)
  • CodeBuild can provide Build or Test actions that run buildspec commands in a build container.
  • DeviceFarm is a Test action provider that runs applications against a configured pool of devices and testing framework.
  • Grouping a deployment and its following test in the same locked stage keeps them on the same execution.
  • SUPERSEDED and QUEUED lock stages; PARALLEL executions run independently.
  • A Lambda pipeline action must call PutJobSuccessResult or PutJobFailureResult with the job ID to report completion.
  • A cross-Region Lambda action must send its CodePipeline job result to the Region containing the Lambda function.
  • The CodePipeline event passed to Lambda includes temporary artifact credentials and must not be logged in full.
  • StepFunctions is an Invoke action that starts a state machine, a workflow defined as states and transitions.
  • A Standard Step Functions action waits for a terminal execution status and succeeds only when the workflow succeeds.
  • An Express Step Functions action succeeds when the workflow starts, regardless of its eventual outcome.
  • A custom action requires a worker that can reach the public CodePipeline endpoint to poll for jobs, execute work, and return results.
  • A custom worker calls PollForJobs and then AcknowledgeJob before executing the job.
  • A custom worker finishes by calling PutJobSuccessResult without a continuation token or PutJobFailureResult.
  • Actions with increasing runOrder values run sequentially within a stage.
  • A state machine is a workflow composed of states and transitions.
  • A pipeline Lambda function action uses the Invoke category.

Container deployment artifacts

Container deployment actionsA configured operation performed at a particular point in a pipeline. connect an image stored in a registry to an ECS release. The deploy action needs files that identify the image and explain how to deploy it; an image push alone does not supply those files.

How it works

  1. For standard ECS deployment, create imagedefinitions.json with a JSON array of container name and imageUri pairs. Include it in a source or build artifactA file or set of files that an action produces or consumes..
  2. The standard action creates a new task definitionA configuration describing the containers an ECS application runs. revisionA particular version of source content processed by a pipeline. from the one the service currently uses. A task definition is the configuration describing the containers to run.
  3. For blue/green deploymentA deployment that runs a new application version beside the old version before traffic switches., where the new version runs beside the old before traffic switches, use CodeDeployToECS.
  4. Provide its task definition template, AppSpecA file giving CodeDeploy instructions for an application deployment. deployment instructions, and imageDetail.json. An ECR source can generate the image file on push while a Git source supplies deployment files.
  5. The action replaces image placeholders in the task definition and replaces <TASK_DEFINITION> in the AppSpec with the generated task definition’s resource identifier, or ARNAn identifier that names an AWS resource..

Exam cues

  • If the question says standard ECS deployment needs the build’s image mapping, think imagedefinitions.json, because it maps container names to image URIs.
  • If the question says an image push should release with deployment files in Git, think ECR plus repository sources, because each supplies a different input to CodeDeployToECS.

Remember

  • Standard image file: UTF-8, at most 100 KB; its filename is configurable.
  • Blue/green defaults: taskdef.json and appspec.yaml.
  • ECR source default ImageTag: latest.

Trap: imageDetail.json and imagedefinitions.json serve different actions. Also, the standard ECS action ignores newly registered task definition revisions that the service is not using.

Image and deployment files meet at the blue/green action
image URI1deployment files2ECR sourceimageDetail.jsonGit sourcetaskdef + AppSpecCodeDeployToECS
  1. The ECR source supplies imageDetail.json for the pushed image.

  2. The repository supplies task definition and AppSpec files to the same deploy action.

From the AWS docs (14)
  • An ECS standard deploy action consumes imagedefinitions.json by default; the configured filename can be changed.
  • The standard ECS image definitions file is a JSON array containing name and imageUri pairs for containers.
  • The standard ECS image definitions file must use UTF-8 and cannot exceed 100 KB.
  • The image definitions file must be included in a source or build artifact provided to the deploy action.
  • The standard ECS action creates a task definition revision from the revision currently used by the ECS service and ignores unattached revisions.
  • An ECR source action starts the pipeline when an image is pushed and can accompany a repository source for deployment files.
  • An ECR source produces an output artifact containing imageDetail.json with the image URI.
  • An ECR source action defaults ImageTag to latest when no tag is specified.
  • CodeDeployToECS is the ECS blue/green deployment provider in CodePipeline.
  • CodeDeployToECS uses a task definition template, an AppSpec file, and imageDetail.json image input for dynamic image replacement.
  • CodeDeployToECS defaults to taskdef.json for its task definition template and appspec.yaml for its AppSpec.
  • CodeDeployToECS replaces task definition image placeholders with image URIs and the AppSpec <TASK_DEFINITION> placeholder with the generated task definition ARN.
  • Blue/green deployment runs a new application version alongside the old version before routing traffic to the new version.
  • An Amazon Resource Name, or ARN, uniquely identifies an AWS resource.

Security scan actions

InspectorScan adds a vulnerability check to CodePipeline for source dependencies or container images. A vulnerability is a known software weakness; severity thresholds decide when findings block the actionA configured operation performed at a particular point in a pipeline..

How it works

  1. Add the InspectorScan provider in the Invoke category.
  2. Choose InspectorRunMode: SourceCodeScan and supply source files, or choose ECRImageScan with ECRRepositoryName and ImageTag.
  3. Configure finding-count thresholds through CriticalThreshold, HighThreshold, MediumThreshold, and LowThreshold as needed.
  4. The action scans on CodePipeline-managed CodeBuild compute. A count beyond a configured threshold fails it.
  5. Read its output artifactA file or set of files that an action produces or consumes. for vulnerability information in a software bill of materialsA structured inventory of software components, libraries, and modules., or SBOM, a list of software components and their associated findings.

ECR registry scanning is a separate setting: basic scanning checks operating system packages manually or on push. Enhanced scanning uses Inspector for operating system and language packages, on push or continuously.

Exam cues

  • If the question says block an image release on critical findings, think ECRImageScan and CriticalThreshold, because the action fails when that count exceeds the threshold.
  • If the question says check dependencies in source before deployment, think SourceCodeScan, because it consumes the source artifact.

Remember

  • ECR image scanning does not require the source-code input artifact.
  • The service role needs inspector-scan:ScanSbom and image-read permissions for ECR access.
  • This managed action incurs separate CodeBuild charges.

Trap: A threshold is the allowed finding count. The action fails when the count goes beyond it, not merely when it equals it.

From the AWS docs (12)
  • InspectorScan is a managed compute CodePipeline action that scans source dependencies or container images for vulnerabilities.
  • InspectorScan uses the Invoke action category.
  • InspectorRunMode accepts SourceCodeScan or ECRImageScan.
  • ECRImageScan identifies the image using ECRRepositoryName and ImageTag.
  • CriticalThreshold, HighThreshold, MediumThreshold, and LowThreshold are finding counts beyond which the scan action fails.
  • Source scanning consumes a source artifact; an ECR image scan does not require that source artifact.
  • InspectorScan produces an output artifact with vulnerability information in a software bill of materials file.
  • InspectorScan runs on CodePipeline-managed CodeBuild compute and incurs separate CodeBuild charges.
  • InspectorScan service role permissions include inspector-scan:ScanSbom and ECR image-read permissions for image access.
  • An SBOM is a structured inventory of software components, libraries, and modules.
  • ECR basic scanning checks operating system vulnerabilities using manual or scan-on-push scanning.
  • ECR enhanced scanning uses Inspector to check operating system and programming language package vulnerabilities with scan-on-push or continuous scanning.

Cross-account deployments

A cross-account actionA configured operation performed at a particular point in a pipeline. lets one CodePipeline release workflow deploy resources in another AWS account. The pipelineA workflow describing how software changes move through a release process. assumes an action role, an identity with temporary permissions, in the target account.

How it works

  1. In the pipeline account, configure the artifactA file or set of files that an action produces or consumes. bucket with a customer managed KMS key, an encryption key whose access policy you control. Create the key in the pipeline Region.
  2. Grant the target account access through the bucket and key policies. Give the pipeline service role key access too.
  3. Create the target action role with a trust policyA role policy that identifies which principals may assume the role., which identifies who can assume it, allowing the pipeline service role. Grant the pipeline role sts:AssumeRole permission.
  4. Give the target role deployment permissions and S3/KMS artifact access. Configure its ARNAn identifier that names an AWS resource. on the cross-account action.
  5. The assumed role reads the encrypted artifacts and performs the target deployment. The documented cross-account setup uses the CLI rather than the console.

Exam cues

  • If the question says deployment runs in a separate account, think target action role plus artifact access, because identity trust and artifact permissions are separate requirements.
  • If the question says the role can be assumed but artifact decryption fails, think customer managed keyAn encryption key whose configuration and access you control. permissions and bucket access, because assuming a role alone does not authorize artifact reads.

Remember

  • Use the full key ARN for cross-account clarity. An alias is recognized only in the account that owns it.
  • An action may consume an artifact when it is in the pipeline account, the artifact came from the pipeline account, or the producer is an earlier action in the same account.

Trap: If A owns the pipeline, an artifact cannot pass directly from an action in B to an action in C. Both are outside A and the producer and consumer are in different accounts.

Cross-account deployment
Pipeline account (A)Target account (B)write artifacts1AssumeRole2read artifact (S3 + KMS)3deploy4CodePipelineservice roleiArtifact bucketS3 + customer KMS keyiAction roletrusts pipeline roleiDeploymentCodeDeploy / CFNi
  1. Actions in account A write their output artifacts to the pipeline's S3 bucket, encrypted with the customer managed key.

  2. For the cross-account action, the pipeline service role assumes the action role in account B.

  3. The action role reads the input artifact. This needs the bucket policy, the key policy and its own S3 and KMS permissions.

  4. The action role performs the deployment in account B.

Box details (4)
CodePipeline

The pipeline service role needs sts:AssumeRole on the action role in account B.

Artifact bucket

Use a customer managed KMS key for cross-account artifact access. The bucket policy and key policy both grant account B access.

Action role

Created in account B. Trust policy names the pipeline service role from account A. It carries the deployment permissions plus S3 and KMS access to the artifacts.

Deployment

The action runs with the permissions of the assumed role, against resources in account B.

From the AWS docs (13)
  • A CodePipeline service role can assume a target-account action role to deploy into that account.
  • The pipeline account must configure a customer managed KMS key and grant the pipeline service role and target account access.
  • The artifact bucket policy must grant the target account access to the pipeline artifacts.
  • The pipeline service role needs permission to assume the target role, and the target role trust policy must allow that service role.
  • The target action role needs deployment permissions and access to the artifact bucket and encryption key.
  • The cross-account action is configured with the ARN of the target role.
  • An action can consume an artifact if the action is in the pipeline account, the artifact was produced in the pipeline account, or an earlier action in the same account produced it.
  • KMS aliases are recognized only in their owning account; cross-account actions must identify the key by key ID or ARN.
  • The customer managed artifact key is created in the same Region as the pipeline.
  • Cross-account pipeline creation in the documented workflow uses the CLI rather than the CodePipeline console.
  • A customer managed KMS key is created and managed by the customer.
  • AWS managed KMS keys can be used only by principals in the account that owns the key.
  • Pipeline artifacts are passed through the pipeline artifact bucket.

Cross-Region actions

A cross-Region actionA configured operation performed at a particular point in a pipeline. lets a pipelineA workflow describing how software changes move through a release process. deploy or run other supported AWS actions outside its home Region. CodePipeline moves the required input files to a regional artifactA file or set of files that an action produces or consumes. store, the S3 location holding action files.

How it works

  1. Keep an artifact bucket in the pipeline Region.
  2. Provide a bucket and encryption key in each action Region. Those resources belong to the pipeline account.
  3. Declare regional stores in artifactStores and configure the action’s Region.
  4. CodePipeline copies that action’s input artifacts to its regional bucket before running it.
  5. The pipeline and change detection resources remain in their original Region.

Exam cues

  • If the question says deploy to multiple Regions from one pipeline, think regional artifact buckets and keys, because each action needs its inputs in its own Region.
  • If the question says a cross-Region Lambda result never completes the job, think the function’s Region, because its result must go to that Region’s CodePipeline endpoint.

Remember

  • Artifact storage: pipeline Region plus each action Region, in the pipeline account.
  • Only the cross-Region action’s input artifacts are copied for that action.
  • Source, third-party, and custom actions cannot be cross-Region.

Trap: A bucket in the pipeline Region alone is insufficient for a deployment action in another Region. Adding that action also does not relocate the pipeline.

CodePipeline copies inputs to the action Region
copy inputs1read inputs2Artifact bucketpipeline RegionArtifact bucketaction RegionDeploy actionaction Region
  1. CodePipeline copies the action input artifacts into the action Region bucket.

  2. The cross-Region action uses its regional artifact store.

From the AWS docs (8)
  • A cross-Region action runs an AWS action provider in a Region different from the pipeline Region.
  • A pipeline needs an artifact bucket in its own Region and in every Region where it runs an action.
  • The artifact bucket and encryption key for a cross-Region action must be in that action Region and the pipeline account.
  • Use the artifactStores mapping to configure Region-specific artifact stores.
  • CodePipeline copies only the input artifacts needed by a cross-Region action from the pipeline Region to the action Region.
  • Source, third-party, and custom actions cannot be cross-Region.
  • Adding a cross-Region action does not move the pipeline or its change detection resources to another Region.
  • For a cross-Region Lambda action, send PutJobSuccessResult or PutJobFailureResult to the Lambda function Region.

Execution recovery and notifications

CodePipeline recovery controls either repeat work, reapply a prior successful release, or stop further progress. ExecutionOne identified run of a set of changes through a pipeline. details show where a release failed; EventBridge events let automation respond to that state.

How it works

  1. Find the failed stageA group of related release actions that can isolate an environment. and actionA configured operation performed at a particular point in a pipeline. in execution history and inspect the provider execution details. For CloudFormation, cloudformation:DescribeStackEvents lets the pipelineA workflow describing how software changes move through a release process. error identify the first failed resource.
  2. Choose FAILED_ACTIONS to repeat failures while running actions continue, or ALL_ACTIONS to restart the failed stage after all actions stop running.
  3. For V2, configure one automatic retry attempt or stage rollback. Rollback creates a new execution from a prior successful execution’s revisionsA particular version of source content processed by a pipeline., variables, and artifactsA file or set of files that an action produces or consumes..
  4. To halt a run, choose Stop and wait to let current actions finish, or Stop and abandon to release the pipeline action while provider work may continue.
  5. Match EventBridge state-change events and route them to SNS or Lambda. Action events include category and provider under detail.type.
  6. A retry can overwrite output artifacts from successful actions in the same execution, while their execution history remains.
Event scope detail-type
Whole execution CodePipeline Pipeline Execution State Change
Stage CodePipeline Stage Execution State Change
Action CodePipeline Action Execution State Change

Exam cues

  • If the question says repeat a failed test without rebuilding earlier stages, think stage retry, because it resumes the existing execution.
  • If the question says alert only on rejected or failed approvals, think action events with FAILED and category Approval, because pipeline-level failure events do not identify that action category.
  • If the question says restore a prior successful stage release, think V2 rollback, because it reuses that execution’s artifacts and variables.

Remember

  • Automatic retry: one attempt, all actions or failed actions.
  • A superseded failed execution cannot be retried; structure changes or another retry can also prevent retry.
  • Rollback excludes source stages, older pipeline structure versions, and rollback executions as targets.
  • Stage or failed-action retry can overwrite successful action outputs in the same execution.

Trap: A failed approval event can mean rejection, timeout, or configuration failure. Inspect the action error before attributing it to a reviewer.

Trap: Stop and abandon does not guarantee provider cancellation. A CloudFormation update can continue after the pipeline abandons its action.

From the AWS docs (20)
  • A failed action prevents its revision from advancing; in stage-locking operation failure releases the stage lock.
  • FAILED_ACTIONS retries failed actions while in-progress actions continue.
  • ALL_ACTIONS restarts a failed stage from its first action and requires that no actions remain in progress.
  • A failed execution cannot be retried after another execution enters and supersedes it at the failed stage.
  • A pipeline structure change after failure or an already running retry can prevent a stage retry.
  • Automatic stage retry makes one retry attempt and can retry all actions or only failed actions.
  • Retrying a failed stage or failed actions can overwrite output artifacts of previously successful actions in the same execution; their execution history is retained.
  • Stage rollback creates a new execution using a previously successful execution source revisions, variables, and artifacts.
  • Stage rollback cannot target a source stage, an execution from an older pipeline structure version, or a rollback execution.
  • Stage rollback and automatic stage retry require V2.
  • Stop and wait lets in-progress actions finish and prevents subsequent actions from starting.
  • Stop and abandon abandons pipeline actions but provider tasks can continue, risking out-of-order results.
  • Execution history and action execution details identify action status and provider execution details.
  • cloudformation:DescribeStackEvents permission lets CodePipeline include the first failed resource in CloudFormation action errors; without it errors are generic.
  • EventBridge receives separate CodePipeline Pipeline Execution State Change, CodePipeline Stage Execution State Change, and CodePipeline Action Execution State Change detail types.
  • CodePipeline action events include the action category and provider in detail.type.
  • An EventBridge pattern selecting action state FAILED and category Approval captures rejected or failed approval actions.
  • EventBridge rules can route CodePipeline state events to targets such as SNS or Lambda.
  • A failed manual approval event can represent reviewer rejection or an incorrect action configuration.
  • An unanswered manual approval fails at its configured timeout, or after the account default of seven days if no action timeout is set.

Flashcards

tap to flip
Answer

·

All 55 cards as a list

A CodePipeline pipeline uses CodeCommit and starts twice for each push after an EventBridge rule is added. What should the team change?

Set PollForSourceChanges to false. EventBridge detects changes, so polling must be disabled.

How does CodePipeline order actions within a stage?

Use runOrder: equal values run in parallel; higher values wait for lower values to succeed.

A team wants a CodePipeline pipeline to start from GitHub repository events without polling. Which source integration fits?

Use AWS CodeConnections with the CodeStarSourceConnection source action. Provider webhooks detect changes.

A V2 CodePipeline pipeline should start only for changes under an application path on a release branch. What filters fit?

Use a connections source with branch and file path filters. Both must match; excludes override includes.

A PARALLEL CodePipeline execution with a CodeCommit source builds a later commit than the one that triggered it. Why?

The CodeCommit source clones HEAD when the source action starts. Connections sources capture the pushed commit.

Which CodePipeline capabilities require V2 rather than V1?

Pipeline-level variables, QUEUED and PARALLEL modes, source revision overrides, Git trigger filters, stage rollback, conditions, automatic retry, and Commands. Both types support action variables.

How do the CodePipeline execution modes SUPERSEDED, QUEUED, and PARALLEL handle overlapping executions?

SUPERSEDED lets newer runs overtake waiting runs between stages. QUEUED preserves arrival order at stages. PARALLEL runs executions independently without queues.

A CodePipeline stage is busy and two newer executions wait in SUPERSEDED mode. Can the latest replace the earlier waiting execution?

Yes. Superseding happens between stages, so the earlier waiting execution can be skipped.

Concurrent PARALLEL CodePipeline executions overwrite the same staging environment. Which modes provide stage serialization?

Use SUPERSEDED or V2 QUEUED. QUEUED also preserves waiting executions; PARALLEL provides no queue.

A CodePipeline pipeline must integration test every revision in order against a shared database. Which mode fits?

V2 QUEUED. Waiting executions retain their order at the test stage rather than being superseded.

Which CodePipeline execution modes require V2, and which mode prevents stage rollback?

QUEUED and PARALLEL require V2. PARALLEL does not support stage rollback. SUPERSEDED is the default.

A team expects a V2 CodePipeline pipeline in PARALLEL mode to roll back a failed stage. What must it reconsider?

Choose an execution mode that supports rollback. V2 alone is insufficient because PARALLEL disables stage rollback.

How do CodePipeline actions share files and generated configuration values?

Files use named output and input artifacts stored in S3. Values use output variables from a producer namespace, referenced as #{namespace.variable_key} by a later action.

How does CodePipeline pass files from a source action to a later action?

Actions pass named input and output artifacts, which CodePipeline stores in an S3 artifact bucket.

What does a CodePipeline action consume when it needs files produced by another action?

A named input artifact. An artifact is a file or set of files passed between actions.

A CodePipeline action references a build output variable but runs at the same runOrder as the build in the same stage. How should the team fix it?

Increase the consumer runOrder or move it to a later stage. The producing action must finish before its variables can be consumed.

A team needs an authorized person to review a CodePipeline release before deployment. What should it add?

Add a manual approval action. Grant codepipeline:PutApprovalResult on that action and console read permissions if needed. Rejection or an unanswered timeout fails the action.

A CodePipeline release needs human approval after staging tests and an email to reviewers. What configuration fits?

Add a manual approval action before production and publish to an SNS topic in the pipeline Region. Subscribe the reviewers to the topic.

How long can a CodePipeline manual approval remain unanswered before it fails?

Seven days by default, unless the action has a configured timeout. Rejection also fails the action; approval resumes the execution.

A CodePipeline approval must notify reviewers through SNS and wait longer than seven days. What should the team configure?

Set the approval action's timeoutInMinutes to the required duration, up to 86400 minutes, and use an SNS topic in the pipeline Region.

A CodePipeline release needs a person to inspect infrastructure changes before CloudFormation applies them. What sequence fits?

Run CHANGE_SET_REPLACE, manual approval, then CHANGE_SET_EXECUTE. The change set previews changes before execution.

Which CodePipeline CloudFormation mode does AWS recommend for testing only, and why?

REPLACE_ON_FAILURE, because it can delete and recreate a failed stack.

A CodePipeline pipeline creates temporary CloudFormation stacks for integration tests. Which mode removes the stack after testing?

DELETE_ONLY. It also succeeds if the named stack is already absent.

A CodePipeline CloudFormation action must override a template configuration parameter with a value generated during the run. Which field wins?

ParameterOverrides. Its JSON parameter values take precedence over TemplateConfiguration.

Does the CodePipeline CloudFormation configuration RoleArn replace the role already associated with a change set when CHANGE_SET_EXECUTE runs?

No. The configuration RoleArn is not applied when executing a change set. Ensure the change set or stack already has its intended role.

A CodePipeline release deploys to a shared test environment and must test that exact revision before another run replaces it. How should actions be arranged?

Use a stage-locking mode and put deployment before testing in the same stage with increasing runOrder. Use a separate stage for each environment.

Which CodePipeline action can run custom AWS service checks, and how must a Lambda check report completion?

A Lambda Invoke action can run the checks. It must call PutJobSuccessResult or PutJobFailureResult with the job ID. For cross-Region Lambda, send the result in the function Region.

A CodePipeline test needs a multi-step workflow that calls AWS services and blocks release until the workflow succeeds. Which action fits?

Use a StepFunctions Invoke action with a Standard state machine. CodePipeline waits for the workflow result.

A Lambda function invoked by CodePipeline returns successfully, but the pipeline action waits until timeout. What is missing?

A job-result API call. Report the job ID through PutJobSuccessResult or PutJobFailureResult; a normal Lambda return is insufficient.

Which CodePipeline action providers run builds, device tests, and workflow invocations?

CodeBuild supports Build or Test. DeviceFarm is Test. StepFunctions is Invoke; Lambda actions also report job results to CodePipeline.

A team must run an internal test tool on an existing host as a CodePipeline action. How does it integrate?

Create a custom action and a worker with CodePipeline endpoint access. The worker polls, acknowledges the job, runs the tool, and reports success or failure.

A CodePipeline StepFunctions action starts an Express workflow successfully, but the workflow later fails. Does the pipeline action reflect the failure?

No. Express success means the workflow started. Use Standard when the release must wait for the workflow outcome.

Which APIs form the basic CodePipeline custom worker lifecycle?

PollForJobs, AcknowledgeJob, then PutJobSuccessResult without a continuation token or PutJobFailureResult.

Which file does the CodePipeline ECS standard deploy action read, and is it the ECS blue/green image file?

Standard uses imagedefinitions.json by default, with name and imageUri pairs. Blue/green dynamic image input uses imageDetail.json alongside a task definition template and AppSpec.

A team wants an ECR image push to trigger a CodePipeline ECS blue/green release while deployment files remain in Git. How should sources be arranged?

Use an ECR source for imageDetail.json and a repository source for the task definition template and AppSpec. Pass their artifacts to CodeDeployToECS.

A CodeBuild image push succeeds, but the CodePipeline ECS standard deploy action cannot find its image mapping. What should the build publish?

Include imagedefinitions.json in its output artifact, using container name and imageUri pairs. Pushing the image alone does not provide this required input.

What encoding and size limit apply to the CodePipeline ECS standard image definitions file?

UTF-8, with a maximum size of 100 KB.

A CodePipeline release must stop when an ECR image exceeds an allowed critical vulnerability count. Which action fits?

Use the Invoke-category InspectorScan action with InspectorRunMode: ECRImageScan, repository and tag, and CriticalThreshold. Counts beyond the threshold fail the action.

A CodePipeline pipeline must scan source dependencies before deployment rather than an ECR image. How should InspectorScan be configured?

Use InspectorRunMode: SourceCodeScan with the source artifact and required severity thresholds. The action produces vulnerability information in an SBOM file.

What does the InspectorScan action in CodePipeline scan, and where are its findings recorded?

It scans source dependencies or container images for vulnerabilities and writes vulnerability information to an output software bill of materials.

What identity and artifact access does a cross-account CodePipeline deployment need?

A target action role that trusts the pipeline role; permission for the pipeline role to assume it; deployment access; an artifact bucket policy; and access to a customer managed KMS artifact key. Configure the target role ARN on the action.

A cross-account CodePipeline deployment can assume its role but cannot read or decrypt artifacts. What should the team inspect?

Check the artifact bucket policy, customer managed KMS key permissions, and target role S3/KMS permissions. Use the key ARN rather than a cross-account alias.

A CodePipeline pipeline belongs to account A. Can an artifact produced by its action in account B pass directly to an action in account C?

No. Neither producer nor consumer is in the pipeline account, and they are not in the same account.

A CodePipeline pipeline in a tools account must deploy into a separate production account. How should the target action authenticate?

Set its role ARN to a role in the target account that trusts the pipeline service role. Grant AssumeRole to the pipeline role and deployment, S3, and KMS permissions to the target role, with bucket and key policies allowing access.

A CodePipeline pipeline must deploy through actions in another Region. What artifact storage is required?

Provide an artifact bucket and encryption key in each action Region, in the pipeline account, and configure artifactStores. CodePipeline copies the cross-Region action input artifacts there.

A CodePipeline deploys workloads in multiple Regions. Where must it have artifact buckets?

In the pipeline Region and in every Region where it runs an action.

Which CodePipeline action types cannot be cross-Region?

Source, third-party, and custom actions.

A CodePipeline stage fails after some actions succeeded. How can the team retry without restarting the pipeline?

Choose FAILED_ACTIONS to repeat failures, or ALL_ACTIONS to restart the stage when no actions remain in progress. A superseded failed execution cannot be retried.

A CodePipeline deployment fails. Where can an operator find the failed action and its provider execution details?

Inspect execution history and action execution details for the action status and provider details.

A CodePipeline CloudFormation action shows a generic deployment failure. Where should the team investigate, and what permission improves the pipeline error?

Inspect execution history and action details, then CloudFormation stack events. Grant cloudformation:DescribeStackEvents to expose the first failed resource in the pipeline error.

A team wants CodePipeline failure alerts delivered to SNS or Lambda. What should it configure?

Use EventBridge rules for pipeline, stage, or action state changes and route matching events to the target. These scopes have different detail types.

A team wants alerts for failed or rejected CodePipeline approval actions but not build failures. Which EventBridge fields should it match?

Use action execution state change events, detail.state: FAILED, and detail.type.category: Approval. Inspect the action error because failure need not mean reviewer rejection.

How many automatic stage retry attempts does CodePipeline make, and what scope can it retry?

One attempt. It can retry all actions in the failed stage or only failed actions; automatic stage retry requires V2.

A CodePipeline CloudFormation action reports a generic failure. What permission lets it include the first failed resource?

Grant cloudformation:DescribeStackEvents so the action can include the first failed resource in its error.

A CodePipeline stage retry runs after a CodeBuild action previously produced an artifact. Are successful action artifacts guaranteed to remain unchanged during the retry?

No. Retrying the stage or its failed actions can overwrite outputs from successful actions in the same execution, although their execution history remains.

You finished every topic of DOP-C02!

Your badge turned gold. Next step: book the exam on AWS. Once you pass, add yourself to Who passed.

Share

Share that you finished this certification

I finished every topic of AWS Certified DevOps Engineer - Professional (DOP-C02) on Easy Review. Come study too!