Skip to Content
Cloud Engineering Academy
Projects

Capstone 1: Secure digital banking REST API

A staff-facing banking API on ECS Fargate behind API Gateway, WAF and Cognito, with field-level KMS encryption, a blind index, audited role-based access, segregated payment signing and an Aurora data tier, built on the tested Module 3, 4 and 5 labs and finished as a portfolio repository.

advanced⏱ 10 h 🟡 Low costSCS-C03SAA-C03DVA-C03

Assumes: .NET 10 LTS · ASP.NET Core 10 · AWS SDK for .NET v4 · xUnit v3 4.0.3 · Terraform 1.10+ with AWS provider 6.x · API Gateway REST API + VPC link V2 · Aurora PostgreSQL Serverless v2 · Region us-east-1. Verified against official sources on 2026-11-18.

What you are building

A secure API for the fictional Harbourline Bank's back office. Support staff see customers with masked data. KYC officers can create customers and, deliberately and with an audit trail, reveal identity fields. A separate role, payments approvers, signs payment instructions. The API runs as a container on ECS Fargate in private subnets, behind an API Gateway REST API with a Cognito authorizer, AWS WAF, KMS field encryption, Secrets Manager and an Aurora PostgreSQL data tier, with CloudWatch alarms and CloudTrail evidence.

This capstone is a wrapper around code you already built and tested. The security behaviour lives in labs/m05-secure-banking-api; the capstone adds the container image, the data, identity and edge infrastructure, ten acceptance tests and the documentation that turns it into something you can show an interviewer.

Educational project: not compliance advice

Nothing here makes a system compliant with PCI DSS, UK GDPR or any regulation. Real banks need legal, security, data-protection and audit review. All data is fictional.

Learning objectives

By the end you can:

  • Present a layered security design for an internet-facing banking API and say which layer stops which attack.
  • Prove, with tests, that every route is authenticated by default, roles cannot perform each other's duties, audit logs hold no personal data and a production host refuses to start with a fake KMS.
  • Explain field-level envelope encryption with KMS encryption context, and why a blind index lets staff search by IBAN without decrypting.
  • Design the network path (WAF, REST API, VPC link V2, internal ALB, private tasks, private database) and write the security-group chain.
  • Deploy, verify, and tear down the stack, with a cost estimate you can defend.

The architecture

The full set of diagrams (big picture, the "reveal identity" sequence, security boundaries) is in the repository at projects/p1-secure-banking-api/docs/architecture.md.

Prerequisites and the lessons it builds on

Start from the Module 5 overview if you have not completed that module.

What is in the repository

WhereWhat
labs/m05-secure-banking-apiThe API, crypto, policy linter, secrets readers, Terraform for keys and the task role, runbooks, 72 tests
labs/m03-accounts-apiThe Fargate, ALB and VPC pattern (CDK) and the container conventions
labs/m04-account-information-apiThe Cognito, REST API, throttling and WAF pattern, and the ownership-check pattern for customer-facing APIs
projects/p1-secure-banking-apiThe capstone: README.md, checklist.md, Dockerfile, docs/ (architecture, five ADRs, security controls, testing, monitoring, cost and teardown), infra/terraform (Aurora, Cognito, WAF, alarms), tests/ (acceptance tests)

Build path

Run the lab's tests (free). 72 tests: 71 pass, 1 needs AWS and is skipped. Read the three test classes (ApiTests, CryptoTests, PolicyTests) before you change anything.

Run the acceptance tests (free). Ten tests in projects/p1-secure-banking-api/tests. Each carries a control ID (SC-01 to SC-05) that appears in the security-controls document. Break one on purpose (remove the fallback authorization policy) and watch SC-01 fail.

Build the image. The capstone Dockerfile builds the lab's API as a chiseled, non-root image: docker build -f projects/p1-secure-banking-api/Dockerfile -t hl-p1-secure-api:local labs/m05-secure-banking-api.

Deploy the foundations. Account guardrails (Labs 5.4 and 5.5), then the m05 Terraform for the keys, the secret and the task role.

Deploy hosting and edge. The Module 3 Fargate pattern for the cluster and ALB, then terraform apply in projects/p1-secure-banking-api/infra/terraform for Aurora, the staff Cognito pool and groups, the WAF web ACL and the alarms. Follow Module 4 for the REST API and VPC link, then attach the web ACL.

Verify like a reviewer. Run the live checks in the testing document: anonymous and wrong-role calls, the reveal flow seen in both the audit log and CloudTrail, a WAF rate-limit drill against your own API, a network reachability check, encryption checks, an alarm drill.

Tear down the same day and prove nothing is left.

What was verified when this page was written

CheckResult
Lab m05 tests72 tests: 71 passing, 1 skipped (needs AWS) per the lab README
Capstone acceptance tests (dotnet test in Docker, .NET SDK 10)10 passed, 0 failed
terraform validate on infra/terraform (Terraform 1.14, AWS provider 6.x)Valid
docker build of the capstone DockerfileSucceeded
Not runAn actual AWS deployment of this capstone, and any penetration test

Security controls

Twenty-plus controls are listed with their evidence in the repository's docs/security-controls.md. The ones the tests prove:

ControlHow it is proven
SC-01 default deny: every route except /health returns 401 to an anonymous callerThe test reads the route table of the running API and calls each route, so a new route that forgets authorization fails
SC-02 audit events never contain personal dataCreate, reveal and search, then search every audit event for the e-mail, name, birth year and IBAN fragments
SC-03 production refuses the fake KMSStarts the host in Production with Crypto:Mode=Local and expects start-up to fail
SC-04 separated dutiesFive role and route combinations that must be refused with 403
SC-05 log-injection defenceAn unsafe correlation ID is replaced by a GUID

The known gaps are listed honestly: the lab keeps customers in memory behind an ICustomerStore port, so the Aurora cluster exists but the API does not yet write to it. Implementing that store is the main extension.

Cost and teardown

Roughly USD 0.12 to 0.20 per hour while deployed (Fargate, ALB, NAT gateway, WAF, Aurora at 0 to 0.5 ACU, KMS keys, secrets), so a 4-hour session is under a dollar and a forgotten month is about USD 90 to 145. Prices are estimates checked on 2026-11-17 and 2026-11-18 and Aurora's ACU price is marked ⚠ VERIFY; the repository's docs/cost-and-teardown.md has the table and the ordered teardown commands. Set an AWS Budget first.

Teardown checklist

Delete in this order: the API Gateway stage and VPC link, the capstone Terraform, the Module 3 stacks, the m05 Terraform, then run the tag query for Project=cea-lab. Check by hand for NAT gateways, load balancers, Aurora snapshots and WAF web ACLs. KMS keys wait 7 days in pending deletion at no charge.

Acceptance criteria

You are done when all of these are true:

  • The 72 lab tests and the 10 acceptance tests pass on a clean machine.
  • The image builds and runs as a non-root user; production start-up fails with the local KMS stand-in.
  • You have deployed and verified at least the identity, edge and database layers, with evidence saved and dated.
  • Every control in the controls document has evidence you collected yourself.
  • The cost estimate and teardown are in your README, and nothing tagged Project=cea-lab remains.
  • A reviewer can read your five ADRs and the three diagrams and understand why, not just what.

Portfolio-ready checklist

The full checklist is projects/p1-secure-banking-api/checklist.md. The essentials:

  • Your own repository; README states what the project is in three sentences.
  • No secrets or personal data; a secret scan is clean.
  • Diagrams match what you built; 3 to 5 ADRs with alternatives and consequences.
  • Residual risks and "what a real bank would still need" are written down.
  • Alarms exist and you triggered one on purpose.
  • Extensions: Aurora-backed ICustomerStore with a Testcontainers test, the AWS Encryption SDK in place of the hand-written envelope, VPC endpoints instead of NAT.

Exercises

🟢 Guided. Add a sixth acceptance test, SC-06: a request with a malformed customer ID (for example ../etc) returns 400, not 500. Add the control to the security-controls table.

🟡 Challenge. Implement ICustomerStore on PostgreSQL with Npgsql: a migration, the connection string built from the Aurora secret, a limited database role, and an integration test using Testcontainers. Keep SC-02 green.

🔴 Live problem. A tester reports that a support user could read a customer's date of birth by calling the API with ?reveal=true&reveal=true. You cannot reproduce it locally and the audit log shows only denied. List five places the difference could be (gateway mapping, query-string handling, proxy normalisation, role mapping, caching) and write the test that would have caught the class of bug.

Interview questions

  1. Why is WAF not enough to stop broken object-level authorization, and where does that check belong?
  2. What does KMS encryption context add to envelope encryption, and what shows up in CloudTrail when a KYC officer reveals a customer?
  3. Why did this design choose a REST API and not an HTTP API?
  4. What is a blind index, what does it leak, and what does rotating its key cost?
  5. How would you prove to an auditor that no one can sign a payment and create customers with the same identity?

Key takeaways

  • Defence in depth means each layer has a named job. Say what each stops, and what it cannot.
  • The most valuable security tests check properties of the whole system (default deny, no personal data in logs, fail closed), not just features.
  • Honest scope beats a polished lie: state what is built, what is designed and what is missing.
  • Teardown and cost are part of the design.

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.

On this page