
Problem Statement: Scaling Interactive Bank Reconciliation
Bank reconciliation is a crucial but often complex and resource-intensive process. Suppose we have 500,000 reconciliation files stored in S3 for a two-way reconciliation process. These files are split into two categories:
- 250,000 bank statement files
- 250,000 transaction files from the company’s internal records
The objective is to reconcile these files by matching the transactions from both sources and loading the results into a database, followed by triggering reporting jobs.

Challenges with Current Approaches:
Sequential Processing Limitations:
- A simple approach might involve iterating through the 500,000 files in a loop, but this would take an impractical amount of time. Processing even smaller datasets of 5,000 files would already show the inefficiency of sequential processing for this scale.
Data Scalability:
- As the number of files increases (say, to 1 million files), this approach becomes completely unfeasible without significant performance degradation. Traditional methods are not designed to scale effectively.
Fault Tolerance:
- In a large-scale operation like this, system failures can happen. If one node fails during reconciliation, the entire process could stop, requiring complex error-handling logic to ensure continuity.
Cost & Resource Management:
- Balancing the cost of infrastructure with performance is another challenge. Over-provisioning resources to handle peak load times could be expensive while under-provisioning could lead to delays and failed jobs.
Complexity in Distributed Processing:
- Setting up distributed processing frameworks, such as Hadoop or Spark, introduces a significant learning curve for developers who aren’t experienced with big data frameworks. Additionally, provisioning and maintaining clusters of machines adds further complexity.
Solution: Leveraging AWS Step Functions Distributed Map

AWS Step Functions, a serverless workflow orchestration service, solves these challenges efficiently by enabling scalable, distributed processing with minimal infrastructure management. With the Step Functions Distributed Map feature, large datasets like the 500,000 reconciliation files can be processed in parallel, simplifying the workflow while ensuring scalability, fault tolerance, and cost-effectiveness.
Key Benefits of the Solution:
Parallel Processing for Faster Reconciliation:
- Distributed Map breaks down the 500,000 reconciliation tasks across multiple compute nodes, allowing files to be processed concurrently. This greatly reduces the time needed to reconcile large volumes of data.
Scalability:
- The workflow scales effortlessly as the number of reconciliation files increases. Step Functions Distributed Map handles the coordination, ensuring that you can move from 500,000 to 1 million files without requiring a major redesign.
Fault Tolerance & Recovery:
- If a node fails during the reconciliation process, the coordinator will rerun the failed tasks on another compute node, preventing the entire process from stalling. This ensures greater resilience in high-scale operations.
Cost Optimization:
- As a serverless service, Step Functions automatically scales based on usage, meaning you’re only charged for what you use. There’s no need to over-provision resources, and scaling happens without manual intervention.
Developer-Friendly:
- Developers don’t need to learn complex big data frameworks like Spark or Hadoop. Step Functions allows for orchestration of workflows using simple tasks and services like AWS Lambda, making it accessible to a broader range of teams.
Workflow Implementation:

The proposed Step Functions Distributed Map workflow for bank reconciliation can be broken down into the following steps:
Stage the Data:
- AWS Athena is used to stage the reconciliation data, preparing it for further processing.
Gather Third-Party Data:
- A Lambda function fetches any necessary third-party data, such as exchange rates or fraud detection information, to enrich the reconciliation process.
Run Distributed Map:
- The Distributed Map state initiates the reconciliation between each pair of files (one from the bank statements and one from the internal records). Each pair is processed in parallel, maximizing throughput and minimizing reconciliation time.
Aggregation:
- Once all pairs are reconciled, the results are aggregated into a summary report. This report is stored in a database, making the data ready for reporting and further analysis.
{
"Comment": "Reconciliation Workflow using Distributed Map in Step Functions",
"StartAt": "StageReconciliationData",
"States": {
"StageReconciliationData": {
"Type": "Task",
"Resource": "arn:aws:athena:us-west-2:123456789012:workgroup/reconciliation-query",
"Next": "FetchBankFiles"
},
"FetchBankFiles": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-west-2:123456789012:function:FetchBankFilesLambda",
"Next": "FetchInternalFiles"
},
"FetchInternalFiles": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-west-2:123456789012:function:FetchInternalFilesLambda",
"Next": "ReconciliationDistributedMap"
},
"ReconciliationDistributedMap": {
"Type": "Map",
"ItemReader": {
"Type": "S3ListReader",
"Configuration": {
"BucketName": "your-bank-statements-bucket",
"Prefix": "bank_files/"
}
},
"MaxConcurrency": 1000,
"ItemProcessor": {
"ProcessorConfig": {
"Mode": "DISTRIBUTED",
"ExecutionType": "STANDARD"
},
"StartAt": "ReconcileFiles"
},
"ItemBatchSize": 50,
"Next": "AggregateResults"
},
"ReconcileFiles": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-west-2:123456789012:function:ReconcileFilesLambda",
"Parameters": {
"bankFile.$": "$.S3ObjectKey",
"internalFile": "s3://your-internal-files-bucket/internal_files/{file-matching-key}"
},
"Next": "CheckReconciliationStatus"
},
"CheckReconciliationStatus": {
"Type": "Choice",
"Choices": [
{
"Variable": "$.status",
"StringEquals": "FAILED",
"Next": "HandleFailedReconciliation"
}
],
"Default": "ReconciliationSuccessful"
},
"ReconciliationSuccessful": {
"Type": "Pass",
"Next": "AggregateResults"
},
"HandleFailedReconciliation": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-west-2:123456789012:function:HandleFailedReconciliationLambda",
"Next": "ReconciliationSuccessful"
},
"AggregateResults": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-west-2:123456789012:function:AggregateResultsLambda",
"Next": "GenerateReports"
},
"GenerateReports": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-west-2:123456789012:function:GenerateReportsLambda",
"End": true
}
}
}
AWS Step Functions Distributed Map offers a scalable, fault-tolerant, and cost-effective solution to processing large datasets for bank reconciliation. Its serverless nature removes the complexity of managing infrastructure and enables developers to focus on the core business logic. By integrating services like AWS Lambda and Athena, businesses can achieve better performance and efficiency in high-scale reconciliation processes and many other use cases.
In Plain English 🚀
Thank you for being a part of the In Plain English community! Before you go:
- Be sure to clap and follow the writer ️👏️️
- Follow us: X | LinkedIn | YouTube | Discord | Newsletter
- Visit our other platforms: CoFeed | Differ
- More content at PlainEnglish.io
