A lot of the people I love get letters they can't fully read. A bill from a medical billing company, a notice from the school, something from the county. The letter is in English, the deadline is real, and the usual fix is a photo sent to someone on WhatsApp with "¿qué dice esto?".
So I built CartaFácil: you open a link on your phone, take a photo of the letter, and a few seconds later you get a plain-Spanish explanation. Who sent it, what they decided, the date and the amount in big letters, what you have to do, what to bring, the phone number as a "tap to call" button, and (this one matters more than I expected) any free help the letter offers, like an interpreter or a payment plan.
The first real test wasn't a sample. It was a medical bill I had at home. It got the account number, the client number, the phone number and the payment link right. Then my mom tried it, and then a few friends, who found problems I never would have.
It's serverless, I built everything in the AWS console, and each letter costs a fraction of a cent.
This is a learning project, not legal, medical or financial advice. All the letters shown in this post are fake, from fictional organizations.
A single-page app on AWS Amplify sends a photo of a letter to API Gateway and Lambda. Lambda checks a one-person code in DynamoDB and asks Amazon Nova 2 Lite on Bedrock for a structured Spanish explanation. The interesting part was everything the AI got almost right.
🔗 GitHub: github.com/sinai07/cartafacil-aws
| Field | Description |
|---|---|
| 💌 Project Name | CartaFácil – AI Letter Explainer |
| 🚧 Status | Working, tested by me, my mom and a few friends |
| 🎓 Difficulty | Beginner |
| 🧠 AI Model | Amazon Bedrock – Amazon Nova 2 Lite |
| ☁️ AWS Services | Lambda, DynamoDB, API Gateway (HTTP API), Amplify Hosting, Budgets |
| 📍 AWS Region | US East (N. Virginia) – us-east-1 |
| 🖥️ Tooling | AWS Management Console + CloudShell |
| 🐍 Language | Python 3.13 (boto3 only) + one HTML file |
| 🌎 Output | Plain-Spanish explanation of English letters |
| 💵 Cost | About 0.16 cents per text letter, roughly 0.3 cents with a photo |
⬆️ Back to top
index.html, and they type their code. POST /explain). API Gateway applies throttling and CORS.
CloudWatch keeps the logs (only token counts, not the letters), and a Budget sends an email if anything goes above USD 10.
The very first question I had was whether I needed the root user to create a budget. You don't. An IAM user with admin permissions can do it, as long as the root user has turned on "IAM user and role access to Billing information" once (Account settings). If the Budgets page says you don't have billing permissions, that's the switch.
I created a monthly cost budget of USD 10 with an email alert. A budget only warns you; it doesn't stop anything. The real spending cap in this app is the codes (Step 2).
The core is one Lambda function, letter-explainer-fn (Python 3.13, only boto3). It sends the letter to Nova 2 Lite with a system prompt that forces a fixed JSON shape: sender, decision, date, time, amount_due, reference_numbers, place, contact, what_to_do, requirements, how_to_comply, links, phone_numbers, help_available, if_you_dont_comply, urgency and key_terms.
The code and field names are in English; the explanation is in Spanish. The language is just an environment variable, OUTPUT_LANGUAGE, so another community (Portuguese, Haitian Creole) is a one-field change.
These rules in the prompt mattered most:
- Never invent anything. If a detail is not in the letter, write exactly: NOT_IN_LETTER
- LINKS: include ONLY web addresses that are written in the letter, copied character by
character. NEVER invent, complete or guess a link, even if you know the official site.
- HELP: look carefully for any help the letter offers (free interpreter or translation,
payment plan, financial assistance, deadline extension, accommodations)...
I also gave the function the minimum permission it needs: an inline policy that can call only Nova 2 Lite.
{
"Version": "2012-10-17",
"Statement": [{
"Sid": "InvokeNova2LiteOnly",
"Effect": "Allow",
"Action": "bedrock:InvokeModel",
"Resource": [
"arn:aws:bedrock:*:*:inference-profile/us.amazon.nova-2-lite-v1:0",
"arn:aws:bedrock:*::foundation-model/amazon.nova-2-lite-v1:0"
]
}]
}
And I raised the timeout from the default 3 seconds to 30 seconds. A letter takes about 2 seconds, but the default would cut it off.
I tested with two fake letters: a past-due water bill and a note from a school. Every round, the AI got the facts right, and every round I still found something a real person would miss.
The fix for that last one was simple: the AI writes only the date, and the code adds the weekday:
def _fix_weekday(date_text):
"""LLMs are bad at calendar math (in testing, Nova called Tuesday Nov 24, 2026
a Friday). So the code computes the weekday from the original date in
parentheses and writes it itself."""
...
parsed = datetime.strptime(original, fmt)
weekday = _SPANISH_WEEKDAYS[parsed.weekday()]
After that, both letters came back complete. Each one used about 1,150 input tokens and 400-500 output tokens.
A funny moment: I came back to the lab the next day, saw Spanish in the Lambda console and asked for everything to be in English. Then I remembered that explaining English letters in Spanish is the whole app. The code stayed in English; the explanation stayed in Spanish.
Without a limit, anyone who found the URL could use the app as much as they wanted, and every letter costs money. So each person gets a code with 4 uses, stored in a DynamoDB table:
| code | friend | uses_left | active |
|---|---|---|---|
| CARTA-ANA | Ana | 4 | true |
The Lambda checks the code before calling Bedrock, with one atomic operation:
dynamodb.update_item(
TableName=CODES_TABLE,
Key={"code": {"S": code}},
UpdateExpression="SET uses_left = uses_left - :one",
ConditionExpression="attribute_exists(code) AND active = :yes AND uses_left > :zero",
...
)
DynamoDB subtracts the use only if the code exists, is active and still has uses left. Two letters sent in the same second can't both spend the last use. If Bedrock fails after the use is spent, the Lambda gives it back. And if a code gets shared in a group chat, I set active to false and nobody else is affected.
I didn't want to edit the Bedrock policy (its name says "Bedrock only"), so the role got a second inline policy, DynamoDBCodesOnly, with exactly one action: dynamodb:UpdateItem on this one table. One policy per job, named after what it allows.
Then I spent the four uses. The first letter left 3, the fourth left 0, the fifth got a 403, and a made-up code got a 403 without ever reaching Bedrock:
Both errors use the same message on purpose: "Invalid code, inactive, or no uses left." If the message said "this code doesn't exist", someone could try codes until they found real ones.
APIs were the part I understood least going in, so here's the way it finally clicked for me. Think of a restaurant: the web page is the customer, the Lambda is the kitchen, and API Gateway is the waiter. The customer never walks into the kitchen; they give their order to the waiter, who brings back the answer.
I created an HTTP API, the simpler and cheaper type (REST APIs add things like caching and API keys that I didn't need), and set four things:
GET, gets a 404 and never reaches the Lambda.$default stage.*) for testing and locked it in Step 4.
Two things tripped me up. After creating the API, the console opened the Routes page and I couldn't find the URL anywhere; it's on the API's main page, in the Stages table. And in the CORS screenshot below you can see "No headers are allowed": I typed content-type but never clicked Add. My tests still passed because curl ignores CORS, so I only caught it in Step 4.
Then I tested from CloudShell with curl, the same way the page would call it:
curl -s -X POST "$URL/explain" \
-H "Content-Type: application/json" \
-d '{"code":"TEST-7K2P","letter_text":"MAPLE RIDGE ELEMENTARY SCHOOL ..."}' \
| python3 -m json.tool --no-ensure-ascii
| Test | Result |
|---|---|
| Real letter + valid code | 200 with the full explanation and"uses_left": 3 |
| Fake code | 403 , rejected before Bedrock |
GET instead ofPOST |
404 Not Found , the Lambda never ran |
The response through API Gateway looks different from the Lambda console. There it was wrapped (statusCode, headers, and an escaped body); here it's clean JSON, because the HTTP API unwraps the proxy response into a real HTTP status, headers and body.
The page is a single index.html, no frameworks. The first version had an airmail-envelope design; I didn't like it. I wanted something that looks like the apps people already use, so the final one has soft lavender, mint and coral, rounded cards, emoji icons, and the "✨ Explicar mi carta" button pinned to the bottom like in a phone app.
To deploy it, I replaced <YOUR_API_ID> in index.html with my Invoke URL, zipped the file, and used Amplify > Deploy without Git.
Then I locked CORS: Access-Control-Allow-Origin changed from * to the exact Amplify URL (with https://, no trailing slash). That's when I saw the missing content-type header from Step 3. Without it, the browser would have blocked every request with a CORS error, even though all my curl tests had passed.
The moment of truth was my own medical bill, photographed with my phone. It read the account number, the client number, the phone number and the payment link correctly. The link was long and overflowed the button on my phone, so I fixed the CSS to wrap long links.
| Case | Expected | Result |
|---|---|---|
| Water bill (text, console) | Amount, deadline, account number, payment link, payment plan | ✅ after three prompt rounds |
| School letter (text, console) | Date, time, contact, reschedule phone, free interpreter | ✅ after round 2 |
| Weekday of a deadline | Correct weekday | ❌ model said Friday for a Tuesday → ✅ computed in code |
| Code with uses left | 200 , uses go down by 1 |
✅ |
| Code with 0 uses | 403 , no Bedrock call |
✅ |
| Fake code | 403 , no Bedrock call |
✅ |
GET /explain |
404 from API Gateway |
✅ |
| Real photo of a real bill, on a phone | Correct numbers and link | ✅ (link overflowed the button, fixed in CSS) |
| Friends taking photos | Camera opens | ❌ with one button → ✅ with two buttons |
I configured throttling but didn't load-test it.
| Problem | Cause | Fix |
|---|---|---|
| Budgets says I don't have billing permissions | IAM access to billing is off by default | Root user: Account > "IAM user and role access to Billing information" > Activate |
| Couldn't find the Invoke URL | The console opens on Routes after creating the API | API main page > Stages table, or Deploy > Stages |
| CORS header missing after saving | Typed content-type but didn't clickAdd |
Configure > add it as a chip > Save |
| Friends still saw the old page | Old version still deployed / cached | Amplify > Deploy updates with the new zip, then close and reopen the tab |
| Long payment link overflowed the button | No wrapping on long words | overflow-wrap: anywhere andmin-width: 0 on the text |
| "I can't take a photo" | One button opened a chooser; some opened the link in an in-app browser | Separate camera and gallery buttons, in-app browser warning |
| Wrong weekday | The model did calendar math | Weekday computed with datetime |
I'm keeping the app running for my friends. If you build it to learn, delete everything in this order:
| Order | Resource | Where |
|---|---|---|
| 1 | Amplify app letter-explainer-web |
Amplify > App settings > General > Delete app |
| 2 | HTTP API letter-explainer-api |
API Gateway > APIs > Delete |
| 3 | Lambda letter-explainer-fn |
Lambda > Functions > Actions > Delete |
| 4 | IAM role letter-explainer-fn-role-... (with both inline policies) |
IAM > Roles > Delete |
| 5 | Log group /aws/lambda/letter-explainer-fn (not deleted with the function) |
CloudWatch > Log groups > Delete |
| 6 | DynamoDB table letter-explainer-codes |
DynamoDB > Tables > Delete |
| 7 | Budget letter-explainer-budget (optional) |
Billing > Budgets > Delete |
✅ Correct is not the same as useful. The model copied every fact right in the first round, but it didn't know that a free interpreter matters more to this audience than an account number. I had to tell it what the people using it care about.
📨 Test with more than one kind of letter. The school letter looked perfect; the water bill exposed the missing account number. Each type of letter stresses different fields.
🧮 Don't let the model do math. It invented a wrong weekday for a payment deadline. Anything that can be calculated (weekdays, totals, days left) belongs in code.
👩👧 Real users find real problems. I never would have guessed that "take or choose a photo" was confusing. My friends found it in a few hours.
📝 What I'd tell myself before starting: keep one notes file with every URL, ID and code from the start. I lost time looking for the Invoke URL and re-sending files.
| Limitation | Improvement |
|---|---|
| Links read from a photo can't be checked against text | Run Amazon Textract first and filter links against the extracted text |
| Name-based codes are easy to guess | Random suffix ( CARTA-ANA-7K2P ) |
| One page per letter | Multi-page letters, PDF upload |
| No history | Optional "save this explanation" for the person, with their consent |
| Spanish only | OUTPUT_LANGUAGE per code, so each person picks their language |
💬 What kind of letter would you try first? And if you've built something for your own family or community on AWS, I'd love to read about it in the comments.
🔗 Everything is on GitHub: github.com/sinai07/cartafacil-aws
📄 Full Lambda code: lambda/lambda_function.py
📄 DynamoDB policy (iam/iam-policy-dynamodb.json):
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "SpendCodeUsesOnly",
"Effect": "Allow",
"Action": "dynamodb:UpdateItem",
"Resource": "arn:aws:dynamodb:us-east-1:*:table/letter-explainer-codes"
}
]
}
The web page (web/index.html) is in the repo. Replace <YOUR_API_ID> with your own Invoke URL id before deploying it.