AWS Builder Center

The AWS Side of My AI Setup: Queues, Lambda Workers, MCP Connectors and a Bill on Demand

Part 2: how the setup actually runs on AWS - SQS queues and Lambda workers for heavy jobs, IAM roles instead of keys, an MCP connector that lets my assistant call AWS directly, and cost reports on demand.

CTO @ UJJI AI
In Part 1 I described how I talk to an assistant on WhatsApp, how requests and answers travel as files in private GitHub repositories, and how two Claude tenants, one personal and one for work, do the heavy lifting on their own sides. This second part is about what sits behind that setup on AWS, and about the two ways AWS shows up in my daily use: asynchronous workers, and a connector that lets my assistant talk to AWS directly.

Heavy work goes through a queue

Not everything I ask for can or should be answered while a chat is waiting. When the work is heavier, it runs asynchronously on AWS. Producers drop messages into an Amazon SQS queue, and an AWS Lambda function consumes them.
I want to be precise about why this pair works so well, and I will describe it as the services are documented, not as a claim about every setting of my own deployment.
SQS is a managed queue: producers and consumers never talk to each other directly, so a slow job cannot block the part of the system that accepted the request. Lambda connects to SQS through an event source mapping. Lambda itself polls the queue, reads messages in batches and invokes the function with each batch, so there is no polling loop for me to write or keep running. Scaling follows the queue: more waiting messages lead to more concurrent invocations, within the configured limits.
Two documented behaviors shape how a worker should be written. First, SQS standard queues deliver at least once, so the same message can occasionally arrive twice, and the worker has to be idempotent: processing a message again must not cause a second side effect. Second, a message stays invisible to other consumers only for the visibility timeout. If a function fails or runs too long, the message becomes visible again and is retried, so the visibility timeout should comfortably exceed the function timeout. Lambda also supports partial batch responses, which let a function report only the failed messages of a batch instead of forcing the whole batch to be retried. For messages that keep failing, SQS offers dead-letter queues, a separate queue where repeatedly failing messages can be moved so they can be inspected instead of looping forever. These are the standard tools for this pattern, and any worker of this kind is built around them.

How a worker reaches other AWS services safely

A Lambda function does not need to carry access keys. It runs with an IAM execution role, and the function receives temporary credentials for that role at runtime. The role's policies define what the function may call, and the same role is what lets the service write its logs and read from the queue it is attached to. The practical consequence is that no long-lived secret has to live in the code or in the repository. Access is granted by policy, so it can be reviewed and changed without touching the function. That is the mechanism by which my worker reaches other AWS services safely.

A second path: the MCP connector in Claude

The other way AWS enters my setup is a connector in Claude. The Model Context Protocol is an open standard that lets an AI application connect to external systems through tools that a server exposes. With a connector in place, my assistant does not just describe AWS, it can call AWS services on my behalf from the conversation. The queue and Lambda path is for background jobs. The connector path is for the moments when I want to ask something and get an answer right away.

Billing on demand

The use I value most is small and concrete. With the assistant connected to AWS, I can ask for my current bill in chat and receive a detailed report back. This is the real cost already incurred, not a forecast.
The mechanics behind this are those of AWS Cost Explorer, which lets you view and analyze incurred cost and usage and break it down by dimensions such as service, region or tag, over daily or monthly periods. Cost data is not instantaneous, so it can lag slightly behind the current moment, and forecasting is a separate feature from reading what has actually been spent. For reasons of privacy I am not showing figures from my own bill here. What matters is the workflow: a question in plain language, an answer built from the account's real cost data, no console login and no spreadsheet.

How the pieces fit together

The diagram below shows the full picture. On the left is the path from Part 1: I write on WhatsApp, the assistant turns the request into a file in a private GitHub repository, and Claude reads it and writes its answer back to the same repository. On the right is the AWS side: producers feed SQS, Lambda consumes the queue and reaches other AWS services through its IAM role, and Claude, through the MCP connector, calls AWS services and reads cost data from billing.
Architecture diagram: WhatsApp and GitHub path to Claude; SQS, Lambda, MCP and AWS Billing


What this setup gives me, and what it does not

The value is not any single service. It is that each concern has the tool designed for it: files in Git for requests that need history and review, a queue and a worker for jobs that should not block a conversation, an execution role so no secret sits in code, and a connector so I can ask AWS questions in the same place where I do everything else. I am deliberately not quoting productivity numbers, because I have not measured them rigorously.
If you are building something similar, start with the queue and the idempotent worker, add the dead-letter queue early, and treat access as policy rather than as keys. The rest builds on that.
If you want to try the assistant side of this setup, here is my invite:  https://app.instinct.com/invite?t=mainchein 

References

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