Parallel and Sequential Stage Execution
What you'll learn: How to design AWS CodePipeline workflows that run actions concurrently or in order to optimize speed and manage dependencies.
By default, CodePipeline stages execute sequentially—one completes before the next begins. But within a single stage, you can configure multiple actions to run in parallel, dramatically reducing total pipeline execution time.
Sequential Stages
Stages themselves always run one after another. Your source stage must complete before the build stage starts, and the build must finish before deployment. This creates a linear flow that respects dependencies—you can't deploy what hasn't been built yet.
Think of sequential stages like an assembly line: each station (stage) must complete its work before passing the product to the next station.
Parallel Actions Within a Stage
Within a single stage, you can define multiple actions that execute simultaneously. For example, in a build stage, you might run unit tests and security scans at the same time, both pulling from the same source. In a deployment stage, you could deploy to multiple regions concurrently.
This is like having multiple workers at the same assembly station, each handling a different task on the same item—all working together without blocking each other.
Design Patterns
Fan-out pattern: One source feeds multiple parallel build or test actions.
Multi-environment deployment: Deploy to dev, staging, and production regions simultaneously after approval.
Conditional paths: Use parallel actions with different deployment targets based on branch or configuration.
The trade-off: parallel actions increase complexity and can make troubleshooting harder, but they significantly reduce pipeline duration when actions are independent.
Key Takeaway: CodePipeline stages are always sequential, but actions within a stage can run in parallel—use this to speed up independent tasks like multi-region deployments or simultaneous testing while maintaining proper dependency order across stages.