Lesson 3 of 9 Data Engineering Practices

Delivering Data Pipelines with CI/CD

This lesson explains how continuous integration and continuous delivery (CI/CD) apply automated builds, checks and deployments to data pipelines, so changes reach production quickly, consistently and safely.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe what continuous integration checks for data pipelines.
  • Promote changes through environments with AWS CodePipeline.
  • Supply configuration per environment.

Continuous integration

Continuous integration (CI) checks every change automatically before it is merged, so problems are found within minutes rather than in production. For data pipelines, CI is typically run with AWS CodeBuild or GitHub Actions and performs several kinds of check.

Linting and formatting checks keep Python and SQL consistent and catch simple errors. Unit tests run transformation functions against small, known inputs and check the outputs. Infrastructure code is validated with tools such as cfn-lint, which finds template errors, and AWS CloudFormation Guard, which checks templates against policies such as "every bucket must be encrypted". Finally, CI packages the deployable artefacts, such as Glue scripts, Lambda packages and container images, so that later stages deploy exactly what was tested.

Match the pairs

CI checks

Exam skills 1.4.9

Match each CI check with what it catches.

Log in to try this activity Interactive activities are free with an account.

Continuous delivery

Continuous delivery moves tested changes into production through automated stages. AWS CodePipeline deploys infrastructure and job code stage by stage, typically to separate AWS accounts for development, test and production, so that a mistake in one environment cannot affect another. The same artefact built during CI is promoted through every stage rather than rebuilt for each, so production runs exactly what was tested.

For Lambda functions in a pipeline, AWS CodeDeploy shifts traffic to a new version gradually, as a canary or in linear steps, and rolls back automatically if CloudWatch alarms fire; AWS SAM configures this with a deployment preference in the template. A manual approval step before production gives a person the final decision for significant changes, and failed deployments roll back automatically.

True or false

Continuous delivery

Exam skills 1.4.9

Decide whether each statement about continuous delivery is true.

Log in to try this activity Interactive activities are free with an account.

Configuration per environment

The same pipeline code is deployed to development, test and production, so values that differ, such as bucket names, endpoints and role ARNs, must be supplied from outside the code. IaC parameters provide values chosen at deployment time for each environment. Glue job arguments pass values to a job when it runs, such as the source path. Parameter Store, part of Systems Manager, holds shared configuration that code reads at run time. Secrets Manager holds credentials, such as database passwords, encrypted and with automatic rotation, so they never appear in code or logs. The following table summarises the mechanisms.

MechanismUse for
IaC parametersValues that differ by environment at deployment time
Glue job argumentsValues passed to jobs at run time
Parameter StoreShared configuration read at run time
Secrets ManagerCredentials and other secrets

The following diagram shows the stages of a deployment pipeline for a Glue job.

The deployment pipeline for the Glue job. A merge to main triggers CodePipeline; CodeBuild lints, tests and packages the script and template once; CloudFormation deploys that same artefact to the development and test accounts, where the job runs on sample data with quality checks; and after manual approval it goes to production with production parameters. A failed stage stops the pipeline.
Development, test and production are separate AWS accounts.
Match the pairs

Configuration mechanisms

Exam skills 1.4.9 · 4.2.2

Match each value with where it should be supplied.

Log in to try this activity Interactive activities are free with an account.
Worked example

Promoting a Glue job through three accounts

A team wants every change to a Glue job to be tested and deployed consistently to development, test and production accounts. The pipeline consists of the stages described in the following table.

StageAction
SourceA merge to the main branch triggers CodePipeline
BuildCodeBuild lints the code, runs unit tests and packages the script and template
DevelopmentCloudFormation deploys to the development account
TestDeploy to the test account and run the job on sample data with quality checks
ApprovalA manual approval for production
ProductionDeploy the same artefact with production parameters

Bucket names, connection names and role ARNs are template parameters per account, so the code is identical in every environment. A failed stage stops the pipeline before production.

Check yourself

Which service runs tests and checks on every commit in an AWS pipeline?

Show answer

AWS CodeBuild.

Exam Tips

Remember for the exam

  • To automate Glue job and infrastructure deployments, use CodePipeline with CloudFormation or the CDK.
  • To run checks on every commit, use CodeBuild.
  • Use separate AWS accounts for development, test and production.
  • Promote the same artefact through every stage.
  • Never hard-code environment values; use parameters or Parameter Store.