Course contentsShow
← Cloud and Infrastructure
Lesson 1848 of 2,98938. AWS Native CI/CDFree lesson

Pipeline Variables and Parameter Passing

Using pipeline variables to pass configuration between stages and parameterize deployments.

Pipeline Variables and Parameter Passing

You'll learn how to use pipeline variables to pass configuration between stages and parameterize AWS CodePipeline deployments.


What Are Pipeline Variables?

In AWS CodePipeline, pipeline variables act as containers for dynamic data that flows through your pipeline stages. Think of them like labeled envelopes that carry information from one stage to the next—the Source stage might put a commit ID in an envelope, and the Deploy stage opens it to know exactly which version to release.

Variables enable you to:

  • Pass metadata (commit IDs, build numbers, environment names) between stages
  • Parameterize deployments without hardcoding values
  • Make pipelines reusable across multiple environments or configurations

How Variables Work

Each pipeline action can produce variables (output), and downstream actions can consume them (input). AWS CodePipeline automatically manages namespace resolution—variables are referenced using the format:

#{SourceAction.VariableName}

For example, a CodeCommit source action produces CommitId and BranchName, while a CodeBuild action might output BuildTag or ImageURI. You reference these in later stages to ensure consistency—deploying the exact artifact that was built, using the commit that triggered everything.

Real-World Use Case

Imagine your build stage creates a Docker image tagged with the commit SHA. Instead of guessing or manually configuring which image to deploy, you pass the ImageURI variable from CodeBuild directly to your CodeDeploy action. If the build fails or produces a different image, the deploy stage automatically uses the correct reference.

Key Takeaway:
Pipeline variables enable dynamic, traceable configuration flow between AWS CodePipeline stages, ensuring each stage operates on consistent, parameterized data without manual intervention.