Capstone 4: Complete .NET CI/CD
A delivery pipeline an auditor can accept as a control: GitHub Actions with OIDC and no stored keys, one immutable image promoted by digest, security scanning gates, an independent production approval, ECS-native blue/green with alarm rollback, and an append-only evidence record, built on the Module 9 lab plus Terraform for the environments.
Assumes: .NET 10 LTS ยท GitHub Actions (configure-aws-credentials v6.3.0, amazon-ecs-deploy-task-definition v2.6.4, trivy-action v0.36.0) ยท Amazon ECS native blue/green ยท Terraform 1.10+ with AWS provider 6.x ยท AWS CLI v2 ยท Region us-east-1. Verified against official sources on 2026-11-18.
What you are building
A delivery pipeline for a .NET 10 Accounts API of the fictional Harbourline Bank that:
- builds once, tests, scans and pushes an immutable image to Amazon ECR;
- deploys that exact image, referenced by digest, to a
testenvironment; - waits for a human approval on a protected
prodenvironment, by someone other than the author; - checks the release against a written release policy (ticket, digest, tests, scans, segregation of duties);
- deploys to production with ECS blue/green, where a CloudWatch alarm or a failed health check rolls traffic back automatically;
- stores an append-only evidence record of the release, including failures.
No AWS access key exists anywhere. GitHub Actions gets short-lived credentials through OpenID Connect, one role per job, scoped to one repository and one branch or environment.
This capstone wraps the Module 9 lab (labs/m09-delivery-pipeline: the API, workflows, OIDC and ECR Terraform, release tools, 75 tests) and adds what the lab leaves to Module 3: Terraform for the environments the pipeline deploys into, with the ECS-native BLUE_GREEN strategy, production and test listeners, and rollback alarms.
Educational project
The lab uses one sandbox account to play build, test and production, and an HTTP listener for the load balancer. Real separation uses separate accounts, HTTPS, an approved change process and a release policy agreed with risk and audit. All data is fictional.
Learning objectives
By the end you can:
- Operate a pipeline where each job receives credentials for one role, and show with
trust-evalwhy a fork, a pull request or another repository cannot assume it. - Promote one image by digest through environments without rebuilding.
- Configure GitHub environments with required reviewers, Prevent self-review and a branch restriction, and prove the self-approval refusal.
- Rehearse an automatic rollback by breaking the readiness check on purpose, and explain what ECS did.
- Produce and verify a release-evidence record, and say what it does and does not prove.
- Deploy, drill, and tear down, with a cost estimate.
The architecture
The repository adds the release sequence with approval and rollback, the trust and security boundaries, and the runtime traffic path in projects/p4-complete-cicd/docs/architecture.md.
Prerequisites and the lessons it builds on
| You need | Lessons and labs |
|---|---|
| Pipeline foundations | Module 9 overview, CI/CD concepts on AWS, Git and GitHub for regulated teams |
| Identity | GitHub Actions with OIDC, Lab: OIDC deploy role, Secrets in CI/CD |
| Building and testing | Lab: CI workflow with Testcontainers, Automated testing strategy, Docker and ECR in pipelines |
| Security | Pipeline security, Pipeline security scanning |
| Deploying and rolling back | ECS deployment strategies, Rollback strategies, Environment separation, Infrastructure automation in the pipeline |
| Audit | Release management and audit evidence |
| The module project | Module project: complete CI/CD pipeline |
What is in the repository
| Where | What |
|---|---|
labs/m09-delivery-pipeline | The Accounts API and Dockerfile; ci.yml, security.yml, release.yml; CODEOWNERS and Dependabot; the Delivery tool (trust-eval, trust-lint, image-tags, gate, evidence); OIDC, ECR and evidence Terraform; ECS and Lambda deployment files; 75 tests (74 run offline) |
projects/p4-complete-cicd | The capstone: README.md, checklist.md, docs/ (architecture, five ADRs, security controls, testing and drills, monitoring, cost and teardown), infra/terraform (cluster, ALB with production and test listeners, blue and green target groups, ECS BLUE_GREEN service, alarms, roles, security groups) |
Build path
Run the lab's tests (free). 74 pass, 1 is skipped (LocalStack). Then use the Delivery CLI to evaluate the OIDC trust policies against the good and hostile claim files and lint the unsafe policies.
Create your repository. Copy the lab's contents to the root of a new GitHub repository (workflows must live in .github/workflows at the root). Add a second account or collaborator as approver.
Deploy identity and registry. The lab's Terraform creates the OIDC provider, three roles, the ECR repository (immutable tags, scan on push) and the evidence bucket. Create the GitHub environments test and prod with required reviewers, Prevent self-review and main-only deployment.
Bootstrap an image and the environments. Push one throwaway image, read its digest, then terraform apply the capstone's infra/terraform for test and for prod (separate state keys). Wire the outputs into the GitHub variables and the task definition.
Release. Push to main: build, scan, push, deploy to test. Run the release workflow manually with a change ticket: approve as the second person, watch the policy step, the blue/green deployment and the evidence record.
Run the drills. Rollback (the main one), self-approval, fork and pull request, wildcard trust, secret, vulnerable dependency, vulnerable image, immutable tag, wrong environment, evidence overwrite and restore. Save evidence for each.
Tear down both environments and the lab's AWS resources, and prove nothing is left.
What was verified when this page was written
| Check | Result |
|---|---|
| Lab m09 suite | 74 tests passing, 1 skipped per the lab README; Delivery CLI proofs re-run before publication |
terraform validate on the capstone infra/terraform (Terraform 1.14, AWS provider 6.x, including the new ECS deployment configuration and advanced load balancer settings) | Valid |
| Not run | A real GitHub workflow run, an AWS deployment or a rollback, and a separate Terraform pipeline (design only). The managed policy name for the ECS infrastructure role and some CLI flags are marked โ VERIFY in the ADRs |
Security controls
The repository's docs/security-controls.md covers source control, pipeline identity, supply chain, release governance and runtime. The ones the lab proves in code:
| Control | How it is proven |
|---|---|
| Trust scoped to one context | trust-eval allows the production claim and denies the fork, the pull request, the other repository and the wrong audience |
| Unsafe trust is blocked in CI | trust-lint fails the wildcard and the missing-subject policies; CI lints every policy |
| Release policy in code | The evidence command rejects a missing ticket, a tag instead of a digest, zero tests, unaccepted critical findings and a self-approved release |
| Immutable artifacts | ECR tag immutability and the image-tag policy; no latest |
| Independent approval | GitHub environment rules, checked again by the release policy |
| Automatic rollback | ECS alarms with rollback enabled; the readiness-failure drill |
Honest gaps: one account plays all environments; an HTTP listener in the lab configuration; evidence in governance mode for one day; a placeholder test count in the evidence record until the exercise wires in the real JUnit result; GitHub's environment protections depend on your plan and repository visibility โ VERIFY.
Cost and teardown
Roughly USD 0.15 to 0.20 per hour for test and prod together while they exist (Fargate, two load balancers, a shared NAT gateway; blue/green doubles the tasks for the deployment and bake time). A 4-hour session is under a dollar; two environments left for a month are about USD 110 to 145. GitHub Actions minutes depend on your plan โ VERIFY. Prices are estimates checked on 2026-11-17 and 2026-11-18; the repository's docs/cost-and-teardown.md has the table and the ordered teardown.
Teardown checklist
Destroy both environments with Terraform, then the lab's Terraform (evidence objects are locked for a day in governance mode, so destroy may need a bypass or a wait), then delete ECR images and the GitHub environment variables, then run the tag query for Project=cea-lab. Check load balancers, NAT gateways and log groups by hand.
Acceptance criteria
- The lab's tests pass and you can explain the skipped one.
- CI is green on a normal pull request and red on a fake secret, a vulnerable dependency and a wildcard trust policy.
- One digest travels from build to test to prod; you checked it in each environment.
- The self-approval attempt was refused by GitHub, and the release policy fails when the author is the approver.
- You ran the rollback drill and recorded ECS's deployment events, the alarm history and the evidence record.
- Both environments and the lab resources are destroyed and nothing tagged
Project=cea-labremains.
Portfolio-ready checklist
The full list is projects/p4-complete-cicd/checklist.md. The essentials:
- Five ADRs: OIDC, build once and digest, approvals and segregation of duties, blue/green with alarm rollback, append-only evidence.
- Diagrams that match the workflows you actually run.
- Evidence you collected: branch protection export, environment settings, CloudTrail role sessions, the rollback drill.
- A written list of what a real bank would still need: separate accounts, an approved change process, penetration testing, audit sign-off.
- Extensions: separate accounts, a gated Terraform pipeline with drift detection, a
CANARYstrategy comparison, a smoke suite on the green tasks before the shift, attestation verification before production.
Exercises
๐ข Guided. Run trust-eval for each of the claim files against the production trust policy and write one sentence for each result saying which condition decided it.
๐ก Challenge. Replace the placeholder test count in release.yml with the real number from the CI JUnit artifact, and add a unit test that the release policy rejects zero tests.
๐ด Live problem. Ticket CHG-104310: "Customers saw intermittent 502s for about four minutes after yesterday's release. The pipeline was green and the dashboard looked fine." The service uses a rolling update with no alarms. Propose the strategy and alarm changes, name the signals you would alarm on, and explain what the 502s say about the health check.
Interview questions
- Why is OIDC safer than an access key in a GitHub secret, and what does the
subcondition protect against? - Why deploy by digest rather than by tag, and why must there be no
latest? - What does "Prevent self-review" stop, and why does the release policy check it again?
- What does ECS do during the bake time, and what does not roll back?
- What evidence would you show an auditor to prove that no single person can put unreviewed code into production?
Key takeaways
- A pipeline is production infrastructure; protect it like production.
- Credentials with no keys, scoped to one job, are the strongest control you can add cheaply.
- Promote the artifact, not the source: one digest from build to prod.
- Rollback must not need a human; and a rollback must fail the pipeline loudly.
- Evidence for failures matters as much as for successes.
Related
- Module 9 overview and Module 3 overview
- All capstone projects
- Previous: Capstone 3
Independent learning resource โ not affiliated with, endorsed or sponsored by Amazon Web Services. AWS and related marks are trademarks of Amazon.com, Inc. or its affiliates. All banking data in examples is fictional. Sample architectures are for learning and are not automatically compliant with GDPR, PCI DSS or any banking regulation.
Capstone 3: Banking data engineering pipeline with SFTP reconciliation
A data lake pipeline (S3, Glue, Athena, Lake Formation) plus an SFTP daily reconciliation flow with AWS Transfer Family, control-total validation, PII tokenising and masking, counterparty reconciliation and a tamper-evident audit trail, built on the Module 7 lab and 22 new offline tests.
Capstone 5: Highly available banking application
A banking account service that survives a failed task, a lost Availability Zone and, with a rehearsed runbook, a lost Region: a three-tier three-AZ VPC, ALB, ECS Fargate with Auto Scaling, RDS PostgreSQL Multi-AZ, ElastiCache, AWS Backup with a cross-Region copy, alarms that page on symptoms, and a timed DR drill, built on the Module 12 lab plus Terraform for the stack.