AWS Builder Center
From "Will the bank say yes?" to a live AWS advisor: building Rural Financial Advisor

From "Will the bank say yes?" to a live AWS advisor: building Rural Financial Advisor

We built Rural Financial Advisor, a web app that tells first-time rural entrepreneurs in India how much loan they can realistically get, which government scheme fits, and whether the EMI is affordable. It runs live on Amazon EC2 with an IAM role and an Amazon Bedrock integration. Bedrock access was blocked on our new account, and this post covers how we built around that.

The problem

Picture someone in a village who wants to start a dairy unit, a tailoring shop or a cold-storage business. They don't know how much a bank will actually sanction, whether PM Mudra or PMEGP fits their project, or whether they can repay the EMI. Bank forms and scheme rules are hard to read, and a wrong guess means a rejected application or a repayment that eats the whole household budget.
We wanted to give them a straight answer before they walk into the bank.
What it does
The user enters five things: location, business idea, own capital, monthly cash flow, tenure and category. The app then:
  1. Sizes the loan: maximum safe loan, project budget and monthly EMI, keeping repayment under a 50% fixed-obligation-to-income (FOIR) cap.
  1. Matches a government scheme (PM Mudra tiers or PMEGP Rural) and shows the subsidy.
  1. Rates credit risk as low, moderate or high, with a debt-service coverage ratio (DSCR).
  1. Generates an advisory dossier: a viability verdict, local demand, SWOT, stress test and a 90-day launch roadmap.
  1. Answers follow-up questions in a chat about Mudra sanction, DIC endorsement and subsidy release.
In one of our demo runs, a dairy and milk-chilling unit in Varanasi came out with a maximum safe loan of ₹14,50,928, a ₹17,00,928 project budget and a ₹37,500 monthly EMI at 11% over four years. It matched PMEGP (Rural) with a 25% subsidy of ₹4,25,232 and a DSCR of 1.50x. These are illustrative estimates, not a bank sanction.

The design decision that mattered most

Language models are bad at arithmetic, and a wrong loan figure is worse than no figure. So we split the system in two:
  • A Spring Boot backend is the source of truth for every number: loan, EMI, scheme, risk. It's deterministic and testable.
  • A FastAPI AI service only explains numbers the backend has already validated. It builds prompts from those figures and returns a structured advisory, so the model can't invent a loan amount.

Architecture

Browser → nginx + React (port 80)
├─ /api → Spring Boot :8080 → PostgreSQL
└─ /ai → FastAPI :8000 → Amazon Bedrock (Converse API)
Everything runs as four Docker Compose containers on a single Amazon EC2  t3.small  in Mumbai (ap-south-1). Only port 80 is public; the database and services stay on a private Docker network.

How we used AWS

  • Amazon EC2: Amazon Linux 2023,  t3.small , with a 2 GB swap file so Spring Boot and the other containers fit in 2 GB of RAM.
  • AWS IAM: the instance has an IAM role ( scaleops-ec2-role ). The AI service picks up temporary credentials through boto3's default credential chain, so no AWS keys are stored in code, in the repo or on the server.
  • Amazon Bedrock: the AI service calls Amazon Nova Pro through the model-agnostic Converse API. Changing models is one environment variable ( BEDROCK_MODEL_ID ), not a code change.

What fought back

1. Containers couldn't see the IAM role. Credentials worked on the host but not inside Docker, until we raised the instance metadata response hop limit to 2. Containers add a network hop, and the default limit of 1 silently blocks them.
2. Memory. A 2 GB instance running Spring Boot, PostgreSQL, a Python service and nginx is tight. Adding swap fixed the crashes.
3. The console showed an empty account. The AWS console opened in N. Virginia and showed zero instances and $0.00, while our server was in Mumbai. For a moment it looked like our deployment had vanished. It hadn't; we were in the wrong region.
4. Bedrock said no. Every Converse call returned  ValidationException: Operation not allowed , even though the IAM role was assumed correctly and our billing was verified. That combination points to an account-level restriction on a new account, and only AWS Support can lift it. We opened a case. The error message gives no reason and no timeline, which was the most frustrating part of the whole build.

How we handled the Bedrock block

Because the backend owns the numbers, the app never depended on the model to work. We built an automatic rule-based fallback in the AI service. If a Bedrock call fails, the app still produces an advisory dossier and chat replies from templates, and logs  Falling back to synthetic . To be clear about the current state: the advisory text on our live demo is template-based, not model-generated. The Bedrock integration is implemented and deployed, and when AWS lifts the restriction the same deployment will switch to Nova Pro with no code change.

What we'd do next

  • Move the deployment behind HTTPS, add backups, and scope the IAM policy down from the hackathon-level Bedrock access.
  • Add a container restart policy. At one point our containers were stopped and the site was unreachable until we brought them back with  docker compose up -d . A  restart: unless-stopped  setting would have prevented it.
  • Add regional languages, since the users we care about most often prefer Hindi or Punjabi.
  • Connect real scheme data and bank branch information instead of static rules.

Try it

Live demo:  http://3.110.177.209  GitHub:  https://github.com/iJapmanSingh/rural-financial-advisor  Team scaleOps: Japman Singh (backend, integration, AWS deployment), Harshpreet Kaur (frontend), Jaspreet Kaur (AI service).
Loan figures, subsidy percentages and risk bands are illustrative estimates, not financial advice or a bank sanction.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article