Customer onboarding: KYC/AML integration, secure document upload and consent
Design a customer onboarding architecture on AWS: an orchestrated KYC workflow that calls an identity-verification provider, secure document upload with quarantine and scanning, a manual-review step, consent capture and the data-protection controls a bank's reviewers will ask about.
Assumes: .NET 10 LTS · AWS SDK for .NET v4 (AWSSDK.S3 4.x) · CDK v2 (Amazon.CDK.Lib 2.277.0) · Terraform AWS provider v6 · Region us-east-1. Verified against official sources on 2026-11-18.
Learning objectives
By the end of this lesson you can:
- Draw an onboarding architecture that separates collecting evidence, verifying it, deciding and recording consent.
- Explain where KYC (know your customer) and AML (anti-money-laundering) checks fit, and why a bank usually calls a specialist provider rather than building them.
- Design a secure document upload path: short-lived presigned URLs, a quarantine bucket, malware and type checks, and encryption with a dedicated KMS key.
- Orchestrate a long-running onboarding case with AWS Step Functions, including a human review step that waits for a decision using a task token.
- Model consent as an immutable record (who, what, which version, when) and explain how it ties to UK GDPR principles without claiming compliance.
- Write the onboarding architecture using the 15-section template with failure scenarios and compliance touchpoints.
Prerequisites
- How to read and write a banking architecture
- Digital banking platform: channels and identity
- Webhooks for provider callbacks and saga pattern for orchestration
- UK GDPR and data residency and S3 protection, Object Lock and Macie
- Tools: AWS CLI v2 with
learn-sandbox, .NET 10 SDK (optional)
Why this matters in banking
Onboarding is where a bank decides whether to take on a customer. Two opposite failures hurt:
- Too loose. The bank onboards someone using forged documents, or a person on a sanctions list. Consequences are regulatory, financial and reputational. What counts as adequate checks is set by regulation and your firm's policy, so ⚠ VERIFY with your financial-crime compliance team.
- Too tight or too slow. Legitimate customers abandon the process halfway. Industry experience is that long onboarding flows lose many applicants, which is a direct commercial cost.
There is a third risk architects often forget: onboarding collects the most sensitive personal data the bank will ever hold (passport images, selfies, proof of address, date of birth). It is a prime target, and a data-protection regulator will ask why you collected each item, how long you keep it and who can see it.
Educational content, not legal advice
Which checks are required, which documents are acceptable, how long records must be kept and what you may tell a rejected applicant are decided by regulation and your bank's compliance function. This lesson shows where those decisions plug into the architecture. Anything specific is marked ⚠ VERIFY.
The idea in plain language
Onboarding is a case that moves through stages over minutes, hours or days:
- Start: the applicant gives basic details and agrees to terms and privacy notice (consent captured).
- Evidence: the applicant uploads an identity document and often a selfie or liveness check.
- Verification: a provider checks the document, compares the face and checks data sources. Separately, the applicant is screened against sanctions and politically-exposed-person lists and risk-rated.
- Decision: automatic approve, automatic reject, or refer to a human.
- Outcome: create the customer and account, or send a rejection. Everything is recorded.
Because stages take unpredictable time and external providers fail, you model onboarding as a workflow with state, not as one long API call.
Analogy: opening an account at a branch. You hand over documents, a clerk checks them, someone checks lists in the back room, a manager signs off the tricky ones, and a file is created that the bank must be able to produce years later. Digital onboarding does the same steps with queues and workflows instead of desks.
KYC and AML in one paragraph
KYC is identifying and verifying who a customer is. AML is detecting and preventing money laundering, including screening and monitoring. Banks typically use specialist providers for document verification, biometrics and screening because those require maintained data sets and expertise. Your architecture therefore integrates providers behind a clean interface, handles their failures and keeps the evidence of what was checked.
Who decides what
| Decision | Owner | Architecture consequence |
|---|---|---|
| Which checks apply to which customer type | Financial-crime compliance | Rules live in configuration the compliance team can review, not scattered in code |
| Which provider to use | Procurement, risk, third-party risk | Provider behind an interface; exit plan recorded (third-party risk) |
| What to retain and for how long | Data-protection officer, records management | Retention schedules enforced by lifecycle rules, with legal-hold exception |
| Manual-review outcomes | Trained operations staff | A review tool with audit trail; four-eyes for sensitive overrides |
What problem the AWS services solve
| Service | Role | Limits and sharp edges |
|---|---|---|
| AWS Step Functions (Standard) | Orchestrates the onboarding case, retries provider calls, waits for human decisions | Standard workflows can run up to one year; every state transition is billed; keep payloads small and pass references, not documents |
| Amazon S3 | Stores uploaded evidence in a quarantine bucket then a verified bucket | Block Public Access on; SSE-KMS with a dedicated key; object keys must not contain personal data |
| S3 presigned URLs | Let the browser or app upload directly, without routing large files through your API | A presigned PUT URL carries the permissions of the signer; keep expiry in minutes and sign the content type |
| GuardDuty Malware Protection for S3 | Scans new S3 objects for malware and tags results | Check current Region and pricing availability ⚠ VERIFY; scanning is asynchronous |
| AWS KMS | Customer managed keys for evidence and case data, with key policies that limit who can decrypt | Decrypt access is a data access decision; log every use through CloudTrail |
| Amazon EventBridge | Routes events (document uploaded, scan clean, provider result) | At-least-once delivery, so consumers must be idempotent |
| Amazon DynamoDB | Case state, consent records, idempotency keys | Records with personal data need encryption, access control and retention (TTL for deletion jobs) |
| Amazon Textract, Rekognition | Optional extraction and face comparison/liveness | Not a replacement for a regulated identity-verification provider unless your compliance team approves; accuracy, bias and retention need assessment ⚠ VERIFY |
| Amazon Macie | Finds personal data in S3 | Pattern-based; findings are a signal, not proof |
Honest limitation: AWS offers building blocks, not a KYC product. The identity decision itself, the lists screened and the rules applied belong to the provider and your compliance team.
Microsoft / Azure comparison
| You know (Microsoft/Azure) | AWS equivalent | What's different |
|---|---|---|
| Azure Durable Functions (human interaction pattern) | Step Functions with waitForTaskToken | The workflow is a JSON state machine (Amazon States Language), not code; retries and catches are declarative |
| Azure Blob SAS tokens | S3 presigned URLs | Both are time-limited delegated access. A presigned URL is signed with the credentials of the caller that generated it |
| Microsoft Defender for Storage malware scanning | GuardDuty Malware Protection for S3 | Results appear as object tags and EventBridge events |
| Azure AI Document Intelligence, Face API | Amazon Textract, Rekognition | Similar capabilities; for regulated identity verification many banks use a specialist vendor on either cloud |
| Azure Key Vault keys per workload | KMS customer managed keys with key policy | Key policies, not just IAM, decide who can use a key |
| Microsoft Purview retention labels | S3 Lifecycle, Object Lock, DynamoDB TTL, Macie | Retention is composed from several mechanisms |
Architecture
Onboarding flow
Security-boundary view
Three separate KMS keys for quarantine, verified evidence and case data mean one compromised role cannot read everything, and each store has its own key policy and audit trail.
Step-by-step implementation
Requirements first (sections 1 to 3)
Fictional targets for Harbourline retail onboarding:
| Quality | Target |
|---|---|
| Completion | 85% of eligible applicants finish in under 10 minutes |
| Straight-through rate | At least 80% decided without human review (a business target, not a guarantee) |
| Availability of start and upload | 99.9% monthly |
| Provider failure tolerance | Applicant never loses uploaded evidence; case can resume within 24 hours |
| Evidence handling | Uploads encrypted at rest; no evidence in logs; deletion per retention schedule ⚠ VERIFY schedule |
| Review SLA | Manual review within 1 business day (operations target) |
Create the intake buckets (section 7 and 9)
Create two buckets, quarantine and verified. Both: Block Public Access, default encryption with a customer managed KMS key, TLS-only bucket policy, versioning on the verified bucket, access logging to the log archive. The quarantine bucket has a lifecycle rule that deletes objects after a short period (for example 7 days), so abandoned uploads do not accumulate personal data.
Issue upload URLs from the API (section 8)
The API authenticates the applicant, checks the case belongs to them, generates a random object key (never the applicant's name or the passport number) and returns a short-lived presigned URL that fixes the content type and encryption. The code is in "Complete code" below.
Scan and validate before anything reads the file (section 10)
A new object in quarantine triggers a scan. Only objects tagged clean are copied to the verified bucket by a function whose role can read quarantine and write verified, and nothing else. A validation step checks the real file type by its signature (magic bytes), not the extension, and enforces size limits.
Orchestrate with Step Functions (section 10 and 11)
States: RecordConsent, WaitForUpload, CheckScan, SubmitToIdv, WaitForIdvResult (callback), ScreenApplicant, Decide, ManualReview (task token), CreateCustomer, NotifyApplicant. Each external call has retry with backoff and a catch that routes to ManualReview or Failed with a recorded reason.
Capture consent as an immutable record (section 9 and 15)
Write a consent record with: case id, customer reference, purpose, privacy-notice version, timestamp, channel, and a hash of the exact text shown. Never update it. A withdrawal is a new record. Which lawful basis applies to which processing (consent is not always the basis) is a data-protection officer decision ⚠ VERIFY.
Plan data minimisation and deletion (section 15)
Define what is kept after approval (for example, verification result, document type, reference, evidence images if policy requires) and what is deleted (quarantine copies, selfie biometrics if not required). Automate deletion with lifecycle rules and a deletion job that writes an audit record.
AWS Console instructions
- Console → S3 → Create bucket. Name
hl-m14-onboarding-quarantine-<random>, Region us-east-1, Block all public access on, default encryption SSE-KMS with a new customer managed key, versioning off for quarantine. Add tagsProject=cea-lab,Lab=m14-l3,Environment=learn,Owner=<you>. - Bucket → Management → Create lifecycle rule: expire current versions after 1 day (lab) and delete incomplete multipart uploads after 1 day.
- Console → Step Functions → State machines → Create from a blank canvas, choose Standard, paste the callback example below, and run with a test input.
- Console → EventBridge → Rules to see how S3 object events could trigger the scan workflow ⚠ VERIFY event names for your scanning option.
AWS CLI
# Create the quarantine bucket (us-east-1 needs no LocationConstraint). Name must be globally unique.
BUCKET=hl-m14-onb-quarantine-$RANDOM
aws s3api create-bucket --bucket "$BUCKET" --region us-east-1 --profile learn-sandbox
# Block every form of public access.
aws s3api put-public-access-block --bucket "$BUCKET" --profile learn-sandbox \
--public-access-block-configuration BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true
# Default encryption with a KMS key you own (replace the key id with a customer managed key you created).
aws s3api put-bucket-encryption --bucket "$BUCKET" --profile learn-sandbox \
--server-side-encryption-configuration '{"Rules":[{"ApplyServerSideEncryptionByDefault":{"SSEAlgorithm":"aws:kms","KMSMasterKeyID":"<kms-key-id>"},"BucketKeyEnabled":true}]}'
# Delete anything left after one day so abandoned uploads do not linger.
aws s3api put-bucket-lifecycle-configuration --bucket "$BUCKET" --profile learn-sandbox \
--lifecycle-configuration '{"Rules":[{"ID":"expire-quarantine","Status":"Enabled","Filter":{"Prefix":""},"Expiration":{"Days":1},"AbortIncompleteMultipartUpload":{"DaysAfterInitiation":1}}]}'
# Tag the bucket with the course tags.
aws s3api put-bucket-tagging --bucket "$BUCKET" --profile learn-sandbox \
--tagging 'TagSet=[{Key=Project,Value=cea-lab},{Key=Lab,Value=m14-l3},{Key=Environment,Value=learn},{Key=Owner,Value=learner}]'Infrastructure as Code
using Amazon.CDK;
using Amazon.CDK.AWS.KMS;
using Amazon.CDK.AWS.S3;
using Constructs;
public sealed class OnboardingIntakeStack : Stack
{
public OnboardingIntakeStack(Construct scope, string id, IStackProps props) : base(scope, id, props)
{
var quarantineKey = new Key(this, "QuarantineKey", new KeyProps
{
Description = "Harbourline onboarding quarantine evidence (learning)",
EnableKeyRotation = true,
RemovalPolicy = RemovalPolicy.DESTROY, // lab only
});
_ = new Bucket(this, "Quarantine", new BucketProps
{
Encryption = BucketEncryption.KMS,
EncryptionKey = quarantineKey,
BucketKeyEnabled = true,
BlockPublicAccess = BlockPublicAccess.BLOCK_ALL,
EnforceSSL = true, // adds a TLS-only bucket policy
Versioned = false,
LifecycleRules =
[
new LifecycleRule
{
Id = "expire-quarantine",
Expiration = Duration.Days(7),
AbortIncompleteMultipartUploadAfter = Duration.Days(1),
},
],
RemovalPolicy = RemovalPolicy.DESTROY, // lab only
AutoDeleteObjects = true, // lab only
});
}
}The human-review step (Amazon States Language)
{
"ManualReview": {
"Type": "Task",
"Resource": "arn:aws:states:::sqs:sendMessage.waitForTaskToken",
"Parameters": {
"QueueUrl": "https://sqs.us-east-1.amazonaws.com/111122223333/hl-m14-onboarding-review",
"MessageBody": {
"caseId.$": "$.caseId",
"reason.$": "$.referReason",
"taskToken.$": "$$.Task.Token"
}
},
"TimeoutSeconds": 172800,
"Catch": [
{ "ErrorEquals": ["States.Timeout"], "ResultPath": "$.error", "Next": "EscalateStaleReview" }
],
"ResultPath": "$.reviewDecision",
"Next": "ApplyDecision"
}
}The workflow pauses until a reviewer's tool calls SendTaskSuccess or SendTaskFailure with the token. The token is a secret capability: store it only in the review queue message, restrict who can read that queue, and never put it in a URL. The account ID 111122223333 is the AWS documentation placeholder.
Complete code
The onboarding API issues presigned upload URLs and enforces a small case state machine. This is a minimal ASP.NET Core 10 sketch with the security-relevant parts; authentication wiring is as in the digital platform lesson.
using Amazon.S3;
using Amazon.S3.Model;
public sealed record UploadRequest(string DocumentType, string ContentType);
public sealed record UploadInstruction(string Url, string ObjectKey, DateTimeOffset ExpiresAt);
public enum OnboardingState { Started, DocumentsRequested, DocumentsReceived, Verifying, InReview, Approved, Rejected }
public static class OnboardingRules
{
private static readonly HashSet<string> AllowedTypes = ["image/jpeg", "image/png", "application/pdf"];
private static readonly HashSet<string> AllowedDocs = ["passport", "driving-licence", "proof-of-address"];
// Only these moves are legal. Everything else is a bug or an attack and is rejected.
private static readonly Dictionary<OnboardingState, OnboardingState[]> Transitions = new()
{
[OnboardingState.Started] = [OnboardingState.DocumentsRequested],
[OnboardingState.DocumentsRequested] = [OnboardingState.DocumentsReceived],
[OnboardingState.DocumentsReceived] = [OnboardingState.Verifying],
[OnboardingState.Verifying] = [OnboardingState.InReview, OnboardingState.Approved, OnboardingState.Rejected],
[OnboardingState.InReview] = [OnboardingState.Approved, OnboardingState.Rejected],
};
public static bool CanMove(OnboardingState from, OnboardingState to) =>
Transitions.TryGetValue(from, out var allowed) && allowed.Contains(to);
public static bool IsAcceptable(UploadRequest r) =>
AllowedDocs.Contains(r.DocumentType) && AllowedTypes.Contains(r.ContentType);
}
public sealed class UploadUrlService(IAmazonS3 s3, string quarantineBucket, string kmsKeyId, TimeProvider clock)
{
public async Task<UploadInstruction> CreateAsync(string caseId, UploadRequest request, CancellationToken ct)
{
if (!OnboardingRules.IsAcceptable(request))
{
throw new ArgumentException("Document type or content type not allowed.");
}
// Random key: no names, no document numbers. The case id is an opaque identifier.
var objectKey = $"cases/{caseId}/{Guid.CreateVersion7():N}";
var expires = clock.GetUtcNow().AddMinutes(5);
var url = await s3.GetPreSignedURLAsync(new GetPreSignedUrlRequest
{
BucketName = quarantineBucket,
Key = objectKey,
Verb = HttpVerb.PUT,
Expires = expires.UtcDateTime,
ContentType = request.ContentType, // signed: the upload must send this exact type
ServerSideEncryptionMethod = ServerSideEncryptionMethod.AWSKMS,
ServerSideEncryptionKeyManagementServiceKeyId = kmsKeyId,
});
return new UploadInstruction(url, objectKey, expires);
}
}Code explained line by line
OnboardingStateis the case lifecycle. Representing it as an enum with an explicit transition table stops code (or a replayed event) from moving a case fromRejectedback toApproved.OnboardingRules.CanMovelooks up the allowed next states. A missing key means the state is terminal. Returnfalseand log the attempt; do not throw away the evidence.IsAcceptableis an allow-list. Deny-lists of bad types always miss something; allow-lists fail safe.UploadUrlServicegets the S3 client and the bucket from dependency injection, so a unit test can pass a fake client.TimeProvidermakes expiry testable.- The object key is
cases/<caseId>/<random>. The case id is internal and opaque. No personal data appears in a key because keys appear in logs, events and metrics. GetPreSignedURLAsyncbuilds a URL signed with the API's role credentials. The signature covers the verb, key, expiry, content type and the KMS headers, so the client cannot change them without invalidating the URL.ServerSideEncryptionMethod.AWSKMSwith a key id forces the upload to use your customer managed key. The key policy must allow the signing role to use the key (kms:GenerateDataKey), or the upload fails with an access error.- A five-minute expiry keeps the URL useful for one upload. The size limit is not enforced by this URL; a validation step after upload must reject oversized or wrongly typed files. Some SDKs support POST policies that include a size condition; check whether your approach needs one ⚠ VERIFY.
Security considerations
⚠ Learning shortcut — not for production
This lesson relies on a presigned PUT URL and a post-upload scan. In production, add: an allow-listed content-length check at upload time (for example through a presigned POST policy or an upload proxy), object tagging to track scan state, a bucket policy that denies reads from anything except the verification role, VPC endpoint policies, S3 Object Lock or legal-hold rules where retention demands, and a data protection impact assessment before collecting biometrics.
- Least privilege per role. The API role can sign upload URLs but cannot read evidence. The scan-copy role can read quarantine and write verified but nothing else. Review staff read evidence through a tool that logs each view.
- No personal data in logs, events or object keys. Log case ids and reference numbers. Use
IncludeExecutionData = falsefor state machines whose input contains personal details, or pass only references. - Secrets from providers. Provider API keys and webhook secrets live in Secrets Manager with rotation. Verify webhook signatures with HMAC (webhook lesson) and make handlers idempotent.
- Egress control. Calls to providers leave through an allow-listed path (egress control), so a compromised task cannot send evidence elsewhere.
- Tipping-off and rejection messages. What you may tell a rejected applicant is a legal and compliance matter. Keep the customer-facing message generic and the detailed reason internal ⚠ VERIFY with compliance.
- Biometric data. Face images used to identify a person are special category data under UK GDPR; extra conditions apply ⚠ VERIFY with your data protection officer.
- Residency. If your lawful basis or contracts require data to stay in a Region, restrict Regions with service control policies (UK GDPR and data residency). The labs use us-east-1 only because they contain no real data.
Banking use case
Harbourline opens current accounts for UK residents (fictional). A typical day:
- 4,000 applications start; 3,400 reach the upload step; 3,000 finish.
- 2,500 are decided automatically; 450 are referred (possible list match, low-quality image, mismatch); 50 are rejected by the provider as invalid.
- The provider has a 40-minute outage at midday. Applicants who already uploaded are unaffected. The workflow retries with backoff for 30 minutes, then parks cases in
WaitForIdvResultwith a notice to applicants that "we are experiencing delays". When the provider returns, cases resume. No evidence is lost; no applicant is approved without a result. - Two reviewers disagree on a case; the four-eyes rule sends it to a senior reviewer. Every decision records reviewer id, reason code and time.
Common mistakes
- Uploading through the API → large files tie up compute and memory → presigned URLs direct to S3.
- Long-lived or reusable upload URLs → anyone with the URL can overwrite evidence → minutes, one object key per upload.
- Reading the file before scanning → malware or crafted images reach your parser → quarantine first, read only clean objects.
- Personal data in object keys or state machine inputs → it leaks into logs and events → opaque ids and references.
- Treating the provider's "pass" as the decision → business rules and risk rating still apply → the bank decides, the provider advises.
- No timeout on manual review → cases stall forever → timeout with escalation.
- Collecting everything "in case" → violates data minimisation and increases breach impact → collect what the process needs, with a documented purpose.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
Upload fails with AccessDenied using a valid presigned URL | Signing role lacks KMS permission, or the headers differ from the signed values | Add kms:GenerateDataKey for the key; send exactly the signed Content-Type and encryption headers |
Upload fails with SignatureDoesNotMatch | Client changed a signed header, or system clock is off | Send the same headers; sync time; regenerate the URL |
| URL works in a browser but not from the mobile client | CORS preflight on the bucket missing | Add a CORS rule that allows PUT from your app origins and the needed headers |
Step Functions execution stuck in ManualReview | Task token never returned | Check the review queue, reviewer permissions, and the timeout path |
| Duplicate cases for one applicant | Client retried POST /onboarding without an idempotency key | Require Idempotency-Key; see idempotency keys |
| Webhook handled twice | Provider retries on slow acknowledgement | Return 200 quickly after recording the event; deduplicate on the event id |
| Objects remain after cleanup | Versioning kept noncurrent versions | Delete versions and delete markers, or use AutoDeleteObjects/force_destroy in labs |
Cost and cleanup
Label: 🟡 credits. The design work is free. A deployed lab uses a few S3 requests, a KMS key (USD 1 per month per customer managed key, prorated, plus request charges ⚠ VERIFY) and Step Functions state transitions measured in pennies. KMS keys scheduled for deletion keep a 7-to-30-day waiting period, during which they are not usable but are not yet gone. Free alternative: do the design exercise only, and run the C# rules and URL-service logic locally with a fake S3 client.
# Empty and delete the quarantine bucket (lab data only).
aws s3 rm "s3://$BUCKET" --recursive --profile learn-sandbox
aws s3api delete-bucket --bucket "$BUCKET" --profile learn-sandbox --region us-east-1
# Schedule the lab KMS key for deletion (minimum 7 days).
aws kms schedule-key-deletion --key-id <kms-key-id> --pending-window-in-days 7 \
--profile learn-sandbox --region us-east-1
# Delete any state machines and queues you created.
aws stepfunctions delete-state-machine --state-machine-arn <arn> --profile learn-sandbox --region us-east-1
# Confirm nothing tagged for the course remains.
aws resourcegroupstaggingapi get-resources --tag-filters Key=Project,Values=cea-lab \
--profile learn-sandbox --region us-east-1Exercises
- 🟢 Guided: write sections 1 to 3 and the failure table (section 11) for onboarding. Include the identity-verification provider outage, a malware-positive upload and a reviewer who never responds.
- 🟡 Challenge: write unit tests for
OnboardingRules.CanMove: every legal transition passes, and at least five illegal ones fail (for exampleRejectedtoApproved, andStartedtoVerifying). - 🔴 Live problem: compliance asks, "If a customer withdraws consent, can you prove which of their data you deleted, and which you must keep?" Design the consent-withdrawal flow, the deletion job, the audit record it writes, and the list of data that cannot simply be deleted (for example records the bank must keep for regulatory reasons ⚠ VERIFY). Say who must approve the rules.
Assignment
Produce the full 15-section onboarding architecture in architecture/onboarding/: a context diagram, the sequence diagram above adapted to your provider, the security-boundary diagram, an ADR on "provider behind an interface with exit plan", an ADR on "quarantine then verified buckets with separate keys", the Step Functions state list with retries, and a compliance-touchpoints table (financial-crime compliance, data protection, third-party risk, records management). No compliance claims.
Solutions
| Failure | Detection | Automatic response | Customer impact | Manual step |
|---|---|---|---|---|
| IDV provider outage | Error-rate alarm on provider calls, execution age metric | Retry with backoff for 30 minutes, then park the case and message the applicant | Delay, no data lost | Operations monitors; compliance decides if an alternate provider is used |
| Malware-positive upload | Scan result tag/event | Object never copied; applicant asked to upload again; security event raised | Must re-upload | Security reviews if repeated from one device or network |
| Reviewer never responds | States.Timeout after 48 hours | Escalate to team lead queue, notify applicant of delay | Slower decision | Team lead assigns |
| Duplicate application | Idempotency key and applicant fingerprint check | Return the existing case | None | None |
| Applicant abandons mid-way | Case age alarm | Lifecycle expires quarantine evidence; case closed | Must restart | None |
| Wrong decision applied twice | Transition table rejects illegal move | Second event ignored and logged | None | Investigate source of the replay |
Why: each row gives reviewers a detection, an automatic behaviour and the human fallback. The key principle is "never approve by default": every failure path ends in a hold, retry or rejection, never silent approval.
using Xunit;
public class OnboardingRulesTests
{
[Theory]
[InlineData(OnboardingState.Started, OnboardingState.DocumentsRequested)]
[InlineData(OnboardingState.DocumentsRequested, OnboardingState.DocumentsReceived)]
[InlineData(OnboardingState.DocumentsReceived, OnboardingState.Verifying)]
[InlineData(OnboardingState.Verifying, OnboardingState.InReview)]
[InlineData(OnboardingState.InReview, OnboardingState.Approved)]
public void Legal_moves_pass(OnboardingState from, OnboardingState to) =>
Assert.True(OnboardingRules.CanMove(from, to));
[Theory]
[InlineData(OnboardingState.Rejected, OnboardingState.Approved)]
[InlineData(OnboardingState.Approved, OnboardingState.Rejected)]
[InlineData(OnboardingState.Started, OnboardingState.Verifying)]
[InlineData(OnboardingState.DocumentsReceived, OnboardingState.Approved)]
[InlineData(OnboardingState.InReview, OnboardingState.Started)]
public void Illegal_moves_fail(OnboardingState from, OnboardingState to) =>
Assert.False(OnboardingRules.CanMove(from, to));
}Why: terminal states have no entry in the table, so CanMove returns false. The key idea is that a replayed or forged event cannot reverse a decision.
Flow: withdrawal request creates a new consent record (never edit the old one). A deletion job lists data by case and customer reference, partitions it into "delete now", "retain under another legal basis or obligation" and "retain pending review", and writes an audit record listing items and the reason for each decision. Objects in S3 with versioning need version deletion; backups age out under their retention rule, so the process must state that explicitly. The retention mapping is owned by the data protection officer and records management, and approved by legal ⚠ VERIFY. The architecture's job is to make each category identifiable (tags, prefixes, table attributes) so the rule can be applied mechanically.
Knowledge check
Answer: Untrusted files must not be read or processed until scanned and validated. Quarantine isolates them with a restrictive role set and a short lifecycle. Only clean objects are promoted to the verified bucket, so downstream systems never see unscanned content.
Answer: It grants time-limited permission to write one object key with the signed headers. It does not by itself limit file size (unless you use a mechanism that includes a size condition), check the real file type or scan for malware. Those checks must happen after upload.
Answer: The workflow can pause for hours or days without holding compute, resume exactly where it was, and carry the decision in its history. The task token acts as a capability that must be protected.
Answer: You may need to prove what the person agreed to, in which version of the notice and when. Editing a record destroys that evidence. A withdrawal is a new record with a later timestamp.
Answer: Not necessarily. The bank's own rules (customer risk rating, product, screening results, thresholds) still apply. The provider's result is one input to the decision, and which combinations may be auto-approved is a compliance decision.
Interview questions
- How would you integrate a KYC provider? Behind an interface in an anti-corruption layer, called from a workflow with retries and timeouts, results delivered by verified webhook or polling, idempotent handlers, results stored with evidence, and a documented exit plan.
- How do you handle an uploaded passport image safely? Authenticated presigned upload to a quarantine bucket, scan and type validation, promote only clean objects, encrypt with a dedicated key, log access, minimise retention, keep personal data out of keys and logs.
- What happens when the provider is down? The case waits; the workflow retries with backoff then parks the case; applicants are told about delays; no one is approved without a result. Capacity for catching up after recovery is planned.
- How do you model a long-running process on AWS? Step Functions Standard with explicit states, callbacks for human steps, timeouts, and references instead of large payloads.
- Where does personal data live, and who can see it? A short table: stores, keys, roles, logs. If you cannot produce it quickly, the design is not ready.
Certification practice
A mobile app must let users upload identity documents to Amazon S3 without routing files through the backend. Uploaded files must be encrypted with a customer managed key and must not be accessible to the public. Which solution fits?
A. Make the bucket public-write and rely on random key names. B. Have the backend generate short-lived presigned URLs for a private bucket that enforces SSE-KMS and Block Public Access. C. Give the mobile app long-term IAM user access keys. D. Email the documents to the operations team.
Answer: B. Presigned URLs give narrow, temporary access. A exposes the bucket. C embeds long-lived credentials in a client. D is insecure and unauditable.
An onboarding workload stores images in three places: quarantine, verified evidence and case records. Security wants a compromised role to be unable to read all three. What is the best approach?
A. One KMS key shared by every store and role. B. Separate customer managed keys per data store with key policies that grant each role only the keys it needs. C. Rely on the default encryption with an AWS owned key. D. Disable encryption for performance.
Answer: B. Separate keys and key policies enforce separation of duties. A creates a single point of compromise. C removes your control and audit of key use. D is unacceptable.
An onboarding process may wait up to two days for a human decision and must survive restarts and deployments with a full audit history. Which orchestration approach is best?
A. A Lambda function that sleeps until the decision arrives. B. AWS Step Functions Standard workflow with a callback task token and a timeout path. C. An EC2 instance with a cron job that polls a file. D. An SQS queue with a visibility timeout of two days.
Answer: B. Standard workflows keep state durably for up to a year with execution history. A would exceed Lambda's maximum duration. C is fragile and unaudited. D misuses the queue: visibility timeouts have a maximum, and the pattern provides no state history.
Completion checklist
- I can explain KYC versus AML in two sentences
- I can describe quarantine, scan, promote and why each exists
- I wrote the onboarding failure table, including provider outage
- I understand what the presigned URL enforces and what it does not
- My compliance table says "requires review by", never "complies"
- I ran the cleanup steps and confirmed nothing tagged
Project=cea-labremains
Key takeaways
- Onboarding is a long-running case: model it as a workflow with explicit states, callbacks and timeouts.
- Quarantine, scan, then promote; separate keys and roles for each store.
- Providers advise, the bank decides; every failure path ends in a hold or a rejection, never silent approval.
- Consent is an immutable record; minimisation and deletion are designed in from the start.
- Personal data stays out of object keys, logs and workflow payloads.
Further reading
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.
Digital banking platform: channels, BFF APIs, identity and sessions
Design the reference architecture for a retail digital banking platform on AWS: edge protection, a backend-for-frontend per channel, OIDC sign-in with step-up authentication, short-lived sessions, and the 15-section write-up a design authority expects.
Account management: lifecycle APIs, data ownership and customer-only authorisation
Design the account management service: a lifecycle state machine, account APIs that return 404 for other people's accounts, an access-grant model for joint and delegated access, DynamoDB tables with optimistic concurrency, and the 15-section write-up.