Ace Cloud Interviews
Home/AWS Tutorial/CodePipeline
🛠️

AWS Developer Tools & CI/CD

CodePipeline

Fully managed continuous delivery pipeline for fast and reliable application updates

AWS CodePipeline is a fully managed continuous delivery service that orchestrates the steps required to release software - from source to build to test to deploy. It models your release process as a series of stages and actions, providing visibility into pipeline state and enabling fast, reliable, and consistent software delivery.

Pipeline Structure: Stages, Actions, and Transitions

A CodePipeline pipeline is made up of stages, each containing one or more actions. Actions can run sequentially or in parallel within a stage.

ConceptDescriptionExample
PipelineTop-level workflow definitionmy-app-pipeline
StageLogical grouping of actionsSource, Build, Test, Deploy
ActionUnit of work within a stageCodeBuild build, CodeDeploy deploy
TransitionLink between stages - can be disabledPause before production deploy
ArtifactData passed between actions via S3Source zip, compiled binaries
Input artifactArtifact consumed by an actionSource code zip for build action
Output artifactArtifact produced by an actionBuild output passed to deploy

Every pipeline needs at least two stages. The first stage must be a Source stage. Action categories include: Source, Build, Test, Deploy, Approval, and Invoke.

💡

Actions within a stage can run in parallel by giving them the same "run order" value. Actions with different run orders execute sequentially within the stage. This is useful for running multiple tests in parallel before a deploy.

Source Action Providers

The Source stage defines what triggers the pipeline and where code comes from. CodePipeline V2 (the current version) supports these providers:

ProviderTrigger MechanismAuth MethodNotes
CodeCommitEventBridge rule on repository eventsIAM service roleNative integration, no setup needed
S3EventBridge on bucket PUTIAM service roleGood for pre-packaged artifacts
GitHub (via CodeStar Connections)Webhook via CodeStar ConnectionOAuth app or GitHub AppRequires connection approval in console
GitHub EnterpriseWebhook via CodeStar ConnectionGitHub App on GHE serverSelf-hosted GitHub support
GitLab (via CodeStar Connections)Webhook via CodeStar ConnectionGitLab OAuthSame connection mechanism as GitHub
Bitbucket (via CodeStar Connections)Webhook via CodeStar ConnectionBitbucket OAuthAtlassian Cloud only
ECREventBridge on image pushIAM service roleTrigger pipeline when Docker image is pushed
⚠️

CodeStar Connections require a one-time manual approval step in the AWS console before they become AVAILABLE. A connection in PENDING state will silently block your pipeline. Always verify connection status after creating via Terraform or CloudFormation.

Integrations: Build, Test, and Deploy Actions

CodePipeline integrates with a wide range of AWS services and third-party tools as action providers:

CategoryProviderWhat It Does
BuildCodeBuildRun buildspec.yml in managed build container
BuildJenkinsTrigger Jenkins job, wait for result
TestCodeBuildRun test suite, output test reports
TestAWS Device FarmRun mobile/web UI tests on real devices
DeployCodeDeployEC2, Lambda, ECS, on-premises deployments
DeployCloudFormationCreate/update/delete stacks
DeployElastic BeanstalkDeploy to EB environment
DeployECSUpdate ECS service (standard deploy)
DeployS3Sync static files to S3 bucket
InvokeLambdaInvoke Lambda function with custom logic
InvokeStep FunctionsStart a Step Functions state machine
ApprovalManual ApprovalPause pipeline, send SNS notification, wait for human
💡

The Lambda invoke action is extremely powerful - it lets you add any custom step (Slack notifications, custom validation, ticket creation) to your pipeline without needing a separate service. The Lambda function receives pipeline execution context and must call PutJobSuccessResult or PutJobFailureResult.

Pipeline V1 vs V2: Key Differences

CodePipeline has two execution mode versions. New pipelines default to V2.

FeatureV1V2
Execution modeSUPERSEDED onlyQUEUED, PARALLEL, or SUPERSEDED
Pipeline-level variablesNot supportedSupported
Stage-level variablesNot supportedSupported
Trigger filteringBranch only (CodeCommit)Branch, tag, file path filters
Pricing$1/pipeline/month (first 1 free)$0.002 per action execution minute
RolloutLegacyCurrent default

Execution modes in V2:

ModeBehaviorUse Case
SUPERSEDEDNew run supersedes in-progress runRapid commits - only latest matters
QUEUEDRuns queue, execute one at a time in orderSequential releases, audit trail
PARALLELMultiple runs execute simultaneouslyIndependent feature branch builds

Common Pipeline Patterns

Real-world pipelines often follow these proven patterns:

PatternStructureUse Case
Simple CI/CDSource -> Build -> DeploySmall apps, single environment
Multi-environmentSource -> Build -> Deploy Dev -> Manual Approval -> Deploy ProdControlled production releases
Parallel testsSource -> Build -> [Unit Tests | Integration Tests] -> DeployFaster feedback, parallel test suites
Fan-out multi-regionSource -> Build -> Deploy us-east-1 -> Deploy eu-west-1Multi-region deployments
IaC pipelineSource -> Terraform Plan -> Manual Approval -> Terraform ApplyInfrastructure changes with review
bash
# CLI - trigger a pipeline manually
aws codepipeline start-pipeline-execution --name my-app-pipeline

# Get pipeline state
aws codepipeline get-pipeline-state --name my-app-pipeline

# Approve a manual approval action
aws codepipeline put-approval-result \
  --pipeline-name my-app-pipeline \
  --stage-name Approval \
  --action-name ManualApproval \
  --result summary="Approved after testing",status=Approved \
  --token <token-from-get-pipeline-state>
🎯

Interview Focus Points

  • 1What is the structure of a CodePipeline pipeline - stages, actions, artifacts?
  • 2How does CodePipeline trigger on a GitHub repository - what mechanism is used?
  • 3What is the difference between V1 and V2 pipeline execution modes?
  • 4How do you pause a pipeline before production - what action type handles this?
  • 5How do you pass data between pipeline actions?
  • 6How would you design a multi-environment deployment pipeline with a manual approval gate?
  • 7What is a CodeStar Connection and what can go wrong with it?
  • 8How do Lambda invoke actions work in a pipeline and what must the Lambda return?
  • 9How would you implement parallel testing stages in CodePipeline?
  • 10What triggers a CodePipeline execution and how can you filter triggers in V2?