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.
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
| You need | Lessons and labs |
|---|---|
| Identity, keys, secrets | IAM in depth, KMS and envelope encryption, Secrets Manager and Parameter Store |
| Edge and detection | WAF and Shield, CloudTrail for banks, Security Hub, GuardDuty, Inspector |
| Threats and review | Threat modelling with STRIDE, Secure code review for .NET, Incident response |
| Hosting the container | Deploy to Fargate, Containerising .NET, Amazon ECR |
| Publishing the API | Container APIs and VPC link, Cognito user pools, API security: WAF and the OWASP API Top 10 |
| The data tier | Amazon Aurora, Multi-AZ, replicas, backups and PITR |
| Operating it | Distributed tracing, Alarms and composite alarms, Incident response runbooks |
Start from the Module 5 overview if you have not completed that module.
What is in the repository
| Where | What |
|---|---|
labs/m05-secure-banking-api | The API, crypto, policy linter, secrets readers, Terraform for keys and the task role, runbooks, 72 tests |
labs/m03-accounts-api | The Fargate, ALB and VPC pattern (CDK) and the container conventions |
labs/m04-account-information-api | The Cognito, REST API, throttling and WAF pattern, and the ownership-check pattern for customer-facing APIs |
projects/p1-secure-banking-api | The 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
| Check | Result |
|---|---|
| Lab m05 tests | 72 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 Dockerfile | Succeeded |
| Not run | An 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:
| Control | How it is proven |
|---|---|
SC-01 default deny: every route except /health returns 401 to an anonymous caller | The 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 data | Create, reveal and search, then search every audit event for the e-mail, name, birth year and IBAN fragments |
| SC-03 production refuses the fake KMS | Starts the host in Production with Crypto:Mode=Local and expects start-up to fail |
| SC-04 separated duties | Five role and route combinations that must be refused with 403 |
| SC-05 log-injection defence | An 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-labremains. - 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
ICustomerStorewith 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
- Why is WAF not enough to stop broken object-level authorization, and where does that check belong?
- What does KMS encryption context add to envelope encryption, and what shows up in CloudTrail when a KYC officer reveals a customer?
- Why did this design choose a REST API and not an HTTP API?
- What is a blind index, what does it leak, and what does rotating its key cost?
- 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.
Related
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 projects
The seven portfolio-quality capstone projects: what each builds, which modules it uses, the tested lab code it wraps, how much it costs and what you leave with. Each ends in a repository you can show an interviewer.
Capstone 2: Event-driven transaction processing
A payment saga with compensation, a transactional outbox, EventBridge, SNS and SQS fan-out, and idempotent Lambda consumers with dead-letter queues, built on the tested Module 8 and Module 14 labs plus 13 end-to-end tests that prove money moves once and the customer is told once.