Infrastructure
All infrastructure is managed via Terraform in deploy/. The Terraform module uses the fmtf-module-lambda reusable module for each Lambda function.
Terraform File Layout
| File | Contents |
|---|---|
|
Providers, locals, data sources for all tables/streams/queues, SQS queue resources, EventBridge rules and targets, API Gateway HTTP API |
|
All Lambda module definitions (API, feeder, miner, replay-feeder, webhook, balance-alert, income-signaller, funds-notifier, institution-change-handler) |
|
|
|
All input variables with defaults |
|
Locals for Secrets Manager secret names; |
|
VPC, subnet, and security group data sources |
|
Datadog SLOs (error, throughput, latency) and service definition |
|
Terraform backend and required provider versions |
Lambda Functions
All Lambdas are deployed via the fmtf-module-lambda module (v1.4.10). The module provisions the Lambda function, IAM execution role, CloudWatch log group, Datadog monitors, and optional VPC placement.
| Lambda Name | Timeout | Trigger | VPC |
|---|---|---|---|
|
300s |
API Gateway (HTTP, IAM auth, |
Private subnets + |
|
840s |
Kinesis |
No VPC |
|
90% of miner SQS visibility timeout (default: 810s) |
SQS |
No VPC |
|
840s |
SQS |
No VPC |
|
840s |
API Gateway (implicit, Pave webhook endpoint) |
No VPC |
|
90% of balance-alert SQS visibility timeout |
SQS |
No VPC |
|
840s |
Kinesis |
No VPC |
|
90% of income event tap SQS visibility timeout |
SQS |
No VPC |
|
90% of institution change SQS visibility timeout (120s → 108s) |
SQS |
Private subnets + |
The miner timeout is set to floor(visibility_timeout * 0.9). With the default miner_sqs_visibility_timeout of 900s, the miner timeout is 810s. This ensures the Lambda always finishes before the SQS message becomes visible again.
|
Key Environment Variables
| Variable | Lambda(s) | Description |
|---|---|---|
|
api, miner, balance-alert, institution-change-handler, funds-notifier |
|
|
api, miner |
Days to add to due date when computing |
|
miner |
Days before cash-advance score expires (default: 30) |
|
miner |
Max number of transactions to send Pave per mining request (default: 10) |
|
miner, income-signaller |
Region for the EventBridge |
|
webhook |
URL of the miner SQS queue (webhook enqueues mining work here) |
|
webhook |
Webhook timestamp freshness window / replay protection (default: 3600s). The webhook handler ( |
|
balance-alert, funds-notifier |
Boolean env var controlling whether Segment notifications are actually dispatched ( |
|
funds-notifier |
Days to suppress duplicate credit-card funds notifications (default: 2) |
|
api |
Minimum income amount for income detection (hardcoded: -200) |
|
api |
Minimum valid income amount for Method C (default: -150) |
|
api |
Minimum Jaro-Winkler score for transaction name matching in Method C (default: 0.8) |
|
api |
Days from today before extended payback window begins (default: 28) |
|
api |
Days from today to end of extended payback window (default: 42) |
|
api |
SageMaker endpoint name for ML income classification |
|
api |
|
|
api |
|
SQS Queues
| Queue Name | Visibility Timeout | Max Receive Count | DLQ |
|---|---|---|---|
|
900s (configurable via |
5 |
|
|
900s (configurable via |
5 |
|
|
Default (not set in Terraform; AWS default is 30s) |
5 |
|
|
Default |
N/A (no redrive policy defined) |
None |
|
120s |
1 |
|
The institution-change-handler queue has maxReceiveCount = 1 — a message that fails its single processing attempt is moved to the DLQ immediately with no automatic retries. The SQS visibility timeout only controls how long a message is invisible while being processed; it does not provide additional retry attempts. This aggressive DLQ behaviour is intentional: both delete operations are idempotent, so re-processing a failed message is safe if needed via the DLQ, but automatic retries are not warranted.
|
EventBridge Rules
All three rules operate on the default event bus. Rules and their SQS targets are defined in deploy/main.tf.
| Rule Resource | Event Pattern | Target Queue | Enabled |
|---|---|---|---|
|
|
|
Always (no state control) |
|
|
|
Always (no state control) |
|
|
|
Controlled by |
Kinesis Streams
| Stream Name | Consumer Lambda | Notes |
|---|---|---|
|
|
Batch size: 100, position: |
|
|
Batch size: 100, position: |
DynamoDB Tables (Terraform)
| Table | Local Name | Terraform Resource Type |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Secrets Manager
All secrets are fetched at Lambda startup via BatchGetAndUnmarshalSecrets. Secret names follow {environment}/{service} convention.
| Secret Name | Local | Used By |
|---|---|---|
|
|
feeder, miner, webhook (Pave API credentials) |
|
|
webhook Lambda (Pave webhook signing key) |
|
|
api, institution-change-handler (RDS write connection) |
|
|
api, institution-change-handler (RDS read connection) |
|
|
balance-alert, funds-notifier (Segment write key) |
|
|
api, feeder, replay-feeder (GrowthBook SDK key) |
VPC Configuration
Two Lambdas require VPC placement for private RDS access:
| Resource | Value |
|---|---|
VPC |
|
Private Subnet 1 |
Tagged |
Private Subnet 2 |
Tagged |
Security Group |
Tagged |
Lambdas in VPC: prod-insight-api, prod-insight-institution-change-handler.
Datadog Monitoring
Three SLOs are defined in deploy/datadog.tf, covering all eight non-institution-change-handler Lambdas (api, balance-alert, feeder, funds-notifier, income-signaller, miner, replay-feeder, webhook):
| SLO | Timeframes | Targets |
|---|---|---|
|
7d, 30d |
Target: 99.9%, Warning: 99.99% |
|
7d, 30d |
Target: 99.9%, Warning: 99.99% |
|
7d, 30d |
Target: 99.9%, Warning: 99.99% |
The Datadog service definition (service_definition_yaml) registers the service under the insight application with a Tier 1 designation, linking to the GitHub repo and the Antora-hosted docs at https://docs.floatme.io/insight-service.
Key Terraform Variables
| Variable | Default | Description |
|---|---|---|
|
900 |
SQS visibility timeout for the miner queue (seconds). Lambda timeout is set to 90% of this. |
|
10 |
Number of SQS messages per miner invocation |
|
2 |
Seconds the miner waits to buffer messages before invoking |
|
30 |
Days before a cash-advance score expires in DynamoDB |
|
10 |
Max recent transactions sent to Pave per mining request |
|
1 |
Days added to due date when computing recurring/ritual TTL |
|
11999 |
Income amount threshold in cents for credit card funds notification (i.e. $119.99) |
|
2 |
Days to suppress duplicate credit-card notifications |
|
28 |
Days until extended payback window opens (4 weeks) |
|
42 |
Days until extended payback window closes (6 weeks) |
|
|
State of the |
|
|
Master switch for Segment notification dispatch |
Related Pages
-
Architecture — Lambda inventory and system context
-
DynamoDB Tables — Table schemas and access patterns
-
PostgreSQL Schema — RDS table schema and connection configuration
-
Event Flows — EventBridge rule definitions and routing
-
Feature Flags — GrowthBook flags that modify Lambda behavior at runtime