Keeping Pipelines in Version Control
This lesson explains how keeping pipeline code, SQL, infrastructure templates and configuration in version control makes every change reviewable, every release reproducible and every mistake reversible.
Learning outcomes
After completing this lesson, you will be able to:
- Identify what belongs in version control.
- Apply Git practices such as branches and pull requests.
- Connect Git repositories to AWS services.
What belongs in version control
The test for version control is simple: everything needed to rebuild a pipeline from nothing should be in the repository. That includes the transformation code, whether PySpark, Python, Scala or SQL; the infrastructure templates written with AWS CloudFormation, the AWS CDK or AWS SAM; the orchestration definitions, such as Step Functions state machine definitions and Apache Airflow DAGs; the configuration for each environment; and the data quality rulesets that validate the pipeline's output.
Secrets are the exception. Passwords, API keys and connection strings with credentials never belong in a repository, where anyone with read access, and every clone, would hold them. They are stored in AWS Secrets Manager and referenced by name from code and templates.
In the repository?
Working with Git
Pipeline code, SQL and infrastructure templates belong in Git, hosted on a service such as GitHub, GitLab or Bitbucket, and teams follow a few practices. Each change is developed on a feature branch, so unfinished work never affects the main branch. A pull request asks to merge the branch, and a second person reviews the logic, tests and security before it is accepted. Tags mark each released version, so whatever is running in production can be identified and rebuilt exactly. Commit messages linked to tickets record why each change was made. The following table summarises the practices.
| Practice | Purpose |
|---|---|
| Feature branches | Isolate work in progress from the main branch |
| Pull requests and code review | A second person checks logic, tests and security |
| Tags for releases | Any deployed version can be identified and rebuilt |
| Commit messages linked to tickets | Explain why a change was made |
The following diagram shows what a team draws on to reproduce a report from several months ago exactly.

Git practices
Connecting Git to AWS
AWS services integrate with Git repositories in several ways. Glue jobs can be pushed to and pulled from Git repositories; AWS CodeConnections links GitHub, GitLab and Bitbucket to CodePipeline; and SageMaker Unified Studio projects use Git for notebooks and code. Infrastructure changes then flow from a merged pull request to deployment through CI/CD.
Reproducing last month's numbers
Auditors ask how a regulatory report was produced on 31 March. The pipeline has changed several times since. Because the team versions everything, the answer comes from Git, as the following table shows.
| Artefact | Version used on 31 March |
|---|---|
| Glue job script | Release tag v2.7.0 |
| Step Functions definition | The same tag, deployed by CloudFormation |
| Data quality ruleset | Stored in the repository at that tag |
| Input data | Raw zone partitions for 31 March, unchanged |
Checking out the tag and rerunning the job in a test account against the preserved raw data reproduces the report exactly. The pull request history also shows who approved each change and why.
Why tag releases in Git?
Show answer
So any deployed version of the pipeline can be identified and rebuilt exactly.
Exam Tips
Remember for the exam
- Keep pipeline code, SQL, infrastructure and configuration in Git.
- Review changes through pull requests before they reach the main branch.
- Tag releases so any deployed version can be rebuilt.
- Never commit secrets; reference them from Secrets Manager.
- Glue jobs can be synchronised with Git repositories.