
From Slack Bot to Web App: What I Learned Running Kiro CLI Headless on AWS
Kiro CLI can run without a person at the keyboard, but making it safe, repeatable and affordable takes more than a sample. I extended the aws-samples Kiro ChatOps Slack integration into a web app on AWS. It has multi-turn chat, a diff you review before anything is pushed, per-person credit tracking and one-command deploy and teardown. This post shares eight lessons, including why a cloned repository must be treated as untrusted input and why an idle server is the real cost.
BUILDER'S NOTES • KIRO CLI • AWS
Taking Kiro CLI headless
What I learned turning a Slack ChatOps sample into a web app on AWS
By Diptanu Roy • November 2026
Built on a solid foundation. This solution builds on aws-samples/sample-kiro-chatops-slack-integration ( https://github.com/aws-samples/sample-kiro-chatops-slack-integration ), an AWS sample released under the MIT-0 license. It showed that Kiro CLI can run unattended in an AWS Lambda container, started from a Slack slash command through API Gateway and two Lambda functions. I kept that dispatcher-and-worker shape and extended it so that Kiro CLI runs headless behind a web interface: multi-turn chat, file edits that you review before they are pushed, credit monitoring, and a one-command deployment. My thanks to the authors of the original sample. |
|---|
In short: Kiro CLI can run unattended in AWS Lambda, but turning it into a safe, repeatable web app took more than the original sample covers. The biggest surprise was that a cloned repository can make Kiro start programs on the machine (lesson 4). The biggest AWS cost was an idle web server, not Kiro or Lambda (lesson 8). Terms such as Lambda and DynamoDB are explained in the glossary near the end.
The original sample answers one question at a time and posts the result to Slack. It proved that Kiro CLI works without a person at the keyboard, which made it a perfect starting point. I wanted more: a conversation that remembers what Kiro just changed, a diff to review before anything touches the repository, a push to a branch, a view of each person's Kiro credit use, and an environment I could tear down and rebuild at will. I replaced Slack with a Streamlit page and kept the rest of the pipeline serverless. Below are the lessons I learned, in the order I ran into them.
What I built

Figure 1. Browser → CloudFront → Streamlit on Elastic Beanstalk → API Gateway → dispatcher Lambda → worker Lambda running git and Kiro CLI. State lives in DynamoDB and S3.
| The sample | This solution |
|---|---|---|
Entry point | Slack slash command | Streamlit UI on Elastic Beanstalk (Docker) behind CloudFront, with Cognito sign-in |
What Kiro may do | Read and analyse a repository | Read and write inside the clone only; changes are shown as a diff and pushed on request |
Results | One message posted to Slack | Live progress and results through DynamoDB; changes kept as patches in S3 |
Conversation | Single shot | Follow-ups build on changes that are not pushed yet |
Monitoring | CloudWatch logs | Per-job Kiro credit ledger, CloudWatch dashboard, optional daily alarm |
Deployment | SAM guided deploy | One command per environment, full teardown and rebuild, mandatory resource tags |
Eight things I learned
1. Headless Kiro needs an API key, a writable home folder, and nothing else
With a Kiro API key in the environment,
kiro-cli chat --no-interactive ran on a machine that had never been logged in; I confirmed it with an empty home directory. In Lambda the only writable place is /tmp , so the worker sets HOME=/tmp/home before anything starts. I install a pinned release of the headless Linux package and verify its published SHA-256 at build time, so a rebuild can never pick up a different CLI by surprise.2. Ask for structured output; it turns guesses into measurements
The
--output-format stream-json option reports every event as a JSON line: text chunks, tool calls, and, at the end of a turn, the credits used and the duration. That one switch gave me live progress in the UI and exact credit numbers per question (in testing, about 0.05 credits for a short question on a small repository, up to about 1.3 for a larger edit). It also exposed a trap: an invalid API key is reported as an error event while the process still exits with code 0, so checking the exit code alone would call a failed run a success.3. Non-interactive mode denies by default. Decide your permissions on purpose
With nobody to approve a prompt, Kiro refuses to write files. The quick fix is to trust every tool, which I rejected. Instead the worker writes a small agent configuration for each job that allows file tools only inside the cloned repository and denies the
git and .kiro folders (below). I then tried to break it: a write outside the clone, a path traversal, a symlink, and a git hook were all blocked. One caution from that testing: some early "blocks" were just the model politely declining. I only counted a control as proven when a neutral prompt was stopped by the tool itself."tools": ["fs_read", "fs_write"],
"allowedTools": [],
"toolsSettings": {
"fs_read": { "allowedPaths": ["<clone>/**"] },
"fs_write": { "allowedPaths": ["<clone>/**"],
"deniedPaths": ["<clone>/.git/**", "<clone>/.kiro/**"] } } |
|---|
4. A repository is untrusted input, and Kiro reads project settings from the folder it starts in
This was the most important finding: treat every repository as untrusted input. When Kiro was launched inside a cloned repository, a
.kiro/settings/mcp.json file in that repository started an arbitrary program on the machine, even though my agent did not list any MCP servers. The fix is structural: Kiro now starts one folder above the clone and addresses it by path. I also keep the Git token away from Kiro entirely. Git receives it through GIT_ASKPASS , so it never appears in a URL, in .git/config , or on a command line. In addition, the token is only sent to an allow-listed host, redirects are disabled, git hooks are switched off, and a fingerprint of the git settings is checked before the app runs git in a folder Kiro could write beside.5. Lambda has no memory, so put the state somewhere else
The worker cannot hold a conversation, so each job is a row in DynamoDB. The worker updates the row every two seconds with Kiro's output so far, and the UI polls it, which keeps the streaming feel. Edits are saved as a binary-safe patch in S3; the diff you review is that patch, and pushing is a second job that applies it to a fresh clone, commits and pushes. A follow-up question re-applies the earlier patch first, so changes accumulate without ever being pushed. Two small settings mattered more than expected: I turned off Lambda's automatic retry for asynchronous calls (a retry would repeat Kiro's work, or a push), and I build the image as a plain single manifest without provenance attestations, so Lambda is never handed a multi-manifest image.

Figure 2. A read-only question against a public repository. The answer streams in and the credits used are shown beneath it.
6. A successful stack is not a working app
Elastic Beanstalk's Docker platform suits a Streamlit app well, with two details. WebSockets must pass through CloudFront, which needs caching off and all viewer headers forwarded; I verified the upgrade with an HTTP 101. The instance's security group admits only CloudFront's address list. Then came the lesson in the title: my first deployment was rolled back because the entrypoint script lacked its execute bit, yet CloudFormation reported success. A "fix" I added for a different problem, a hook that called the EC2 API, timed out in a VPC with restricted endpoints, and turned out to be unnecessary. The deploy script now checks the environment's version and health and calls the app's health URL through CloudFront before it says "Deployed".
7. Repeatable means you can destroy it and get it back
Every environment is one JSON file, images are tagged with a hash of their source, and
deploy.py --delete-all removes everything while deploy.py rebuilds it. I proved it on an isolated copy of the whole solution under a different project prefix: build from nothing (about 16 to 17 minutes), run a job, tear down (about 8 minutes), then build again. After each teardown I searched 15 kinds of AWS resource for leftovers and found none. Sandbox tag rules arrived mid-project: stack tags reached nearly everything, but the Beanstalk application and the instance profile needed tagging directly, which I verified with the Resource Groups Tagging API.8. Measure the bill; the idle server is the cost
The always-on web server, not Kiro or Lambda, drives the AWS bill. Cost Explorer showed a flat $1.16 a day for the tagged resources, with the server running 234 of the last 240 hours, while the worker had been invoked 19 times in 30 days. The parts that scale with use (Lambda, API Gateway, DynamoDB) cost effectively nothing at this volume. At current list prices the always-on setup is about $41 a month, of which roughly $36 is the web server, its disk and its public address; the measured $1.16 a day is about $35 a month, so the two figures are in the same range. Running the server only one or two hours a day would bring the total near $8, an estimate for a pause feature I have not yet built. Kiro credits are billed separately by Kiro, on top of the AWS figure.

Figure 3. After an edit, the changes wait for review. Nothing is pushed until "Commit and push" is clicked. The sidebar shows the user's credit usage.
By the numbers
Day-to-day operation comes down to a few single commands: deploy or rebuild an environment, check its status, invite a user, see Kiro credit use per person, and delete everything. The code is not publicly shared; the original AWS sample is the best place to start. The figures below come from my own testing.
Size of the project | About 3,900 lines: 2,811 of Python and roughly 1,000 of CloudFormation (50 resources in 3 stacks) |
|---|---|
Build from nothing / tear down | About 16 to 17 minutes / about 8 minutes, measured twice on an isolated copy |
Kiro credits per question | About 0.05 for a short read-only question; up to about 1.3 for a larger edit (small test repositories) |
AWS cost, always on | About $41 a month at list prices; $1.16 a day measured by Cost Explorer |
What I would do next
Next, I would add an automated test suite, a pause and resume command for the web server, and multi-factor authentication on the Cognito pool. As with the original sample, treat this as sample code and review it against your own security requirements before wider use; Kiro's answers are AI-generated and should be checked.
Acknowledgements. Thank you to the authors of aws-samples/sample-kiro-chatops-slack-integration ( https://github.com/aws-samples/sample-kiro-chatops-slack-integration ), whose design for running Kiro CLI inside Lambda is the foundation of this work. The solution was built and tested with Kiro itself. |
|---|
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article