AWS Builder Center
Weekend Productivity Challenge: TriageIQ

Weekend Productivity Challenge: TriageIQ

An AI-powered incident triage tool built on Amazon Bedrock. Paste a raw log or alert, get an instant severity rating, root cause, and first 3 response steps in under 2 seconds.

AI Operations at XLSMART

Vision & What the App Does

On-call engineers face a brutal first-minutes problem during incidents. When a Falco alert fires at 2am or a CloudWatch alarm triggers mid-deploy, the first question is always the same: how bad is this, and where do I look first? Assessing severity, forming a hypothesis about root cause, and deciding which logs to pull is the highest-leverage and most cognitively loaded part of incident response. It is also the part most likely to go wrong under pressure. A misclassified severity means the wrong people get paged, the wrong runbook gets followed, and precious minutes get wasted while an active exploit continues running.
TriageIQ is a single-page tool that takes a raw log excerpt or alert payload and returns an instant structured triage card. It accepts CloudWatch alarm JSON, Falco security alerts, auth service errors, or any plain text. The output is a severity rating (Critical / High / Medium / Low), a likely root cause category, and the first 3 recommended investigation steps. No login, no setup, no context switching to a different tool. Paste the log, click Analyze, get a triage card in under 2 seconds.

The prompt is grounded in real incident patterns: RCE forensics via framework error digests, SSRF to cloud metadata endpoints, brute force credential attacks, sensitive file reads by non-trusted processes, SQL injection, IDOR, and path traversal. The severity guidelines are deliberately strict. A CloudWatch CPU alarm at 98% is Medium because no exploitation is confirmed. A Next.js error digest leaking  uid=1001(www-data)  is Critical because OS command output in an application error means RCE is confirmed. The goal is to compress the first 5 minutes of triage into 5 seconds so responders can act faster and with more confidence.



How I Built It

I started with the core loop before writing any UI or infrastructure. The first thing I built was a raw boto3 call to Amazon Bedrock from a local Python script with no Lambda and no API Gateway, just confirming that the model could take a log as input and return structured JSON. Choosing Nova Micro ( amazon.nova-micro-v1:0 ) was straightforward. Nova Micro is the cheapest Nova model at roughly $0.000035 per 1K input tokens, has low latency, and is more than capable for structured classification tasks.
The key prompt engineering challenge was getting consistent JSON output across diverse log formats. Asking the model to "return JSON" in the user message is not reliable because the model will sometimes wrap the output in markdown code fences or add an explanation. The solution was to define the exact output schema in the system prompt, include concrete examples with expected outputs, and set temperature to 0.1. With that combination, the model returns a clean JSON object every time. I also added per-attack-type indicator sections to the system prompt covering SSRF, RCE, SQLi, XSS, IDOR, XXE, and path traversal, each with explicit severity mapping so the model has unambiguous signal rather than having to infer from general knowledge.
All infrastructure is provisioned with Terraform for repeatable apply and destroy. The IAM role is scoped narrowly to  bedrock:InvokeModel  on the Nova Micro ARN plus basic CloudWatch Logs permissions with no wildcard actions and no wildcard resources. I hit a CORS issue on the first browser call to API Gateway. The fetch was silently failing with no useful error until I opened the network tab and saw the missing  Access-Control-Allow-Origin  header. The fix was adding an explicit  cors_configuration  block to the  aws_apigatewayv2_api  Terraform resource. I also learned not to test a freshly applied CloudFront distribution immediately because propagation takes 10 to 15 minutes and hitting the URL before it is ready returns a 403 that looks like a misconfiguration.

The frontend is a single HTML file with no framework and no build step. Severity badges are color-coded so Critical shows in red, High in orange, Medium in yellow, and Low in green, which makes the output immediately readable at a glance. The API endpoint URL is injected at deploy time via  sed  in the Makefile so the source file never contains a hardcoded URL. Deploying is a single command:  make deploy-frontend .





AWS Services Used / Architecture

Browser
|
|-- HTTPS GET --> CloudFront --> S3 (index.html)
|
└-- POST /triage --> API Gateway --> Lambda (Python) --> Bedrock (Nova Micro)

  • Amazon Bedrock (Nova Micro,  amazon.nova-micro-v1:0 ) takes raw log text and returns structured JSON with severity, root cause, and response steps.
  • AWS Lambda (Python 3.12) calls  bedrock-runtime  InvokeModel, parses the response, and returns triage JSON with CORS headers.
  • Amazon API Gateway (HTTP API) is the public HTTPS endpoint for the frontend with CORS configured to allow POST from any origin.
  • Amazon S3 hosts the static  index.html .
  • Amazon CloudFront sits in front of S3, enforces HTTPS, and handles global distribution.
  • AWS IAM provides a least-privilege execution role with  bedrock:InvokeModel  scoped to the Nova Micro model ARN plus  logs:CreateLogGroup ,  logs:CreateLogStream , and  logs:PutLogEvents .
  • Terraform provisions all 13 resources as code.  make apply  to stand up,  make destroy  to tear down cleanly.




What I Learned

Bedrock InvokeModel request and response format. The boto3  bedrock-runtime  client wraps the model-specific payload inside a generic envelope. For Nova models, the request body uses a  messages  array with a  system  field separate from the conversation, which is different from the OpenAI-style format. Reading the response also requires calling  .read()  on the streaming body before JSON parsing.
Prompt engineering for reliable structured output. Explicit schema in the system prompt plus low temperature (0.1) is far more reliable than asking for JSON in the user message. Adding concrete examples with expected outputs dramatically reduces misclassification on edge cases.
IAM resource ARN format for Bedrock foundation models. The ARN format is  arn:aws:bedrock:{region}::foundation-model/{model-id}  with a double colon before  foundation-model  because there is no account ID in the ARN. Easy to get wrong the first time.
API Gateway CORS in Terraform. The  cors_configuration  block goes on the  aws_apigatewayv2_api  resource, not on the route or integration. Missing it causes browser fetches to fail silently and the error only shows up in the network tab.
CloudFront propagation delay. A freshly applied CloudFront distribution takes 10 to 15 minutes before it is globally available. Testing immediately after  terraform apply  returns a 403 that looks like a permissions issue but is actually just propagation lag.
Terraform  archive_file  for Lambda packaging. Using the  archive_file  data source with  source_dir  is cleaner than running a shell command to zip the source. It also makes the zip path deterministic so Terraform correctly detects when the Lambda source has changed and triggers a redeployment.



Link to Repo


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