Skip to main content
AWS CI/CD Pipeline Architecture

Module Overview

Estimated Time: 4-5 hours | Difficulty: Advanced | Prerequisites: Compute, Security, Networking
DevOps on AWS combines powerful CI/CD services with Infrastructure as Code. The goal is to make deployments boring โ€” a well-built pipeline turns โ€œdeploying to productionโ€ from a stressful Friday afternoon event into an automated, reversible, observable process that happens dozens of times per day. This module covers the complete deployment automation stack. A practical note: many teams use GitHub Actions or GitLab CI for build/test and only use AWS services (CodeDeploy, CloudFormation) for the deployment phase. That is perfectly fine โ€” the concepts here apply regardless of which CI tool you use upstream. What Youโ€™ll Learn:
  • CodePipeline, CodeBuild, CodeDeploy for CI/CD
  • CloudFormation for infrastructure provisioning
  • AWS CDK for programmatic infrastructure
  • Deployment strategies (blue-green, canary)
  • GitOps and infrastructure automation
  • DevOps best practices and patterns

AWS DevOps Services Overview


CodePipeline

Pipeline Architecture

CodePipeline Terraform


CodeBuild

Build Specification

CodeBuild Project Terraform


CodeDeploy

Deployment Strategies

CodeDeploy for ECS


CloudFormation

Stack Template


AWS CDK

CDK Application Structure

CDK Pipeline


๐ŸŽฏ Interview Questions

Blue-Green:
  • Two identical environments
  • Deploy to inactive (green)
  • Switch all traffic at once
  • Instant rollback (switch back)
  • 2x resources during deployment
Canary:
  • Single environment, gradual rollout
  • Send small % traffic to new version
  • Monitor for errors, then increase
  • Progressive validation
  • Smaller blast radius
Choose blue-green when:
  • Need instant rollback
  • Database schema changes
  • Complete environment validation
Choose canary when:
  • Risk-averse, large user base
  • Need gradual validation
  • Cost-conscious
CloudFormation:
  • Direct YAML/JSON templates
  • Simpler for basic infrastructure
  • No additional tooling needed
  • Better for pure declarative IaC
  • StackSets for multi-account
CDK:
  • Higher-level abstractions
  • Full programming language power
  • Better for complex, reusable constructs
  • Unit testing infrastructure
  • Compile-time type checking
  • Generates CloudFormation
CDK L1, L2, L3 constructs:
  • L1: Direct CloudFormation (CfnXxx)
  • L2: Curated with sensible defaults
  • L3: Patterns (complete solutions)
GitOps principles:
  • Git as single source of truth
  • Declarative infrastructure
  • Automated sync (pull-based)
AWS implementation:
For Kubernetes (EKS):
  • ArgoCD or Flux for GitOps
  • CodePipeline triggers image build
  • ArgoCD detects manifest changes
  • Pulls and applies to cluster
Best practices:
  • Separate app and infra repos
  • Use semantic versioning
  • Implement drift detection
Never store in code!Options:
  1. Secrets Manager: Runtime retrieval, rotation
  2. Parameter Store: Cost-effective, hierarchical
  3. CodeBuild env vars: Build-time secrets
Best practices:
Rotation:
  • Secrets Manager automatic rotation
  • Lambda rotation function
  • Applications must handle credential refresh
Account structure:
Pipeline flow:
  1. Pipeline in Shared Services account
  2. Cross-account IAM roles for deployment
  3. Artifact bucket with cross-account access
  4. CloudFormation StackSets for multi-account
Key patterns:
  • Single pipeline, multiple deployment targets
  • Promotion through environments
  • Separate production approval
  • Centralized artifact storage

๐Ÿงช Hands-On Lab: Complete CI/CD Pipeline

1

Set Up CodeCommit/GitHub

Create repository with application code
2

Create CodeBuild Project

Build Docker image, run tests, push to ECR
3

Configure CodeDeploy

ECS blue-green deployment with canary
4

Build CodePipeline

Connect source โ†’ build โ†’ deploy stages
5

Add Manual Approval

Require approval before production
6

Configure Rollback

CloudWatch alarms trigger automatic rollback

Next Module

Well-Architected Framework

Review your architecture against AWS best practices