4.9 AWS CI/CD Suite: CodeBuild, CodeDeploy, CodePipeline & GitHub OIDC (Week 4 • AWS DevOps (D1: Secure 30%))
1. Core Concept & Internal Working
AWS CI/CD Suite: CodeBuild, CodeDeploy, CodePipeline & GitHub OIDC (AWS DevOps (D1: Secure 30%)) covers Source (`GitHub` via CodeConnections or **GitHub Actions OIDC Federation -> IAM Role** with zero stored AWS keys!), **AWS CodeBuild** (managed serverless build/test runner controlled by `buildspec.yml`; place in VPC to run private DB integration tests!), **AWS CodeDeploy** (deploys via `appspec.yml` to **EC2/On-Premises, AWS Lambda Aliases, and Amazon ECS** — note CodeDeploy EC2 requires the CodeDeploy Agent + S3 IAM role!), and **AWS CodePipeline** (orchestrates Source -> Build -> Manual Approval -> Deploy stages across accounts/regions). In production software engineering, it is used to Replacing static IAM user keys in GitHub Actions with an **AWS IAM OpenID Connect (`OIDC`) Identity Provider** (`token.actions.githubusercontent.com`) scoped strictly to `repo:org/ecom:ref:refs/heads/main`! Mastering its underlying execution rules and edge-case boundaries lets you write reliable, maintainable code.
2. Real-World Engineering Use Case
Replacing static IAM user keys in GitHub Actions with an **AWS IAM OpenID Connect (`OIDC`) Identity Provider** (`token.actions.githubusercontent.com`) scoped strictly to `repo:org/ecom:ref:refs/heads/main`!
3. Granular Subtopics Covered
- Source (`GitHub` via CodeConnections or **GitHub Actions OIDC Federation -> IAM Role** with zero stored AWS keys!): Core foundation of AWS CI/CD Suite: CodeBuild, CodeDeploy, CodePipeline & GitHub OIDC: Replacing static IAM user keys in GitHub Actions with an **AWS IAM OpenID Connect (`OIDC`) Identity Provider** (`token.actions.githubusercontent.com`) scoped strictly to `repo:org/ecom:ref:refs/heads/main`!
- **AWS CodeBuild** (managed serverless build/test runner controlled by `buildspec.yml`: Master '**AWS CodeBuild** (managed serverless build/test runner controlled by `buildspec.yml`' inside AWS CI/CD Suite: CodeBuild, CodeDeploy, CodePipeline & GitHub OIDC across real-world inputs.
- Place in VPC to run private DB integration tests!): Master 'Place in VPC to run private DB integration tests!)' inside AWS CI/CD Suite: CodeBuild, CodeDeploy, CodePipeline & GitHub OIDC across real-world inputs.
- **AWS CodeDeploy** (deploys via `appspec.yml` to **EC2/On-Premises: Master '**AWS CodeDeploy** (deploys via `appspec.yml` to **EC2/On-Premises' inside AWS CI/CD Suite: CodeBuild, CodeDeploy, CodePipeline & GitHub OIDC across real-world inputs.
- Production Pitfall Guard (AWS CI/CD Suite: CodeBuild, CodeDeploy, CodePipeline & GitHub OIDC): Prevent common defect: Storing long-lived `AWS_ACCESS_KEY_ID` & `AWS_SECRET_ACCESS_KEY` in CI/CD environment variables when **OIDC short-lived STS role assumption** is available!
- Hands-On Verification (AWS CI/CD Suite: CodeBuild, CodeDeploy, CodePipeline & GitHub OIDC): Configure an IAM OIDC Provider for GitHub Actions + `buildspec.yml` / `appspec.yml` definitions and run an automated lint/synth check.
4. Reference Implementation
# Secretless GitHub Actions -> AWS OIDC Trust Condition:
# "StringEquals": { "token.actions.githubusercontent.com:aud": "sts.amazonaws.com" }
# "StringLike": { "token.actions.githubusercontent.com:sub": "repo:myorg/myrepo:ref:refs/heads/main" }
5. Common Mistakes to Avoid
- Storing long-lived `AWS_ACCESS_KEY_ID` & `AWS_SECRET_ACCESS_KEY` in CI/CD environment variables when **OIDC short-lived STS role assumption** is available!
- Skipping boundary, null/empty, or error-state verification when implementing AWS CI/CD Suite: CodeBuild, CodeDeploy, CodePipeline & GitHub OIDC.
- Pushing untested AWS CI/CD Suite: CodeBuild, CodeDeploy, CodePipeline & GitHub OIDC changes without clean naming and Git commit context.
6. Hands-On Exercise
Configure an IAM OIDC Provider for GitHub Actions + `buildspec.yml` / `appspec.yml` definitions and run an automated lint/synth check.
7. Technical Interview Checkpoints
- Q: What problem does AWS CI/CD Suite: CodeBuild, CodeDeploy, CodePipeline & GitHub OIDC solve in AWS DevOps (D1: Secure 30%), and what fails if it is misused?
Key Focus: Replacing static IAM user keys in GitHub Actions with an **AWS IAM OpenID Connect (`OIDC`) Identity Provider** (`token.actions.githubusercontent.com`) scoped strictly to `repo:org/ecom:ref:refs/heads/main`! Guard against: Storing long-lived `AWS_ACCESS_KEY_ID` & `AWS_SECRET_ACCESS_KEY` in CI/CD environment variables when **OIDC short-lived STS role assumption** is available! - Q: Explain the internal working of AWS CI/CD Suite: CodeBuild, CodeDeploy, CodePipeline & GitHub OIDC (Source (`GitHub` via CodeConnections or **GitHub Actions OIDC Federation -> IAM Role** with zero stored AWS keys!), **AWS CodeBuild** (managed serverless build/test runner controlled by `buildspec.yml`; place in VPC to run private DB integration tests!), **AWS CodeDeploy** (deploys via `appspec.yml` to **EC2/On-Premises, AWS Lambda Aliases, and Amazon ECS** — note CodeDeploy EC2 requires the CodeDeploy Agent + S3 IAM role!), and **AWS CodePipeline** (orchestrates Source -> Build -> Manual Approval -> Deploy stages across accounts/regions)).
Key Focus: Walk step-by-step through Source (`GitHub` via CodeConnections or **GitHub Actions OIDC Federation -> IAM Role** with zero stored AWS keys!), **AWS CodeBuild** (managed serverless build/test runner controlled by `buildspec.yml`; place in VPC to run private DB integration tests!), **AWS CodeDeploy** (deploys via `appspec.yml` to **EC2/On-Premises, AWS Lambda Aliases, and Amazon ECS** — note CodeDeploy EC2 requires the CodeDeploy Agent + S3 IAM role!), and **AWS CodePipeline** (orchestrates Source -> Build -> Manual Approval -> Deploy stages across accounts/regions) with a concrete code example. - Q: How did you apply and verify AWS CI/CD Suite: CodeBuild, CodeDeploy, CodePipeline & GitHub OIDC in your hands-on lab?
Key Focus: Configure an IAM OIDC Provider for GitHub Actions + `buildspec.yml` / `appspec.yml` definitions and run an automated lint/synth check.