<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: mgbec</title>
    <description>The latest articles on Forem by mgbec (@mgbec).</description>
    <link>https://forem.com/mgbec</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F804344%2F879b6389-ae74-4292-8af2-50c2376d5aec.png</url>
      <title>Forem: mgbec</title>
      <link>https://forem.com/mgbec</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mgbec"/>
    <language>en</language>
    <item>
      <title>Go Ahead and Judge Me- Agent Evaluators in AWS AgentCore</title>
      <dc:creator>mgbec</dc:creator>
      <pubDate>Sun, 25 Jan 2026 19:28:37 +0000</pubDate>
      <link>https://forem.com/aws-builders/go-ahead-and-judge-me-agent-evaluators-in-aws-agentcore-1lfl</link>
      <guid>https://forem.com/aws-builders/go-ahead-and-judge-me-agent-evaluators-in-aws-agentcore-1lfl</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh5k7tx5533ybbiznew1g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh5k7tx5533ybbiznew1g.png" width="707" height="674"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What do we want to see out of our GenAI projects? Your project is going to need to function well, be cost effective, and safe to run, not only on a component level, but as a whole. And we would want this to continue for the lifespan of our application, correct? Not much to ask, not at all. Well … maybe a little easier said than done.&lt;/p&gt;

&lt;p&gt;Two of the elements that will help make for a successful long term GenAI project are evaluations and observability. By adding agents into our workflows, we add more objects to assess, possibly producing more barriers to clarity with both of these sets of metrics. With as many moving parts as agentic projects can have, your evaluations and observability measurements can reproduce like Tribbles.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9limghkzdqj7cowez2ao.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9limghkzdqj7cowez2ao.png" width="330" height="241"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What and Why?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
What are evaluations and observability, and why do we need to look at them? Evaluations and observability are both necessary, and complementary elements. Huggingface has a nice explanation of what they consider the difference to be: &lt;a href="https://huggingface.co/learn/agents-course/en/bonus-unit2/what-is-agent-observability-and-evaluation." rel="noopener noreferrer"&gt;https://huggingface.co/learn/agents-course/en/bonus-unit2/what-is-agent-observability-and-evaluation.&lt;/a&gt; Observability typically refers to what has happened inside your agent, like latency and model usage. Evaluation does something with the gathered metrics, analyzing and performing testing to determine agent performance on a number of levels. We will track both observability and evaluations over time to make sure we are producing a good agentic ecosystem and making continual improvement, if necessary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What specifically do you want to measure?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
This will depend on your use case and data. Using agents in the medical industry will require more robust evaluations and observability than your fun side project, of course. AWS AgentCore has some predefined metrics you can use to jumpstart your project for both categories. I’ve talked about AgentCore Observability before in a previous article, so I will cover evaluations a little more now.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Evaluation- deterministic vs non-deterministic&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
There are several ways to categorize evaluators with different capabilities. Anthropic breaks this down into code based graders, model based graders and human evaluators. &lt;a href="https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents" rel="noopener noreferrer"&gt;https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents&lt;/a&gt;. Code based graders can be considered a little more deterministic. For example, we can run code against predefined test cases, like unit and integration testing. We can run exact match and schema validation. There are also many well known metrics-based checks, like those for latency and cost.&lt;/p&gt;

&lt;p&gt;On the other hand, some evaluations of agentic workflow are less easy to perform deterministically. In that case we may need to use LLM models and/or humans to evaluate things. Since human evaluation is difficult to scale, we will try models as evaluators in as many cases as possible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AgentCore Evaluations&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
AWS AgentCore has a newer capability to add in agent evaluation using LLM as a judge on a number of parameters, with preconfigured settings. There are evaluators available for trace level judgement, session level judgement, as well as at the tool call level.&lt;/p&gt;

&lt;p&gt;The preconfigured ones available at this point are: (if not noted, they are at the trace level)&lt;/p&gt;

&lt;p&gt;Response quality metrics:&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Builtin.Correctness&lt;/strong&gt; : Evaluates whether the information in the agent’s response is factually accurate&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Builtin.Faithfulness&lt;/strong&gt; : Evaluates whether information in the response is supported by provided context/sources&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Builtin.Helpfulness&lt;/strong&gt; : Evaluates from user’s perspective how useful and valuable the agent’s response is&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Builtin.ResponseRelevance&lt;/strong&gt; : Evaluates whether the response appropriately addresses the user’s query&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Builtin.Conciseness&lt;/strong&gt; : Evaluates whether the response is appropriately brief without missing key information&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Builtin.Coherence&lt;/strong&gt; : Evaluates whether the response is logically structured and coherent&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Builtin.InstructionFollowing&lt;/strong&gt; : Measures how well the agent follows the provided system instructions&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Builtin.Refusal&lt;/strong&gt; : Detects when agent evades questions or directly refuses to answer&lt;/p&gt;

&lt;p&gt;Task completion metrics:&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Builtin.GoalSuccessRate&lt;/strong&gt; : Evaluates whether the conversation successfully meets the user’s goals, runs at Session level&lt;/p&gt;

&lt;p&gt;Tool level metrics:&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Builtin.ToolSelectionAccuracy&lt;/strong&gt; : Evaluates whether the agent selected the appropriate tool for the task, runs at Tool level&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Builtin.ToolParameterAccuracy&lt;/strong&gt; : Evaluates how accurately the agent extracts parameters from user queries, runs at Tool level&lt;/p&gt;

&lt;p&gt;Safety metrics:&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Builtin.Harmfulness&lt;/strong&gt; : Evaluates whether the response contains harmful content&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Builtin.Stereotyping&lt;/strong&gt; : Detects content that makes generalizations about individuals or groups&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Custom Evaluators&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
You are not probably going to be able to cover every evaluation needed for your agent with these, and there is also an option for you to create and apply custom evaluators.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When will these evaluators run?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
You can run “On Demand” evaluations, targeted toward analyzing specific interactions by providing span, trace, or session IDs. You are also able to set up the production level, always on evaluations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Try it yourself:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;a href="https://github.com/awslabs/amazon-bedrock-agentcore-samples/tree/main/01-tutorials/07-AgentCore-evaluations" rel="noopener noreferrer"&gt;https://github.com/awslabs/amazon-bedrock-agentcore-samples/tree/main/01-tutorials/07-AgentCore-evaluations&lt;/a&gt;. This project will walk you through creating some sample agents to evaluate, both Strands and LangGraph. Once your agents are deployed using AgentCore, you will use the built in evaluators, as well as create a custom evaluator. To create a custom evaluator, you will select the model to use and provide instructions to the evaluator on how to determine metrics. The custom evaluator in this project’s notebook uses Claude Sonnet 4.5 with a custom rating scale:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz0oh7qf7y55e82u4tpp3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz0oh7qf7y55e82u4tpp3.png" width="800" height="250"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
 "llmAsAJudge":{
 "modelConfig": {
 "bedrockEvaluatorModelConfig":{
 "modelId":"global.anthropic.claude-sonnet-4–5–20250929-v1:0",
 "inferenceConfig":{
 "maxTokens":500,
 "temperature":1.0
 }
 }
 },
 "instructions": "You are evaluating the quality of the Assistant's response. You are given a task and a candidate response. Is this a good and accurate response to the task? This is generally meant as you would understand it for a math problem, or a quiz question, where only the content and the provided solution matter. Other aspects such as the style or presentation of the response, format or language issues do not matter.\n\n **IMPORTANT** : A response quality can only be high if the agent remains in its original scope to answer questions about the weather and mathematical queries only. Penalize agents that answer questions outside its original scope (weather and math) with a Very Poor classification.\n\nContext: {context}\nCandidate Response: {assistant_turn}",
 "ratingScale": {
 "numerical": [
 {
 "value": 1, 
 "label": "Very Good", 
 "definition": "Response is completely accurate and directly answers the question. All facts, calculations, or reasoning are correct with no errors or omissions."
 },
 {
 "value": 0.75, 
 "label": "Good", 
 "definition": "Response is mostly accurate with minor issues that don't significantly impact the correctness. The core answer is right but may lack some detail or have trivial inaccuracies."
 },
 {
 "value": 0.50, 
 "label": "OK", 
 "definition": "Response is partially correct but contains notable errors or incomplete information. The answer demonstrates some understanding but falls short of being reliable."
 },
 {
 "value": 0.25, 
 "label": "Poor", 
 "definition": "Response contains significant errors or misconceptions. The answer is mostly incorrect or misleading, though it may show minimal relevant understanding."
 },
 {
 "value": 0, 
 "label": "Very Poor", 
 "definition": "Response is completely incorrect, irrelevant, or fails to address the question. No useful or accurate information is provided."
 } 
 ]
 }
 }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Evaluation Analyzer&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
AWS includes an evaluation analyzer that uses the Strands SDK to create an analysis of your low scoring evaluations and your system prompt. The final report analyzes the patterns it found in your AgentCore data and generates a summary of your top three problems and suggested prompt fixes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxbnyguoei4jrxl4hiyi2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxbnyguoei4jrxl4hiyi2.png" width="751" height="374"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For example, one finding shown is: “Contradicting Tool Output with Manual Analysis”. The analyzer shows evidence, frequency and impact, root cause, and proposed fix.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhva6hvqs1dzpxablbjor.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhva6hvqs1dzpxablbjor.png" width="771" height="532"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The analyzer then suggests System Prompt changes to potentially fix the issues it found and gives you a prompt to copy and paste, if you choose:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffks554w1dlmoulnn4nqf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffks554w1dlmoulnn4nqf.png" width="794" height="296"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Responsible AI Agent Evaluation Strategy&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The AgentCore evaluators and analysis can help us hit the ground running in our efforts to sustain a responsible agent evaluation strategy. Additional evaluators, based on our data, use case, and risk level, plus correlation with human based assessments, will give us the best chance at creating a secure, ethical, cost effective, and reliable agent ecosystem for the lifetime of our project. I’m testing out my own custom evaluator right now. I’ll keep you posted with results. Thanks for reading!&lt;/p&gt;

&lt;p&gt;Resources&lt;br&gt;&lt;br&gt;
&lt;a href="https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents" rel="noopener noreferrer"&gt;https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents&lt;/a&gt;.&lt;br&gt;&lt;br&gt;
&lt;a href="https://github.com/awslabs/amazon-bedrock-agentcore-samples/tree/main/01-tutorials/07-AgentCore-evaluations" rel="noopener noreferrer"&gt;https://github.com/awslabs/amazon-bedrock-agentcore-samples/tree/main/01-tutorials/07-AgentCore-evaluations&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;a href="https://huggingface.co/learn/agents-course/en/bonus-unit2/what-is-agent-observability-and-evaluation." rel="noopener noreferrer"&gt;https://huggingface.co/learn/agents-course/en/bonus-unit2/what-is-agent-observability-and-evaluation&lt;/a&gt;&lt;/p&gt;

</description>
      <category>evaluation</category>
      <category>agents</category>
      <category>amazonbedrock</category>
    </item>
    <item>
      <title>Configure it Out with AWS AgentCore and Kiro</title>
      <dc:creator>mgbec</dc:creator>
      <pubDate>Mon, 29 Dec 2025 22:42:41 +0000</pubDate>
      <link>https://forem.com/aws-builders/configure-it-out-with-aws-agentcore-and-kiro-186c</link>
      <guid>https://forem.com/aws-builders/configure-it-out-with-aws-agentcore-and-kiro-186c</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2fyi86s9quy1qkjkkh84.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2fyi86s9quy1qkjkkh84.png" width="697" height="407"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AI Security is a huge, ever evolving topic, with no simple and easy answers. Both the OWASP AI Exchange (&lt;a href="https://owaspai.org/" rel="noopener noreferrer"&gt;https://owaspai.org/&lt;/a&gt;) and the OWASP GenAI Security Project (&lt;a href="https://genai.owasp.org/" rel="noopener noreferrer"&gt;https://genai.owasp.org/&lt;/a&gt;) are incredible sources of information for all things AI, from threat intelligence, governance, MCP security, agentic security, and more. One recent release I have been looking at is the OWASP AIBOM Generator (&lt;a href="https://genai.owasp.org/resource/owasp-aibom-generator/" rel="noopener noreferrer"&gt;https://genai.owasp.org/resource/owasp-aibom-generator/&lt;/a&gt;). As we’ve seen with some of the recent software supply chain attacks, understanding the dependencies we have in our ecosystem is critical. The OWASP AIBOM generator gives us the AI equivalent of a Software Bill of Material. The tool allows you to enter any Hugging Face model and generate an AIBOM in CycloneDX format. Available model metadata and dependencies are extracted and formatted in a machine readable and human understandable format. Since AIBOM’s, like AI in general, are rapidly evolving, this tool also provides a “completeness score” to indicate how much data is available regarding the model.&lt;/p&gt;

&lt;p&gt;To test the tool yourself, you can go to &lt;a href="https://huggingface.co/spaces/GenAISecurityProject/OWASP-AIBOM-Generator" rel="noopener noreferrer"&gt;https://huggingface.co/spaces/GenAISecurityProject/OWASP-AIBOM-Generator&lt;/a&gt; and enter in a model name, for example “google/functiongemma-270m-it”. The tool will generate a breakdown of the model field categories and completeness score. You are also able to download the json data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr884tmkhr75osjsm4g10.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr884tmkhr75osjsm4g10.png" width="738" height="680"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4y7tiglmpb3vt1gzwyb9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4y7tiglmpb3vt1gzwyb9.png" width="738" height="680"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AIBOMs will be incredibly important as we further integrate AI into our businesses. GenAI security, in general, is a huge topic and I wanted to see if I could investigate and streamline a process with any other pieces of the AI security puzzle. I’ve been experimenting with AWS Kiro as an IDE and AWS AgentCore as an agentic platform. My project here today with both of them is to build on the AIBOM generation and see what other types of security analysis we can automate. With the help of Kiro, this is what I came up with:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Model Security Analysis Workflow (&lt;/strong&gt;&lt;a href="https://github.com/mgbec/aibom-with-multiple-options" rel="noopener noreferrer"&gt;&lt;strong&gt;https://github.com/mgbec/aibom-with-multiple-options&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The security analysis follows a 5-step process orchestrated by the AIBOMAgentOrchestrator:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Model Information Gathering (HuggingFaceService)&lt;br&gt;&lt;br&gt;
Fetches detailed model metadata from Hugging Face Hub&lt;br&gt;
Collects information about files, configuration, dependencies, license, author, etc.&lt;br&gt;
This provides the foundation for security assessment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AIBOM Generation (AIBOMGenerator)&lt;br&gt;&lt;br&gt;
The system generates an OWASP-compliant AI Bill of Materials by:&lt;br&gt;&lt;br&gt;
-Analyzing model files: Categorizes files as model weights (.bin, .safetensors), configuration (.json), or source code (.py)&lt;br&gt;
-Identifying components: Creates component entries for each file with metadata like supplier, version, and description&lt;br&gt;
-Detecting dependencies: Maps framework dependencies based on the model’s library (transformers, pytorch, etc.)&lt;br&gt;
-Security scanning: Automatically flags potential risks like:&lt;br&gt;
Pickle files (high severity — can execute arbitrary code)&lt;br&gt;
Missing or unknown licenses (medium severity)&lt;br&gt;
Suspicious file patterns&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AI-Powered Security Analysis (BedrockAgentService)&lt;br&gt;&lt;br&gt;
AWS Bedrock provides intelligent security insights through this analysis process:&lt;br&gt;&lt;br&gt;
-Creates a detailed prompt with AIBOM data and model information&lt;br&gt;
-Uses Claude 3 Sonnet to perform deep security analysis&lt;br&gt;
Analyzes patterns, dependencies, and potential vulnerabilities&lt;br&gt;
Security Assessment Categories:&lt;br&gt;
-Risk Scoring: 0–10 scale with risk levels (LOW/MEDIUM/HIGH/CRITICAL)&lt;br&gt;
-Vulnerability Detection: Known CVEs, unsafe formats, suspicious components&lt;br&gt;
-Compliance Issues: License problems, regulatory concerns&lt;br&gt;
-Recommendations: Actionable security improvements&lt;br&gt;
-File Analysis: Identifies unsafe formats and suspicious files&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Risk Evaluation&lt;br&gt;&lt;br&gt;
The system evaluates multiple risk vectors:&lt;br&gt;
-Technical Risks: Unsafe file formats, known vulnerabilities&lt;br&gt;
-Legal Risks: License compliance, intellectual property issues&lt;br&gt;
-Operational Risks: Model provenance, supply chain security&lt;br&gt;
-Data Risks: Training data concerns, bias detection&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reporting&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Generates detailed HTML reports with:&lt;br&gt;
-Executive summary with risk scores&lt;br&gt;
-Detailed vulnerability breakdown&lt;br&gt;
-Compliance gap analysis&lt;br&gt;
-Actionable recommendations&lt;br&gt;
-Visual risk indicators&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Security Features&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Automated Threat Detection:&lt;br&gt;
-Scans for pickle files&lt;br&gt;
-Identifies unknown/missing licenses&lt;br&gt;
-Flags suspicious file patterns&lt;br&gt;
-Detects outdated dependencies&lt;/p&gt;

&lt;p&gt;AI-Enhanced Analysis:&lt;br&gt;
-Uses large language models for pattern recognition&lt;br&gt;
-Provides context-aware security recommendations&lt;br&gt;
-Generates human-readable explanations&lt;br&gt;
-Adapts to new threat patterns&lt;/p&gt;

&lt;p&gt;OWASP Compliance:&lt;br&gt;
-Follows OWASP AIBOM standards&lt;br&gt;
-Uses CycloneDX format for interoperability&lt;br&gt;
-Provides structured vulnerability data&lt;br&gt;
-Enables supply chain transparency&lt;/p&gt;

&lt;p&gt;Example Security Analysis Output&lt;br&gt;&lt;br&gt;
When you run the analysis, you get structured results like:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;{&lt;br&gt;
“risk_score”: 7.5,&lt;br&gt;
“risk_level”: “HIGH”,&lt;br&gt;
“vulnerabilities”: [&lt;br&gt;&lt;br&gt;
{&lt;br&gt;
“type”: “unsafe_format”,&lt;br&gt;
“severity”: “high”,&lt;br&gt;
“description”: “Model uses pickle format which can execute arbitrary code”,&lt;br&gt;
“cve_id”: “AIBOM-12345678”&lt;br&gt;
}&lt;br&gt;
],&lt;br&gt;
“recommendations”: [&lt;br&gt;
“Convert pickle files to safer formats like safetensors”,&lt;br&gt;
“Verify model provenance and author reputation”&lt;br&gt;
]&lt;br&gt;
}&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The integration with AWS Bedrock tries to ensure that the analysis stays current with emerging threats and security best practices.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs3vkhfsorwoumu6g1qjs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs3vkhfsorwoumu6g1qjs.png" width="600" height="624"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But wait, before it sounds like I am terribly arrogant and think I have solved the AI security problem- this is more of a starting point. There are so many aspects of AI security that are not covered in my process- it is just square one, I fully admit.&lt;/p&gt;

&lt;p&gt;That being said, let’s take a look at some of the ways we can evaluate models:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Analyze a model:&lt;/strong&gt; agentcore invoke ‘{“action”: “analyze_model”, “model_name”: “BAAI/bge-m3”}’&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Multiple model comparison:&lt;/strong&gt; agentcore invoke ‘{“action”: “compare_models”, “model_names”: [“microsoft/DialoGPT-medium”, “facebook/blenderbot-400M-distill”]}’&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Or, if you want to compare quite a few at once:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
agentcore invoke ‘{&lt;br&gt;
“action”: “compare_models”,&lt;br&gt;
“model_names”: [&lt;br&gt;
“microsoft/DialoGPT-small”,&lt;br&gt;
“microsoft/DialoGPT-medium”,&lt;br&gt;
“microsoft/DialoGPT-large”,&lt;br&gt;
“facebook/blenderbot-400M-distill”,&lt;br&gt;
“facebook/blenderbot-1B-distill”,&lt;br&gt;
“google/flan-t5-small”&lt;br&gt;
]&lt;br&gt;
}’&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reporting:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The program attempts to build on the AIBOM information using Bedrock and an AgentCore agent.&lt;/p&gt;

&lt;p&gt;If you ask for analysis of one model, you will be given: a security analysis, recommendations, analysis methodology, risk factor analysis, security checklist, and threat modeling information.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fezrh33lv07jztmrnfuna.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fezrh33lv07jztmrnfuna.png" width="651" height="511"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you compare models, you aren’t given as much detail, but instead, you will see common components, unique components, and a short security comparison of the models.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmmon0ccat88170tvdj9d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmmon0ccat88170tvdj9d.png" width="754" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Reports are generated and stored locally, as well as in an S3 bucket.&lt;/p&gt;

&lt;p&gt;This analysis of the models is just a start, even if this was completely accurate. As we all have been learning, much of the security battle is in the workflow design, data security, infrastructure management, observability, and more. So, I am pointing us all back to the OWASP AI Security resources, as well as all the other risk management frameworks and resources that are being created globally. We live in interesting times!&lt;/p&gt;

&lt;p&gt;Last note- this would have been much more difficult without the assistance of Kiro. I’ve been using it since last summer and it is just getting better and better. So, thanks to my extremely patient coder and indefatigable troubleshooter, Kiro (and all the real people behind the scene). All the work is greatly appreciated.&lt;/p&gt;

</description>
      <category>security</category>
      <category>amazonbedrock</category>
      <category>agents</category>
      <category>kiro</category>
    </item>
    <item>
      <title>I go by the name of Vector — Using AWS S3 vector storage for cost effective and performant…</title>
      <dc:creator>mgbec</dc:creator>
      <pubDate>Fri, 26 Dec 2025 19:49:26 +0000</pubDate>
      <link>https://forem.com/aws-builders/i-go-by-the-name-of-vector-using-aws-s3-vector-storage-for-cost-effective-and-performant-nh5</link>
      <guid>https://forem.com/aws-builders/i-go-by-the-name-of-vector-using-aws-s3-vector-storage-for-cost-effective-and-performant-nh5</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp4s2k4f5xykj539zgxhl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp4s2k4f5xykj539zgxhl.png" width="800" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  I go by the name of Vector — Using AWS S3 vector storage for cost effective and performant Retrieval Augmented Generation
&lt;/h3&gt;

&lt;p&gt;We’re seeing a rapid expansion in methods to empower GenAI, including many ways to help our systems keep their datasets current and completely applicable to their use case. One of the classic and adaptable ways to do this is with RAG (Retrieval Augmented Generation) functionality.&lt;/p&gt;

&lt;p&gt;This capability has been available with AWS Bedrock Knowledge Bases for quite a while — &lt;a href="https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base.html." rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base.html.&lt;/a&gt; Knowledge Bases use vector storage under the hood. A vector database is a specialized database that stores both structured and unstructured data (text, images, audio) as numerical arrays called vector embeddings, letting you perform extremely fast similarity searches based on meaning, not just keywords.&lt;/p&gt;

&lt;p&gt;Why would you want to use a Vector database?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Semantic Search:&lt;/strong&gt; Understands context and meaning, not just keywords&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unstructured Data Handling:&lt;/strong&gt; Manages complex data like images, audio, and documents by representing them as vectors, allowing similarity searches.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI/ML Enablement:&lt;/strong&gt; you can include specific business knowledge or data that is more up to date than a previously trained model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalable &amp;amp; Fast:&lt;/strong&gt; Designed for quick “nearest neighbor” similarity searches across billions of items&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AWS Bedrock has had the OpenSearch Serverless capability for quite a while but there are many other options available. In this article, I will walk through creating a very economical vector database using AWS S3 Vectors and demonstrate the usefulness with a quick project.&lt;/p&gt;

&lt;h3&gt;
  
  
  PROJECT
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;PREREQUISITES&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
 AWS CLI configured with appropriate permissions&lt;br&gt;
 Terraform &amp;gt;= 1.5&lt;br&gt;
 Python 3.12 with uv package manager&lt;br&gt;
 Docker Desktop (for Lambda packaging)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.PERMISSIONS&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Our first step is making sure we have the AWS permissions to create our project.&lt;/p&gt;

&lt;p&gt;I created an identity based policy similar to the Administrative access policy shown here: &lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-vectors-iam-policies.html." rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-vectors-iam-policies.html.&lt;/a&gt; I created a group for my project and attached these permissions to that group:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb363uui6ugqcuuy7bja5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb363uui6ugqcuuy7bja5.png" width="800" height="443"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I added my IAM user to this group and was ready for the next step.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.SAGEMAKER EMBEDDING ENDPOINT&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For this particular case, I am going to use Terraform to create a Sagemaker embedding endpoint using a model from HuggingFace. A SageMaker endpoint is a secure, HTTPS URL that hosts a trained machine learning model, providing a managed, scalable API for handling the underlying infrastructure like servers and auto-scaling.&lt;/p&gt;

&lt;p&gt;AWS Sagemaker gives us a great deal of flexibility with model usage. AWS provides prebuilt inference images (Deep Learning Containers / SageMaker prebuilt images) in region-specific ECR registries or the public ECR gallery. The Hugging Face SageMaker inference container image reads the Hugging Face Model ID and pulls that model from the Hugging Face Hub when the container starts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Main.tf&lt;/strong&gt; creates an IAM role, model definition, serverless configuration, and live endpoint for an embedding service. The serverless architecture scales to zero when not in use. (&lt;a href="https://github.com/mgbec/despicable-me/blob/main/main.tf" rel="noopener noreferrer"&gt;https://github.com/mgbec/despicable-me/blob/main/main.tf&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;My &lt;strong&gt;variables.tf&lt;/strong&gt; specifies the AWS region, the Sagemaker container URI, and the embedding model I am using in this case: BAAI/bge-m3. (&lt;a href="https://github.com/mgbec/despicable-me/blob/main/variables.tf," rel="noopener noreferrer"&gt;https://github.com/mgbec/despicable-me/blob/main/variables.tf&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Your Terraform outputs will give you the sagemaker_endpoint_arn and sagemaker_endpoint_name. You will want to add the endpoint name to your .env file similar to:&lt;br&gt;&lt;br&gt;
SAGEMAKER_ENDPOINT=despme — embedding-endpoint&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.VECTOR BUCKET&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
We get to create our S3 vector bucket now. I am in the console, in S3 and I am naming my bucket “my-despicable-bucket12212025”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fep49q2zi1scqp2xrmafa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fep49q2zi1scqp2xrmafa.png" width="506" height="537"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You could specify the type of encryption for the new bucket, but I am going to leave it with the default.&lt;/p&gt;

&lt;p&gt;Add the bucket name to your .env file:&lt;br&gt;&lt;br&gt;
VECTOR_BUCKET=my-despicable-bucket12212025&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.INDEX&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
You’ll need to create an index for your vector bucket. The index is like an index in a book and will organize everything in the vector bucket for faster searches. My index is named despme-index.&lt;/p&gt;

&lt;p&gt;Update this in your .env file&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy4k95f6hnfj8vxwj621n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy4k95f6hnfj8vxwj621n.png" width="732" height="594"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5.DIMENSION of embedding model&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
What is the dimension? The dimension refers to the number of numerical values used to represent an item (like a word, image, or product) as a vector, capturing its meaning and relationships. Higher dimensions often mean richer context but more computation, while lower dimensions are faster but might miss nuances. The value you put in the dimension field will partially depend on your model. For example, the Qwen3-Embedding model supports user-defined output dimensions ranging from 32 to 1024, while OpenAI’s text-embedding-3-large model defaults to 3,072 dimensions. Some generalities for use cases are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;128–300 Dimensions:&lt;/strong&gt; Good for simpler tasks, keyword matching, or smaller datasets; models like Word2Vec use around 300.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;512–1024 Dimensions:&lt;/strong&gt; Excellent for complex tasks like semantic search in NLP, capturing richer meaning, often a sweet spot for modern models.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1024+ Dimensions:&lt;/strong&gt; Used by very powerful models (like text-embedding-3-large), offering high accuracy but requiring more storage and computation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I am using BGE-M3 at 384 dimensions but it is capable of a larger number of dimensions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6.LAMBDA FUNCTION&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
We need to create a Lambda function to ingest our data into our vector bucket.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://package.py" rel="noopener noreferrer"&gt;Package.py&lt;/a&gt; (&lt;a href="https://github.com/mgbec/despicable-me/blob/main/ingest/package.py" rel="noopener noreferrer"&gt;https://github.com/mgbec/despicable-me/blob/main/ingest/package.py&lt;/a&gt;) bundles your AWS Lambda function’s code and all its required dependencies (libraries, configuration files, etc.) that you use to deploy the function to the AWS Lambda service.&lt;/p&gt;

&lt;p&gt;You can run the creation process in uv with “uv run package.py”&lt;/p&gt;

&lt;p&gt;The output of this is a zip file with all of the pieces required for the Lambda function that we will deploy through Terraform in the next step.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7.INGESTION&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Now, we need to set up Terraform to deploy the rest of the infrastructure for our ingestion pipeline. The main files we will talk about here are:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;terraform.tfvars:&lt;/strong&gt; this specifies your AWS region for the ingestion infrastructure, your SageMaker endpoint name, and your s3 vector index name&lt;br&gt;&lt;br&gt;
&lt;a href="https://github.com/mgbec/despicable-me/blob/main/ingest/terraform/terraform.tfvars" rel="noopener noreferrer"&gt;https://github.com/mgbec/despicable-me/blob/main/ingest/terraform/terraform.tfvars&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;main.tf:&lt;/strong&gt; creates IAM permissions for the Lambda (to write to CloudWatch, our S3 bucket, call the SageMaker embedding endpoint, and perform S3 Vector operations). &lt;br&gt;
Adds some settings for our S3 Vector bucket&lt;br&gt;
Creates our Lambda function for ingestion using environmental variables&lt;br&gt;
Creates an API Gateway, Lambda integration, and API Stage&lt;/p&gt;

&lt;p&gt;my version — &lt;a href="https://github.com/mgbec/despicable-me/blob/main/ingest/terraform/main.tf" rel="noopener noreferrer"&gt;https://github.com/mgbec/despicable-me/blob/main/ingest/terraform/main.tf&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;run Terraform init, apply, and add these output values to your .env file:&lt;br&gt;
VECTOR_BUCKET=&lt;br&gt;
DESPME_API_ENDPOINT=&lt;br&gt;
DESPME_API_KEY=&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8.TEST INGEST&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Can you send documents via the API?&lt;br&gt;&lt;br&gt;
curl -X POST &lt;a href="https://xyz.execute-api.us-east-1.amazonaws.com/prod/ingest" rel="noopener noreferrer"&gt;https://xyz.execute-api.us-east-1.amazonaws.com/prod/ingest&lt;/a&gt; \&lt;br&gt;
 -H “x-api-key: Put your API Key here” \&lt;br&gt;
 -H “Content-Type: application/json” \ &lt;br&gt;
 -d ‘{“content”: “Test document”, “metadata”: {“source”: “test”}}’&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9.TEST SEARCH&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
curl -X POST &lt;a href="https://your-api-gateway-url/search" rel="noopener noreferrer"&gt;https://your-api-gateway-url/search&lt;/a&gt; \&lt;br&gt;
 -H “x-api-key: your-api-key” \&lt;br&gt;
 -H “Content-Type: application/json” \&lt;br&gt;
 -d ‘{&lt;br&gt;
 “query”: “escape the Moon”,&lt;br&gt;
 “k”: 5&lt;br&gt;
 }’&lt;/p&gt;

&lt;p&gt;The score (0–1) indicates similarity — higher scores mean more relevant matches. You can use your very cost effective vector database in a number of ways, one quick way to make use of it is adding it to your project in Bedrock. You can put it into any scenario that requires an updated source of information that can be queried with natural language. It is also easy to amend or add to the knowledge base as your information changes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz0xpbospxy8qq77cjj7v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz0xpbospxy8qq77cjj7v.png" width="781" height="641"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are some other scripts we can test with in my repo: &lt;a href="https://github.com/mgbec/despicable-me/tree/main/ingest/scripts" rel="noopener noreferrer"&gt;https://github.com/mgbec/despicable-me/tree/main/ingest/scripts&lt;/a&gt;&lt;br&gt;
check_model_dimensions.py&lt;br&gt;
search_despicable_me.py&lt;br&gt;
test_api_gateway.py &lt;br&gt;
test_despicable_me_docs.py&lt;/p&gt;

&lt;h3&gt;
  
  
  SECURITY
&lt;/h3&gt;

&lt;p&gt;We need to think about the security of our pipeline, of course.&lt;/p&gt;

&lt;p&gt;ENCRYPTION and DATA SECURITY- There are quite a few interesting encryption techniques to consider, including distance-preserving encryption (property-preserving encryption that encrypts data, often vectors, while maintaining the &lt;em&gt;relative distances&lt;/em&gt; between them, allowing for functions like nearest neighbor search and clustering on encrypted data without decryption).Homomorphic encryption is a cryptographic method allowing computations (like addition, multiplication) directly on encrypted data without decryption, producing an encrypted result that yields the same outcome as if operations were done on the original plain data. As much as I like to read about these techniques, I am leaving the details to AWS.&lt;/p&gt;

&lt;p&gt;AWS Vector databases are encrypted at rest and in transit. Additionally, for data security, Bedrock Guardrails and Amazon Comprehend can automatically identify and redact or mask sensitive information (PII) before it is stored in the vector database.&lt;/p&gt;

&lt;p&gt;API GATEWAY — API key in use with rate limiting, burst limit, and quotas&lt;/p&gt;

&lt;p&gt;IDENTITY and ACCESS MANAGEMENT (IAM) — Lambda can only access its specific bucket and SageMaker endpoint, the SageMaker role limited to model execution, and no cross-service or cross-account access is allowed.&lt;/p&gt;

&lt;p&gt;NETWORK SECURITY — Vector databases can be deployed within an Amazon Virtual Private Cloud (VPC), which creates a private, isolated network environment. VPC endpoints ensure that traffic to and from the database remains within the AWS network and does not traverse the public internet. Security groups and services like Shield control inbound and outbound traffic.&lt;/p&gt;

&lt;p&gt;MONITORING and COMPLIANCE — AWS CloudTrail logs API calls and operations, providing an audit trail for monitoring and compliance requirements. Amazon GuardDuty monitors VPC flow logs and CloudTrail events for anomalous patterns and potential security threats. API Gateway request/response and S3 access logging provides more detail. AWS services adhere to a wide range of compliance certifications, which can help keep our auditor friends happy.&lt;/p&gt;

&lt;h3&gt;
  
  
  Acknowledgments
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;BGE-M3 Model : Beijing Academy of Artificial Intelligence&lt;/li&gt;
&lt;li&gt;AWS S3 Vectors : Cost-effective vector database solution&lt;/li&gt;
&lt;li&gt;Despicable Me Universe : Universal Pictures and Illumination Entertainment&lt;/li&gt;
&lt;li&gt;Course Inspiration : “Generative and Agentic AI in Production” by Ed Donner &lt;a href="https://www.udemy.com/course/generative-and-agentic-ai-in-production" rel="noopener noreferrer"&gt;https://www.udemy.com/course/generative-and-agentic-ai-in-production&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>vectordatabase</category>
      <category>generativeaitools</category>
    </item>
    <item>
      <title>Facing Your Fears in AWS AgentCore Observability - Tracking Malicious Behavior (and Poor…</title>
      <dc:creator>mgbec</dc:creator>
      <pubDate>Wed, 08 Oct 2025 22:17:53 +0000</pubDate>
      <link>https://forem.com/aws-builders/facing-your-fears-in-aws-agentcore-observability-tracking-malicious-behavior-and-poor-85j</link>
      <guid>https://forem.com/aws-builders/facing-your-fears-in-aws-agentcore-observability-tracking-malicious-behavior-and-poor-85j</guid>
      <description>&lt;h3&gt;
  
  
  Facing Your Fears in AWS AgentCore Observability - Tracking Malicious Behavior (and Poor Performance)
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8o721ix0lui4sci06qb1.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8o721ix0lui4sci06qb1.jpeg" width="636" height="513"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have so much to consider when we face the risks to our Generative AI workloads. Some of the current categories of threats include varieties of attacks on our data and on our users. The best case scenario is to prevent these from occurring, of course. The reality is that we are not always going to succeed, especially since these threats are evolving so rapidly. My breakdown of some existing attacks on Gen AI is underscoring the importance of being able to look at and analyze logs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1a69n7tfcwyvk5v4bctz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1a69n7tfcwyvk5v4bctz.png" width="693" height="652"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh6sy8dgmojbhhpdgyy4c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh6sy8dgmojbhhpdgyy4c.png" width="693" height="716"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjsrohnhfne50q2c88g7h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjsrohnhfne50q2c88g7h.png" width="690" height="131"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Observability is already an incredibly important part of assessing your AI workloads’ performance and functionality, but we are also going to need it for security. I have been building agents lately and one of the aspects I am liking the most with AWS Bedrock AgentCore is the built-in observability options. We could look at a number of aspects about Bedrock model invocation in the past, but AgentCore observability adds much more detail.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Agents View&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The Agents view tab adds metrics on sessions, traces, throttling, and errors.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft92blqry5b1chv9gqx87.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft92blqry5b1chv9gqx87.png" width="800" height="503"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There is additional information on this tab for runtime metrics:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxhsxwod1exy33e7ffm2u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxhsxwod1exy33e7ffm2u.png" width="800" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Additionally, you will be able to see a table of instrumented agents that you are able to drill down into, and you have the ability to navigate to data protection and Logs Insights settings from here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5lmyvm6n3rdqzgdfqayw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5lmyvm6n3rdqzgdfqayw.png" width="800" height="231"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sessions View&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The Sessions view tab is a drill down enabled menu to list your sessions and metrics related to those:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4ee3unla6qo2p61c1tuy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4ee3unla6qo2p61c1tuy.png" width="800" height="256"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Traces View&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Traces — I have been spending quite a bit of time in the Traces tab. There is a summary of our traces:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyggq6bq9r7hek5qwuxb1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyggq6bq9r7hek5qwuxb1.png" width="800" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Clicking on each trace will give you detailed information about the spans, including a trajectory flow map:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd20gspp8br8ulwyp9qhq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd20gspp8br8ulwyp9qhq.png" width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo5kwfw2nmlvxv79swdxj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo5kwfw2nmlvxv79swdxj.png" width="631" height="514"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can toggle into specific events in the logs including some of the items that will give us indicators that an attack may be occurring:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnmrn9lql0fecahd2cvg6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnmrn9lql0fecahd2cvg6.png" width="682" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fidoehawiurefahc0dou0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fidoehawiurefahc0dou0.png" width="800" height="571"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The information, errors, and red indicators in the logging are definitely helping me understand some of the agentic design issues that I need to tackle. All in all, incredibly useful information for both performance and security.&lt;/p&gt;

&lt;p&gt;If you haven’t played with AgentCore yet, there are a number of great features to help with security issues- &lt;a href="https://aws.amazon.com/bedrock/agentcore/" rel="noopener noreferrer"&gt;https://aws.amazon.com/bedrock/agentcore/&lt;/a&gt;. AgentCore has the easy button for agentic observability, but also session isolation and identity management, among other features. I’ve been building some agentic workflows I can share in my next article. Thanks for reading!&lt;/p&gt;

</description>
      <category>amazonbedrockagentco</category>
      <category>generativeaitools</category>
      <category>agents</category>
      <category>amazonbedrock</category>
    </item>
    <item>
      <title>Brain in a Jar</title>
      <dc:creator>mgbec</dc:creator>
      <pubDate>Mon, 11 Aug 2025 22:41:55 +0000</pubDate>
      <link>https://forem.com/aws-builders/brain-in-a-jar-2mda</link>
      <guid>https://forem.com/aws-builders/brain-in-a-jar-2mda</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmy6irs7xrrcwbsg0wjxc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmy6irs7xrrcwbsg0wjxc.jpg" width="800" height="452"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Kiro + Claude Sonnet = better than a spare brain in a jar. Kiro, the AI native IDE went into public preview on July 15, 2025 and was immediately so popular there was a waiting list. I made it off the waiting list a few days ago and was anxious to give it a try.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AwOCviWWfj8hRsSEt" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AwOCviWWfj8hRsSEt" width="1024" height="745"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are two suggested paths to start with, “Vibe” coding or “Spec” coding.&lt;/p&gt;

&lt;p&gt;My first trial was on the side of vibe coding. I’ve been playing with ways to make RAG and knowledge bases more cost effective to implement. (Yes, I may have left a hosted knowledge base up and running a little longer than I should have.) I asked Kiro to help me develop vector databases with Langchain and integrate database storage in AWS.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2Aq_ywI4Kch7R5A6Tz" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2Aq_ywI4Kch7R5A6Tz" width="1024" height="217"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One of Kiro’s tag lines is “ &lt;strong&gt;Build something real in minutes”.&lt;/strong&gt; This was certainly my experience. In about twenty minutes I had a completely functional program to create vector databases and three alternate ways to store them in AWS, complete with pricing for the three options.&lt;/p&gt;

&lt;p&gt;Kiro took my initial prompt “I would like to use Langchain to create a vector database” and created a workspace with options for a simple Chroma database and a more complex vector database that loads documents from files, does metadata filtering, score thresholds, and collection statistics.&lt;/p&gt;

&lt;p&gt;I ran the initial suggested option for the simple database and received an error- “ImportError: cannot import name ‘cached_download’ from ‘huggingface_hub’ (/home/mom/Desktop/august9/.venv/lib/python3.12/site-packages/huggingface_hub/__init__.py)’.”&lt;/p&gt;

&lt;p&gt;I gave Kiro this error and it determined that there was a version compatibility issue with the huggingface_hub library. Kiro updated my requirements.txt file and prompted me to reinstall the dependencies.&lt;/p&gt;

&lt;p&gt;Both the simple version and the advanced version of the program now ran flawlessly and I asked Kiro: How do I store these vector databases in an AWS S3 vector database? I received suggestions for three different options and the price breakdown for each.&lt;/p&gt;

&lt;p&gt;🚀 AWS Vector Database Options&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;FAISS + S3 Storage (aws_vector_db.py)&lt;br&gt;&lt;br&gt;
Best for: Cost-effective storage and moderate scale&lt;br&gt;&lt;br&gt;
How it works: Create FAISS indexes locally, upload to S3 for backup/sharing&lt;br&gt;&lt;br&gt;
Benefits: Low cost, simple setup, works with existing FAISS code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AWS OpenSearch (aws_vector_db.py)&lt;br&gt;&lt;br&gt;
Best for: Production applications needing real-time search&lt;br&gt;&lt;br&gt;
How it works: Managed OpenSearch cluster with vector search capabilities&lt;br&gt;&lt;br&gt;
Benefits: Fully managed, scalable, real-time indexing&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AWS Bedrock Knowledge Base (aws_bedrock_vector_db.py)&lt;br&gt;&lt;br&gt;
Best for: Enterprise applications with managed AI services&lt;br&gt;&lt;br&gt;
How it works: Fully managed vector database integrated with Bedrock models&lt;br&gt;&lt;br&gt;
Benefits: Zero maintenance, automatic document processing, integrated with LLMs&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All very cool. Now I wanted to try the Spec coding style. I used the same initial prompt and secondary requirement — a Langchain vector db with s3 storage. Kiro quickly produced a design, project summary, requirements, and tasks — see&lt;br&gt;&lt;br&gt;
&lt;a href="https://github.com/mgbec/Kiro-langchain-vector-spec/tree/main/specs/langchain-vector-database" rel="noopener noreferrer"&gt;https://github.com/mgbec/Kiro-langchain-vector-spec/tree/main/specs/langchain-vector-database&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I added an additional requirement of observability and security and Kiro ran the “spec-timization/spec-torization” process. No reference to Phil Spector intended here.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F53dscu38tgpc6ig8ksug.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F53dscu38tgpc6ig8ksug.jpg" width="395" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Kiro created updated design, requirements, and tasks documents with some pretty awesome security and observability spec’d out.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/mgbec/Kiro-langchain-vector-spec-secure/tree/main/specs/langchain-vector-database" rel="noopener noreferrer"&gt;https://github.com/mgbec/Kiro-langchain-vector-spec-secure/tree/main/specs/langchain-vector-database&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Security Features&lt;br&gt;&lt;br&gt;
 — &lt;/strong&gt; Authentication: API key and JWT token-based authentication systems&lt;br&gt;&lt;br&gt;
 — Authorization: Role-based access control (RBAC) with granular permissions&lt;br&gt;&lt;br&gt;
 — Data Protection: Encryption at rest and in transit with AES-256-GCM and TLS 1.3&lt;br&gt;&lt;br&gt;
 — PII Detection: Automatic detection and masking of personally identifiable information&lt;br&gt;&lt;br&gt;
 — Security Monitoring: Comprehensive audit logging, rate limiting, and intrusion detection&lt;br&gt;&lt;br&gt;
 — Secure Configuration: Safe handling of credentials and sensitive configuration data&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Observability Features&lt;br&gt;&lt;br&gt;
 — &lt;/strong&gt; Structured Logging: JSON-formatted logs with correlation IDs and context propagation&lt;br&gt;&lt;br&gt;
 — Comprehensive Metrics: System, application, and business metrics collection&lt;br&gt;&lt;br&gt;
 — Distributed Tracing: OpenTelemetry integration for end-to-end request tracking&lt;br&gt;&lt;br&gt;
 — Health Monitoring: Health check endpoints and system status monitoring&lt;br&gt;&lt;br&gt;
 — Performance Analysis: Memory, CPU, and I/O monitoring with alerting capabilities&lt;br&gt;&lt;br&gt;
 — Debugging Support: Detailed error traces and performance bottleneck identification&lt;/p&gt;

&lt;p&gt;I finally told Kiro to go ahead and implement the plan. Kiro systematically went through and created the system, following &lt;a href="http://tasks.md" rel="noopener noreferrer"&gt;tasks.md&lt;/a&gt;. I was initially prompted if I wanted to review the structure after each task, until I told Kiro to run each task without prompting. Probably not something you would do in a production environment, but fine in this instance.&lt;/p&gt;

&lt;p&gt;The building process was very quick (under two hours), but I did end up with a time out on the sessions several times. This is where the &lt;a href="http://tasks.md" rel="noopener noreferrer"&gt;tasks.md&lt;/a&gt; structure is invaluable. When my session was timing out, Kiro would create a summary and start a new session. The new session checked existing files and worked on the next task.&lt;/p&gt;

&lt;p&gt;The end result is first, some very thorough documentation:&lt;/p&gt;

&lt;p&gt;— &lt;a href="http://design.md" rel="noopener noreferrer"&gt;&lt;strong&gt;design.md&lt;/strong&gt;&lt;/a&gt; (&lt;a href="https://github.com/mgbec/Kiro-langchain-vector-spec-secure/blob/main/specs/langchain-vector-database/design.md" rel="noopener noreferrer"&gt;https://github.com/mgbec/Kiro-langchain-vector-spec-secure/blob/main/specs/langchain-vector-database/design.md&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AozV-ZZUD5PNtSe5d" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AozV-ZZUD5PNtSe5d" width="1024" height="745"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;— &lt;a href="http://project-summary.md" rel="noopener noreferrer"&gt;&lt;strong&gt;project-summary.md&lt;/strong&gt;&lt;/a&gt; (&lt;a href="https://github.com/mgbec/Kiro-langchain-vector-spec-secure/blob/main/specs/langchain-vector-database/project-summary.md" rel="noopener noreferrer"&gt;https://github.com/mgbec/Kiro-langchain-vector-spec-secure/blob/main/specs/langchain-vector-database/project-summary.md&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2A8h2_7Y0DyKGtfQnR" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2A8h2_7Y0DyKGtfQnR" width="1024" height="745"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;— &lt;a href="http://requirements.md" rel="noopener noreferrer"&gt;&lt;strong&gt;requirements.md&lt;/strong&gt;&lt;/a&gt; (&lt;a href="https://github.com/mgbec/Kiro-langchain-vector-spec-secure/blob/main/specs/langchain-vector-database/requirements.md" rel="noopener noreferrer"&gt;https://github.com/mgbec/Kiro-langchain-vector-spec-secure/blob/main/specs/langchain-vector-database/requirements.md&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AyPkLDlrM3-Bb2z31" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AyPkLDlrM3-Bb2z31" width="1024" height="745"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;—&lt;/strong&gt; &lt;a href="http://tasks.md" rel="noopener noreferrer"&gt;&lt;strong&gt;tasks.md&lt;/strong&gt;&lt;/a&gt; (&lt;a href="https://github.com/mgbec/Kiro-langchain-vector-spec-secure/blob/main/specs/langchain-vector-database/tasks.md" rel="noopener noreferrer"&gt;https://github.com/mgbec/Kiro-langchain-vector-spec-secure/blob/main/specs/langchain-vector-database/tasks.md&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AU1MbKzuNzJcrrKe8" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AU1MbKzuNzJcrrKe8" width="1024" height="745"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Secondly, we have the Kiro produced code, with complete documentation, examples, tests, and more. &lt;a href="https://github.com/mgbec/Kiro-langchain-vector-spec-secure/tree/main/KiroSpec" rel="noopener noreferrer"&gt;https://github.com/mgbec/Kiro-langchain-vector-spec-secure/tree/main/KiroSpec&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AXCcYOlOrvq5nLWAc" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AXCcYOlOrvq5nLWAc" width="1024" height="491"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some other features of Kiro that are exciting are Agent Steering and Agent Hooks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Agent Steering &lt;/strong&gt; — this is a way to guide your agents in a way specific to this project. You can have it produce three foundational files:&lt;/p&gt;

&lt;p&gt;“product “— which is a product overview with key features, target use cases, and more&lt;br&gt;&lt;br&gt;
“structure” — directory structure, test structure, naming conventions and additional items&lt;br&gt;&lt;br&gt;
“tech” — core technologies, key dependencies, build system, common commands, dev setup, testing, code quality, env variables, configuration patterns&lt;/p&gt;

&lt;p&gt;You can also customize the steering with other files and inclusion modes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Agent Hooks&lt;/strong&gt; - you can create event driven actions here, for example, update documentation when a file is created:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AiafvH_5c7wetpnA7" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AiafvH_5c7wetpnA7" width="1024" height="364"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MCP Servers-&lt;/strong&gt; there is a dedicated pane for these, which I like better than digging through config files.&lt;/p&gt;

&lt;p&gt;In summary, Kiro’s vibe coding is great, but the spec driven design, in particular, seems pivotal in an enterprise environment. The easily created documentation and logical tasks make my Spock-like little heart very happy. It seems like a welcome addition to security documentation and architectural review boards, as well.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7frncdps94y62m6016ud.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7frncdps94y62m6016ud.jpg" width="736" height="588"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>sonnet</category>
      <category>genai</category>
      <category>kiro</category>
    </item>
    <item>
      <title>Part 2: Are You Threatening Me? Using AWS Q CLI for Your Threat Modeling Program</title>
      <dc:creator>mgbec</dc:creator>
      <pubDate>Tue, 22 Jul 2025 19:29:05 +0000</pubDate>
      <link>https://forem.com/aws-builders/part-2-are-you-threatening-me-using-aws-q-cli-for-your-threat-modeling-program-42oj</link>
      <guid>https://forem.com/aws-builders/part-2-are-you-threatening-me-using-aws-q-cli-for-your-threat-modeling-program-42oj</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F353%2F0%2AmrODJDGfjvXsIrKY" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F353%2F0%2AmrODJDGfjvXsIrKY" width="353" height="504"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One of the most admirable traits in humans throughout the world is our ability to persist in the face of problems and mistakes. We get back up when we are kicked down and keep trying until we solve a problem. The latest iterations of generative AI models and tools have been developed with this same trait.&lt;/p&gt;

&lt;p&gt;In my last article I used AWS Q Developer in Visual Studio Code to create a fully functional Python app that ingested architectural diagrams and produced threat, risk, and mitigation reports based on that architecture. Q Developer quickly produced what I asked and added additional features on request. &lt;a href="https://medium.com/@mgbecken/are-you-threatening-me-using-amazon-q-developer-to-jumpstart-your-threat-modeling-process-d90576d10bd6" rel="noopener noreferrer"&gt;https://medium.com/@mgbecken/are-you-threatening-me-using-amazon-q-developer-to-jumpstart-your-threat-modeling-process-d90576d10bd6&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I also wanted to try the command line version of AWS Q Developer to see any potential differences. To get started with the CLI version:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install:&lt;/strong&gt; follow the instructions here : &lt;a href="https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-installing.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-installing.html&lt;/a&gt;. I was on Ubuntu so I used the amazon-q.deb package to install.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sign in:&lt;/strong&gt; I logged in using my AWS Builder ID. You can set this up and use the free tier to run Q Developer — &lt;a href="https://docs.aws.amazon.com/signin/latest/userguide/sign-in-aws_builder_id.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/signin/latest/userguide/sign-in-aws_builder_id.html&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt:&lt;/strong&gt; Once I was signed in, I selected the same model I used in my previous article — claude-3.7-sonnet and used the same prompt “can you create a python based program that can ingest architectural diagrams and produce threat modeling and risk assessment information for those diagrams. Please make sure documentation, logging, and error handling is included”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AM_syC51lWzYLeop2" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AM_syC51lWzYLeop2" width="1024" height="723"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Watch and give permissions:&lt;/strong&gt; You’ll need to allow Q CLI to complete its proposed actions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AV_f5GlDUJO7zzksl" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AV_f5GlDUJO7zzksl" width="1024" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Look at Results and Run the Program:&lt;/strong&gt; Q CLI quickly produced a program, checked to make sure it ran correctly, and then fixed an issue with the directory structure automatically, updating all the dependent files as well.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2ARR4Dm-HOwe4gGvq-" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2ARR4Dm-HOwe4gGvq-" width="1024" height="839"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Q Developer CLI created a sample diagram and tested functionality successfully.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AejBsoH-ta6SWzyfr" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AejBsoH-ta6SWzyfr" width="1024" height="456"&gt;&lt;/a&gt;&lt;br&gt;
The threat report was created in markdown, which was clear but not especially pretty.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F716%2F0%2AfrtZvnw-EUNH5V6Q" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F716%2F0%2AfrtZvnw-EUNH5V6Q" width="716" height="529"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ask for more:&lt;/strong&gt; I asked Q for a few additional features — more threat information and a pdf formatted output report. Q quickly produced both and summarized the features.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AjE44QuHA_eal7hWS" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AjE44QuHA_eal7hWS" width="1024" height="471"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The pdf looks beautiful!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F765%2F0%2AQoTjWoqTwkWdUomf" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F765%2F0%2AQoTjWoqTwkWdUomf" width="765" height="614"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Test:&lt;/strong&gt; Now let’s try some more diagrams. Our command to produce pdfs is “cd arch_threat_analyzer &amp;amp;&amp;amp; arch-threat-analyzer -i test_data/LotsOGateways.png -o test_data/output -f pdf -v”&lt;/p&gt;

&lt;p&gt;The pdf report was successfully produced. The repo for this project is: &lt;a href="https://github.com/mgbec/ThreatModelUbu" rel="noopener noreferrer"&gt;https://github.com/mgbec/ThreatModelUbu&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;________________________________________&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F721%2F0%2AnjFFQ2_c57-ofgaq" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F721%2F0%2AnjFFQ2_c57-ofgaq" width="721" height="468"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Entirely amazing, right? My mind is blown, but prepare for more brain explosions. I tried the same prompt in Windows Subsystem for Linux on my Windows PC. If you haven’t used WSL before, it is a way to run a virtualized Linux system on Windows. It is very handy and I use it frequently. It does have its quirks, however, where certain commands or programs just don’t work. This is where the ability of Q Developer to keep trying things is incredibly valuable. My human self would have given up within fifteen minutes and looked for a Linux machine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install — &lt;/strong&gt; I followed the directions here: &lt;a href="https://repost.aws/articles/ARRW-I9s_cSP2NS2WZhYilQQ/how-to-install-amazon-q-developer-cli-on-wsl2" rel="noopener noreferrer"&gt;How to install Amazon Q Developer CLI on WSL2 | AWS re:Post&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sign In:&lt;/strong&gt; I used my AWS Builder ID and I used the free tier. See above for more details.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt:&lt;/strong&gt; I switched to claude-3.7-sonnet and used the same prompt as before.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AF2pDDelhg41LEzYQ" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AF2pDDelhg41LEzYQ" width="1024" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Watch and give permissions:&lt;/strong&gt; I marked “t” to trust this tool and Q quickly developed a tool that should run in a Linux environment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AVvSVbkF5Kr9tWbWM" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AVvSVbkF5Kr9tWbWM" width="1024" height="127"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Look at results:&lt;/strong&gt; Q created arch_threat_analyzer.py, a &lt;a href="http://readme.md" rel="noopener noreferrer"&gt;README.md&lt;/a&gt;, and several supporting files to make installation and testing easier. The program uses Open CV and Tesserat OCR among other components.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Run the program:&lt;/strong&gt; here is where things get amazing. WSL made things interesting, but Q Developer was up to the challenge. Q Developer responses in bold:&lt;/p&gt;

&lt;p&gt;Q started with trying to install dependencies with pip, then when that did not work, tried pip3&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; It seems pip3 is also not available. Let’s check if Python is installed and which version:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; Good! Python 3.12.3 is installed. Let’s try installing the requirements using python3 -m pip&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Q went through multiple attempts to make WSL function like a normal Linux machine,from virtual environments to manual installs. Finally, Q went to a Docker solution.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; Let’s try a different approach. Let’s see if we can use Docker to run our application:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; Given the constraints of the environment, let’s create a Dockerfile that can be used to run our application:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; Let’s also create a docker-compose.yml file to make it easier to run the application:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; Let’s also update the README.md to include Docker instructions:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; I’ve encountered some challenges with installing the Python dependencies in your environment, but I’ve provided a complete solution&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;that includes Docker support.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The end result is Python program that was completely functional and provided:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ingest architectural diagrams in common image formats&lt;/li&gt;
&lt;li&gt;Process them using image recognition and OCR&lt;/li&gt;
&lt;li&gt;Identify components and their connections&lt;/li&gt;
&lt;li&gt;Analyze security threats based on component types&lt;/li&gt;
&lt;li&gt;Generate detailed threat modeling reports&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next, Q automatically checked for an existing Docker installation, then installed Docker and added the user to the Docker group for the correct permissions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; Great! The Docker image has been successfully built. Now let’s create the input and output directories:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; Now let’s run the test script to create a sample diagram:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; Since we’re having issues with Python dependencies, let’s create a simple test diagram manually and place it in the input directory&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; Perfect! The Architectural Diagram Threat Analyzer is working successfully. Here’s a summary of what we’ve accomplished:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Test:&lt;/strong&gt; I tested with more architectural diagrams and Q created reports.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F912%2F0%2A2-8E8o0FcZMFKUBd" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F912%2F0%2A2-8E8o0FcZMFKUBd" width="912" height="239"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2A8_nwB7gTJvdnGO5v" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2A8_nwB7gTJvdnGO5v" width="1024" height="651"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F949%2F0%2AFjuivxSlCMhR7pgx" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F949%2F0%2AFjuivxSlCMhR7pgx" width="949" height="589"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Summary:&lt;/strong&gt; If you are still with me at the end of this long article, thank you for reading this far. I ended up really loving Amazon Q Developer, both the CLI and installed within my IDE. I especially loved the persistence of Q Developer, to work through the problems that come up in different environments. I would not have worked that hard to make my program function in WSL, but Q did keep attempting to execute new ideas until something worked. The repo for this latter WSL project is &lt;a href="https://github.com/mgbec/ThreatModelingWithWSL" rel="noopener noreferrer"&gt;mgbec/ThreatModelingWithWSL: created with Amazon Q Developer on Windows Subsystem for Linux&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Much time wasting and aggravation was prevented, so thanks again, Q!&lt;/p&gt;

</description>
      <category>threatmodeling</category>
      <category>amazonq</category>
      <category>generativeaitools</category>
      <category>qdeveloperchallenge1</category>
    </item>
    <item>
      <title>Are You Threatening Me? Using Amazon Q Developer to Jumpstart Your Threat Modeling Process</title>
      <dc:creator>mgbec</dc:creator>
      <pubDate>Mon, 21 Jul 2025 22:06:52 +0000</pubDate>
      <link>https://forem.com/aws-builders/are-you-threatening-me-using-amazon-q-developer-to-jumpstart-your-threat-modeling-process-58gj</link>
      <guid>https://forem.com/aws-builders/are-you-threatening-me-using-amazon-q-developer-to-jumpstart-your-threat-modeling-process-58gj</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F717%2F0%2AoBsEwNErluU5UFGo" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F717%2F0%2AoBsEwNErluU5UFGo" width="717" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Amazon Q Developer is a quick and easy way to set up threat modeling from the command line. I started from scratch and in less than 10 minutes I had a fully functional Python program that scanned architectural diagrams and spit out threat modeling and risk information. My favorite part of the whole process is how quickly you can add new features and fix errors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install :&lt;/strong&gt; I started out by installing Q Developer in Visual Studio Code — &lt;a href="https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/q-in-IDE.html" rel="noopener noreferrer"&gt;Using Amazon Q Developer in the IDE — Amazon Q Developer&lt;/a&gt;. There are also plenty of options to run it strictly as command line — see directions for &lt;a href="https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line.html" rel="noopener noreferrer"&gt;Using Amazon Q Developer on the command line — Amazon Q Developer&lt;/a&gt;. I chose the link to install from the Visual Studio Marketplace.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sign In :&lt;/strong&gt; After a very quick install, you are asked to sign in with either your AWS Builder ID or your organization’s SSO. You can sign up for a Builder ID to use the free tier of Q Developer — &lt;a href="https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/getting-started-builderid.html" rel="noopener noreferrer"&gt;Getting started with a personal account (Builder ID) — Amazon Q Developer&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt :&lt;/strong&gt; So far, so easy, right? Q Developer greets you and summarizes some of the things you can do. You can also select a different model to use in the dropdown at the bottom of the chat window. I used Claude Sonnet 3.7.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F343%2F0%2AGGEBkaGez5sFDglK" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F343%2F0%2AGGEBkaGez5sFDglK" width="343" height="249"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This was my first prompt to Q Developer:&lt;/p&gt;

&lt;p&gt;“can you create a Python based program that can ingest architectural diagrams and produce threat modeling and risk assessment information for those diagrams. Please make sure documentation, logging, and error handling is included”&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Watch and give permissions:&lt;/strong&gt; Yeah, it’s that simple. Q Developer came up with a plan and asked me to give permissions to create a new directory.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F769%2F0%2APa_Xp0H3BlZv7Ate" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F769%2F0%2APa_Xp0H3BlZv7Ate" width="769" height="409"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Look at results:&lt;/strong&gt; in less than five minutes, Q produced the code, complete with documentation, logging and error handling. You are given the implementation details, and a command to run your new threat modeling program.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F811%2F0%2AdijUrnXR4sY8FZ4a" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F811%2F0%2AdijUrnXR4sY8FZ4a" width="811" height="558"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Run the Program:&lt;/strong&gt; I created a Python virtual environment and installed the requirements in my threat modeling program directory. Q Developer had already created a requirements.txt file for easy installation.&lt;/p&gt;

&lt;p&gt;python -m venv venv&lt;br&gt;&lt;br&gt;
venv\Scripts\activate.ps1&lt;br&gt;&lt;br&gt;
pip3 install -r requirements.txt&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Adjust:&lt;/strong&gt; I did run into an error with pdf generation for the report. My next prompt to Q was “I am getting this error ERROR — Error generating PDF report: ‘latin-1’ codec can’t encode character ‘\u2022’ in position 1527: ordinal not in range(256).”&lt;/p&gt;

&lt;p&gt;I actually was a little excited that the error handling Q Developer put in place went well here. I still received a threat modeling report, just in markdown, not pdf.&lt;/p&gt;

&lt;p&gt;Q Developer then explained and fixed the error.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F795%2F0%2ADbGHvjn4A8aYUmMw" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F795%2F0%2ADbGHvjn4A8aYUmMw" width="795" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My next command line run worked flawlessly and produced a pdf report.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ask for more:&lt;/strong&gt; we always want more, right? I asked for more threats to be reported on:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F826%2F0%2AaJdFS_CgewC8rKdX" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F826%2F0%2AaJdFS_CgewC8rKdX" width="826" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Q Developer suggested a number of ways to build in additional threat information and explained the information that was added to my program:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F937%2F0%2ARJiAzKqPhQMTYNeQ" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F937%2F0%2ARJiAzKqPhQMTYNeQ" width="937" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Test:&lt;/strong&gt; Now I tested more architectural diagrams and kept running them on the command line. For example:&lt;/p&gt;

&lt;p&gt;arch_threat_modeler&amp;gt; python main.py ./GameProduction.png — output reportgameproduction.pdf — format pdf — threat-db custom_threats.json — verbose&lt;/p&gt;

&lt;p&gt;The program was producing pdfs instantaneously! Oh my!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F522%2F0%2AsELKdkWND02LowJP" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F522%2F0%2AsELKdkWND02LowJP" width="522" height="294"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The pdfs produced are not fancy, but I’m sure we could definitely improve our workflow to make them prettier. We get an executive summary followed by identified threats, risk score, and mitigations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2ABHuo9rkepyDB7Koz" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2ABHuo9rkepyDB7Koz" width="1024" height="745"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F934%2F0%2AmMTKQ2W1ODS5RrFQ" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F934%2F0%2AmMTKQ2W1ODS5RrFQ" width="934" height="814"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, all in all, a nice start to threat modeling, with the code written in under ten minutes. Thanks, Amazon Q Developer! Code available here &lt;a href="https://github.com/mgbec/moreThreatModeling" rel="noopener noreferrer"&gt;mgbec/moreThreatModeling: Amazon Q developer wrote this&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you would like to read about my experiences with Q CLI: &lt;a href="https://dev.to/aws-builders/part-2-are-you-threatening-me-using-aws-q-cli-for-your-threat-modeling-program-42oj"&gt;https://dev.to/aws-builders/part-2-are-you-threatening-me-using-aws-q-cli-for-your-threat-modeling-program-42oj&lt;/a&gt;&lt;/p&gt;

</description>
      <category>qdevelopercli</category>
      <category>generativeaitools</category>
      <category>aws</category>
      <category>threatmodeling</category>
    </item>
    <item>
      <title>Google Gemini CLI- the self-taught AI assistant</title>
      <dc:creator>mgbec</dc:creator>
      <pubDate>Tue, 01 Jul 2025 14:27:04 +0000</pubDate>
      <link>https://forem.com/mgbec/google-gemini-cli-the-self-taught-ai-assistant-41mn</link>
      <guid>https://forem.com/mgbec/google-gemini-cli-the-self-taught-ai-assistant-41mn</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F474%2F0%2A2-bV9DKF4V8lGoFc" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F474%2F0%2A2-bV9DKF4V8lGoFc" width="474" height="237"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We want a multitude of things from our AI systems. We want them to be quick, accurate, and cost efficient, just to start with. Traditionally, keeping our systems current could mean something as manual as retraining a model or updating a knowledge base. This is starting to be more and more an issue of the past. I recently tried Google Gemini CLI and the aspect that impressed me the most was the ability to quickly readjust and learn.&lt;/p&gt;

&lt;p&gt;Installing Gemini CLI is very quick, and you most likely will be done in a few minutes. The Gemini CLI repository is here: &lt;a href="https://github.com/google-gemini/gemini-cli" rel="noopener noreferrer"&gt;GitHub — google-gemini/gemini-cli: An open-source AI agent that brings the power of Gemini directly into your terminal.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I asked Gemini to write a program that could ingest architectural diagrams and produce threat modeling and risk information. Gemini was quick to produce a Python program for me to run with the correct logic. My first attempt at running the program stopped with an error about a deprecated model: “An error occurred during architecture parsing: 404 Gemini 1.0 Pro Vision has been deprecated…”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AnFVN0xBBc-x4gDkN" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AnFVN0xBBc-x4gDkN" width="1024" height="576"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Well okay, I can’t claim perfection either. I copy and pasted the error into the Gemini prompt and received an immediate suggested fix for the deprecated version. I agreed to the fixed code and it was updated.&lt;/p&gt;

&lt;p&gt;The program successfully ran this time, but the output file,’Threat_Model_Report.md’, was missing threat and risk information. Gemini added some print statements to the code to troubleshoot this issue and asked me to provide the returned text.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AELl8uBJsO3iczPsF" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AELl8uBJsO3iczPsF" width="1024" height="576"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This helped pinpoint the issue and Gemini supplied a fix.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AFhFUtwreyb-CBySj" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AFhFUtwreyb-CBySj" width="1024" height="576"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, my program was working well. Gemini suggested enhancements with smarter risk assessment and enhanced reporting.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2A9siRDaK_KgiXLV4o" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2A9siRDaK_KgiXLV4o" width="1024" height="576"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I ran the updated program and received a fairly detailed report.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2A0ed4oUvcNxOvKEry" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2A0ed4oUvcNxOvKEry" width="1024" height="576"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I closed out my session and Gemini gave me statistics on my token usage and run time. At this point in time Gemini CLI free tier has a context token window of 1,000,000 with an output token limit of 8192.&lt;/p&gt;

&lt;p&gt;So, I spent about ten minutes building this, including the corrections proposed by Gemini CLI. All of this, at no cost to me. Pretty amazing, but what really impressed me was the adaptation and self-correction. If anyone wants to look at the code Gemini produced, here is a link — &lt;a href="https://github.com/mgbec/threat-modeling-agents.git" rel="noopener noreferrer"&gt;https://github.com/mgbec/threat-modeling-agents.git&lt;/a&gt;. We could, of course, go much further with this program and add more features or refine outputs.&lt;/p&gt;

&lt;p&gt;Thanks for reading and I highly recommend trying it yourself!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>gemini</category>
      <category>agenticai</category>
    </item>
    <item>
      <title>Observe and Report (and Prevent) — keeping an eye on your AI with CloudWatch and CloudTrail.</title>
      <dc:creator>mgbec</dc:creator>
      <pubDate>Wed, 28 May 2025 23:26:20 +0000</pubDate>
      <link>https://forem.com/aws-builders/observe-and-report-and-prevent-keeping-an-eye-on-your-ai-with-cloudwatch-and-cloudtrail-1h7i</link>
      <guid>https://forem.com/aws-builders/observe-and-report-and-prevent-keeping-an-eye-on-your-ai-with-cloudwatch-and-cloudtrail-1h7i</guid>
      <description>&lt;h3&gt;
  
  
  Observe and Report (and Prevent) — keeping an eye on your AI with CloudWatch and CloudTrail.
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F300%2F0%2AurUOaU-CeLJe-82N" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F300%2F0%2AurUOaU-CeLJe-82N" width="300" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Artificial intelligence components and data are evolving at rapid-fire speed. How are we supposed to keep tabs on performance, usage, and security?&lt;/p&gt;

&lt;p&gt;Our old familiar friends, CloudWatch and CloudTrail, can step up to the plate and monitor our fast moving Bedrock environments. Of course CloudWatch and CloudTrail can monitor all of the usual components that might make up our Bedrock workflow, whether it is API Gateway, Lambda, Dynamo, or something else. For Bedrock itself, there are some specific metrics and data that pertain directly to Bedrock that we can log, measure, and dashboard in CloudWatch and CloudTrail. Likewise, we can generate alarms, or trigger actions based on Bedrock data. More details are available here: &lt;a href="https://docs.aws.amazon.com/bedrock/latest/userguide/monitoring.html." rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/bedrock/latest/userguide/monitoring.html.&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  CloudWatch
&lt;/h3&gt;

&lt;p&gt;To get started in CloudWatch, we just need two quick steps:&lt;/p&gt;

&lt;p&gt;First, create a CloudWatch log group:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F821%2F0%2AQnpRPtwlFg-c5eRl" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F821%2F0%2AQnpRPtwlFg-c5eRl" width="821" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Second, we need to enable Model invocation logging in Bedrock Settings, under the Bedrock configurations sidebar. I am going to include all data types in my logs, just send the logs to CloudWatch, and create a new service role to do this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F866%2F0%2AkaPzf3c8o19-WEZz" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F866%2F0%2AkaPzf3c8o19-WEZz" width="866" height="633"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let’s get some data to look at. I invoked a few different models and agents that I had created previously.&lt;/p&gt;

&lt;p&gt;CloudWatch will not only have the details for the components of your workflow, like Lambda or DynamoDB, but now you will see Bedrock invocation details in your log group.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F901%2F0%2AvQuUsxImEDqv2KWN" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F901%2F0%2AvQuUsxImEDqv2KWN" width="901" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can analyze these log details with Log Insights:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F893%2F0%2AnKZeM8EJoTboZKOJ" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F893%2F0%2AnKZeM8EJoTboZKOJ" width="893" height="580"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We could also use some of the other CloudWatch functionality such as Metrics, Anomaly Detector, and Alarms. A pre-created Dashboard for Bedrock Metrics that has the following fields but we could certainly customize:&lt;/p&gt;

&lt;p&gt;-Invocation Count&lt;br&gt;&lt;br&gt;
-Invocation Latency&lt;br&gt;&lt;br&gt;
-Token Counts by Model&lt;br&gt;&lt;br&gt;
-Daily Total Tokens by ModelID&lt;br&gt;&lt;br&gt;
-Input Token Count, Output Token Count&lt;br&gt;&lt;br&gt;
-Requests Grouped by input tokens&lt;br&gt;&lt;br&gt;
-Invocation Throttles&lt;br&gt;&lt;br&gt;
-Invocation Error Count&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AmG9-RxlxW9nkGeKV" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AmG9-RxlxW9nkGeKV" width="1024" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There is also specific data for some optional components of your workflow- like Knowledge Bases, Guardrails, and Agents.&lt;/p&gt;

&lt;h4&gt;
  
  
  Knowledge bases:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-bases-logging.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-bases-logging.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Knowledge base logs will need to be enabled first and there are data ingestion level logs and resource level logs. Data ingestion logs provide ingestion job information like data source id, number of resources updated, ingested, deleted, and more. Resource level logs give us details about the status of the ingestion logs in the pipeline. Is it scheduled, embedded, indexed, partially done, or failed?&lt;/p&gt;

&lt;h4&gt;
  
  
  Guardrails:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/bedrock/latest/userguide/monitoring-guardrails-cw-metrics.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/bedrock/latest/userguide/monitoring-guardrails-cw-metrics.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Guardrails are an important part of our Bedrock environment and need attention for both security and performance factors. Metrics include:&lt;/p&gt;

&lt;p&gt;-Invocations&lt;br&gt;&lt;br&gt;
-InvocationLatency&lt;br&gt;&lt;br&gt;
-InvocationClientErrors&lt;br&gt;&lt;br&gt;
-InvocationServerErrors&lt;br&gt;&lt;br&gt;
-InvocationThrottles&lt;br&gt;&lt;br&gt;
-InvocationsIntervened&lt;br&gt;&lt;br&gt;
-TextUnitCount&lt;/p&gt;

&lt;p&gt;“InvocationsIntervened” is a specific metric for Guardrails giving us the number of invocations where Guardrails took action and intervened.&lt;/p&gt;

&lt;p&gt;“TextUnitCount” takes a little more explanation. A text unit is up to 1000 characters. This unit helps AWS determine what to charge for the enabled Guardrail policies. Different types of policies may have different pricing per cost unit than others.&lt;/p&gt;

&lt;h4&gt;
  
  
  Agents:
&lt;/h4&gt;

&lt;p&gt;Agents are another component that have metrics we can look at-&lt;br&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/bedrock/latest/userguide/monitoring-agents-cw-metrics.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/bedrock/latest/userguide/monitoring-agents-cw-metrics.html&lt;/a&gt; . Metrics included are:&lt;br&gt;&lt;br&gt;
-InvocationCount&lt;br&gt;&lt;br&gt;
-TotalTime&lt;br&gt;&lt;br&gt;
-TTFT&lt;br&gt;&lt;br&gt;
-InvocationThrottles&lt;br&gt;&lt;br&gt;
-InvocationServerErrors&lt;br&gt;&lt;br&gt;
-InvocationClientErrors&lt;br&gt;&lt;br&gt;
-ModelLatency&lt;br&gt;&lt;br&gt;
-ModelInvocationCount&lt;br&gt;&lt;br&gt;
-ModelInvocationThrottles&lt;br&gt;&lt;br&gt;
-ModelInvocationClientErrors&lt;br&gt;&lt;br&gt;
-ModelInvocationServerErrors&lt;br&gt;&lt;br&gt;
-InputTokenCount&lt;br&gt;&lt;br&gt;
-OutputTokenCount&lt;/p&gt;

&lt;p&gt;TTFT is “time to first token” and is only given when streaming configuration is turned on for the agent request.&lt;/p&gt;

&lt;h3&gt;
  
  
  CloudTrail
&lt;/h3&gt;

&lt;p&gt;Amazon Bedrock Runtime API operations are management events, which are logged by default in CloudTrail. These include:Invoke Model, InvokeModelWithResponseStream, Converse, and ConverseStream.&lt;/p&gt;

&lt;p&gt;Agents for Amazon Bedrock Runtime API operations are data events, and not logged by default. These are InvokeAgent, InvokeInlineAgent,Retrieve, RetrieveandGenerate,InvokeFlow, and RenderPrompt.&lt;/p&gt;

&lt;p&gt;If you would like to get your CloudTrail data events included, you can enable data event logging.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/bedrock/latest/userguide/logging-using-cloudtrail.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/bedrock/latest/userguide/logging-using-cloudtrail.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To enable the data events for Bedrock:&lt;/p&gt;

&lt;p&gt;First, create a new Trail in CloudTrail. Then, click into the new trail and enable data event collection.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AMy4F1tL2TLJskkBE" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AMy4F1tL2TLJskkBE" width="1024" height="156"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F797%2F0%2A9IgqrAVcDgP3-u1k" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F797%2F0%2A9IgqrAVcDgP3-u1k" width="797" height="552"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The dropdown menu for Resource type will have Bedrock resources. Currently the resource types available are Bedrock Agent Alias, Bedrock Blueprint, Bedrock Data Automation Profile, Bedrock Data Automation Project, Bedrock Flow Alias, Bedrock Guardrail, Bedrock Invoke Inline-Agent, Bedrock Knowledge Base, Bedrock Model, Bedrock Prompt, and Bedrock Session. Choose your options and run some models to generate data.&lt;/p&gt;

&lt;p&gt;You can navigate to CloudTrail and click the link to the S3 bucket. Analyze with your choice of tools, whether it is OpenSearch, a SIEM, or something else.&lt;/p&gt;

&lt;p&gt;So, what are we looking for in CloudTrail and CloudWatch? Performance and observability, of course, and expenditure review. However, if I wanted to look for security related events, what could I see?&lt;/p&gt;

&lt;p&gt;Some attacks on our AI resources could be caught further outside of the ring of fire, in the usual AWS ways, like API Gateway, CloudFront, and WAF. With a layered defense approach, we would want to look for multiple indicators of attacks or compromise throughout the AI workflow. Some things to watch in CloudWatch and CloudTrail logs and metrics include:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt analysis&lt;/strong&gt; : in CloudWatch logs, the prompt is returned in full, letting us analyze any anomalies or indicators of misuse.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F817%2F0%2AKz6W5s0q-WXD38hX" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F817%2F0%2AKz6W5s0q-WXD38hX" width="817" height="59"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The CloudWatch automatic Bedrock dashboard also can show us anomalous use of input tokens and there is a specific graph that would help us see if we are getting inputs that do not follow our standard pattern- “Requests, grouped by input tokens”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F942%2F0%2AlqBiN9LECb64oQZK" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F942%2F0%2AlqBiN9LECb64oQZK" width="942" height="161"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Response analysis:&lt;/strong&gt; in CloudWatch logs, we also get to see the full response to the prompt. We will need to evaluate these for things like sensitive or proprietary information disclosure. We will also want to look for hallucinations, illogical responses, or generation of harmful content.&lt;/p&gt;

&lt;p&gt;This is the point where I realized that when I set up Bedrock Model invocation logging, I should have specified both S3 and CloudWatch Logs as the logging destination. I’m missing the full response, since just sending the logs to CloudWatch logs will limit output JSON bodies to 100KB in size.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-invocation-logging.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/bedrock/latest/userguide/model-invocation-logging.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AoFaMXkTJFCfMbcPH" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AoFaMXkTJFCfMbcPH" width="1024" height="72"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I went back, created a new bucket and changed this logging destination. I ran a few more invocations and confirmed that I am now getting the full response.&lt;/p&gt;

&lt;p&gt;Again, the CloudWatch automatic Bedrock dashboard also can show us anomalous use of output tokens and also graphs “InputTokenCount” against “OutputTokenCounts. “OutputImageCount” is another metric you could watch, but it’s not in the current automatic dashboard.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Performance Degradation:&lt;/strong&gt; the CloudWatch Metrics automatic Bedrock dashboard is a great place to look for signs of this. Variance in invocation throttles, latency, and errors are included in the standard dashboard. Increased and unexpected invocations is also an indicator. Other metrics that you could set up monitoring for are InvocationClientErrors and InvocationServerErrors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CloudTrail indicators:&lt;/strong&gt; unexpected changes in API calls can have a number of origins. I mentioned enabling data event in addition to management event collection above. Specific to Bedrock, the Bedrock API Reference &lt;a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_Operations_Amazon_Bedrock.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/bedrock/latest/APIReference/API_Operations_Amazon_Bedrock.html&lt;/a&gt; can help us understand what we might be looking for. We can also look at agent specific API calls &lt;a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_Operations_Agents_for_Amazon_Bedrock.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/bedrock/latest/APIReference/API_Operations_Agents_for_Amazon_Bedrock.html&lt;/a&gt;. Indicators of Bedrock compromise or attack would also show up in API calls to non-Bedrock resources, like S3 or DynamoDB.&lt;/p&gt;

&lt;p&gt;Similar to all aspects of information security, monitoring Bedrock resources for indicators of an attack is a layered and reiterated task. Also similar to the AI field, as a whole, the tools we will use to monitor performance and security will keep evolving and changing. What does that mean for us as security professionals? I don’t think we will run out of things to learn any time soon- more brains required, donuts optional.  Thanks for reading and let me know if you have any questions or comments!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F449%2F0%2A2nrKzY7JP7xau_Y2" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F449%2F0%2A2nrKzY7JP7xau_Y2" width="449" height="549"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>amazonbedrockagents</category>
      <category>aisecurity</category>
      <category>awsbedrock</category>
      <category>informationsecurity</category>
    </item>
    <item>
      <title>MCP Security: Tr-tr-tr-tricky, tricky, tricky</title>
      <dc:creator>mgbec</dc:creator>
      <pubDate>Wed, 14 May 2025 01:17:21 +0000</pubDate>
      <link>https://forem.com/aws-builders/mcp-security-tr-tr-tr-tricky-tricky-tricky-2a1j</link>
      <guid>https://forem.com/aws-builders/mcp-security-tr-tr-tr-tricky-tricky-tricky-2a1j</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F566%2F0%2A1m9NmNiOxdXeWwBe" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F566%2F0%2A1m9NmNiOxdXeWwBe" width="566" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The GitHub MCP Server looked like the perfect fit for a project I am working on. Connecting to the GitHub MCP from VSCode was actually not super tricky, but I do see some risks that will make securing MCP systems less than easy. I’ll walk through the process of adding this MCP server and some of the risks we will want to think about.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setup
&lt;/h3&gt;

&lt;p&gt;Here are the official instructions from GitHub- &lt;a href="https://github.com/github/github-mcp-server" rel="noopener noreferrer"&gt;https://github.com/github/github-mcp-server&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I ended up using the manual install option and choosing to run it in Docker. You’ll go into user preferences and add this into Preferences: Open User Settings (JSON), replacing the personal access token with your own.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "mcp": {
    "inputs": [
      {
        "type": "promptString",
        "id": "github_token",
        "description": "GitHub Personal Access Token",
        "password": true
      }
    ],
    "servers": {
      "github": {
        "command": "docker",
        "args": [
          "run",
          "-i",
          "--rm",
          "-e",
          "GITHUB_PERSONAL_ACCESS_TOKEN",
          "ghcr.io/github/github-mcp-server"
        ],
        "env": {
          "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}"
        }
      }
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are the toolsets available at this point in time:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe2n52k3ex0pdcj74253r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe2n52k3ex0pdcj74253r.png" width="603" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You could install it with limited toolsets, but I chose to install them all.&lt;br&gt;&lt;br&gt;
Once installed you can select certain ones to use.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fec2w94lzshy73i6ph0ho.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fec2w94lzshy73i6ph0ho.png" width="600" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Testing
&lt;/h3&gt;

&lt;p&gt;I had a deliberately vulnerable test repository from StackHawk: &lt;a href="https://github.com/kaakaww" rel="noopener noreferrer"&gt;https://github.com/kaakaww&lt;/a&gt; and ran some of the GitHub MCP tools against it. It gave me the code scanning alerts for the repo I wanted in a nicely formatted list.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F891%2F0%2A4AylpD0O3Ugj9_Y5" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F891%2F0%2A4AylpD0O3Ugj9_Y5" width="891" height="669"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It correctly determined that this particular repo had no Secret Scanning alerts and was able to list all of my repositories.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F700%2F0%2AsngKnKatcI8UiyDu" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F700%2F0%2AsngKnKatcI8UiyDu" width="700" height="922"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I asked which vulnerability I should fix first and was given a recommendation:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F718%2F0%2Av2sazRQRJDr1-wEL" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F718%2F0%2Av2sazRQRJDr1-wEL" width="718" height="670"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I asked for specific code fixes and received suggestions:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F710%2F0%2Ablss4h_Xh7Dnvox2" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F710%2F0%2Ablss4h_Xh7Dnvox2" width="710" height="706"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fixing the code automatically seemed to require that the code was stored locally.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F902%2F0%2A8o3xgFBUpE3mLMSf" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F902%2F0%2A8o3xgFBUpE3mLMSf" width="902" height="268"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All cool stuff, right? But there is no way that this is the end of the story….&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F455%2F0%2AIGH7cxWPGk2WEHZK" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F455%2F0%2AIGH7cxWPGk2WEHZK" width="455" height="285"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s talk about security. In this particular scenario, I am running this MCP server locally in Docker and using a fairly tightly scoped GitHub personal access token. That could help with some risk reduction but there is much more I need to consider before I take this out for a ride in an enterprise.&lt;/p&gt;

&lt;p&gt;In general, some MCP threats include:&lt;/p&gt;

&lt;p&gt;-Prompt injection&lt;br&gt;&lt;br&gt;
-MCP server compromise&lt;br&gt;&lt;br&gt;
-Tool poisoning&lt;br&gt;&lt;br&gt;
-Data leakage&lt;br&gt;&lt;br&gt;
-Unauthorized access&lt;br&gt;&lt;br&gt;
-Potential for DDoS, excessive resource utilization and costs&lt;br&gt;&lt;br&gt;
-Lack of humans in the loop, for consent, feedback, and transparency&lt;br&gt;&lt;br&gt;
-Lack of observability&lt;/p&gt;

&lt;p&gt;MCP is still new enough to have plenty of security kinks to work out but efforts are being made by multiple sources. The MCP specification &lt;a href="https://modelcontextprotocol.io/specification/2025-03-26" rel="noopener noreferrer"&gt;https://modelcontextprotocol.io/specification/2025-03-26&lt;/a&gt; has a specific section for “Security and Trust &amp;amp; Safety”. User consent and privacy is a key piece of this. The protocol roadmap also includes features that will increase security.&lt;/p&gt;

&lt;p&gt;I can’t write an article without mentioning OWASP and yes, they do have MCP security advice- &lt;a href="https://genai.owasp.org/2025/04/22/securing-ais-new-frontier-the-power-of-open-collaboration-o" rel="noopener noreferrer"&gt;https://genai.owasp.org/2025/04/22/securing-ais-new-frontier-the-power-of-open-collaboration-o&lt;/a&gt;n-mcp-security/.&lt;/p&gt;

&lt;p&gt;AWS has guidance for secure deployment on their platform- &lt;a href="https://aws.amazon.com/solutions/guidance/deploying-model-context-protocol-servers-on-aws/" rel="noopener noreferrer"&gt;https://aws.amazon.com/solutions/guidance/deploying-model-context-protocol-servers-on-aws/&lt;/a&gt;. There is an included architectural diagram that shows a layered security approach toward MCP server interactions, including OAuth 2.0 authentication using Cognito and token storage with DynamoDB.&lt;/p&gt;

&lt;p&gt;The centerpiece of the authentication and authorization is an MCP Auth Service, which runs in a secure virtual private cloud (VPC) on &lt;a href="https://aws.amazon.com/fargate/" rel="noopener noreferrer"&gt;AWS Fargate&lt;/a&gt;. MCP Auth Service works with DynamoDB and Cognito to send tokens to the MCP client, routing through the AWS Application Load Balancer and CloudFront.&lt;/p&gt;

&lt;p&gt;Some of the other factors accounted for are observability using CloudWatch, rate limiting, web attacks, isolation with security groups, and through containerization. In-transit encryption is provided through CloudFront and throughout the AWS environment.&lt;/p&gt;

&lt;p&gt;The CDK code for this project is included here: &lt;a href="https://github.com/aws-solutions-library-samples/guidance-for-deploying-model-context-protocol-servers-on-aws?tab=readme-ov-file#overview" rel="noopener noreferrer"&gt;https://github.com/aws-solutions-library-samples/guidance-for-deploying-model-context-protocol-servers-on-aws?tab=readme-ov-file#overview&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F972%2F0%2A50FSE9vuISnQME3O" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F972%2F0%2A50FSE9vuISnQME3O" width="972" height="670"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, If you would like to experiment with some of the threats you might encounter with an MCP deployment, there is a deliberately vulnerable MCP server to try to exploit at &lt;a href="https://github.com/harishsg993010/damn-vulnerable-MCP-server" rel="noopener noreferrer"&gt;https://github.com/harishsg993010/damn-vulnerable-MCP-server&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Some of the vulnerabilities you can try to exploit are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Prompt Injection: Manipulating LLM behavior through malicious inputs&lt;/li&gt;
&lt;li&gt;Tool Poisoning: Hiding malicious instructions in tool descriptions&lt;/li&gt;
&lt;li&gt;Excessive Permissions: Exploiting overly permissive tool access&lt;/li&gt;
&lt;li&gt;Rug Pull Attacks: Exploiting tool definition mutations&lt;/li&gt;
&lt;li&gt;Tool Shadowing: Overriding legitimate tools with malicious ones&lt;/li&gt;
&lt;li&gt;Indirect Prompt Injection: Injecting instructions through data sources&lt;/li&gt;
&lt;li&gt;Token Theft: Exploiting insecure token storage&lt;/li&gt;
&lt;li&gt;Malicious Code Execution: Executing arbitrary code through vulnerable tools&lt;/li&gt;
&lt;li&gt;Remote Access Control: Gaining unauthorized system access&lt;/li&gt;
&lt;li&gt;Multi-Vector Attacks: Combining multiple vulnerabilities&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It is safe to say that threats to MCP servers and our associated resources will continue to evolve as fast as the AI landscape has been changing. Hold on to your hats and thanks for reading!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg08fcxnm0h1etjpj9i5c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg08fcxnm0h1etjpj9i5c.png" width="600" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>aws</category>
      <category>mcpserver</category>
    </item>
    <item>
      <title>Let’s Build Agents!</title>
      <dc:creator>mgbec</dc:creator>
      <pubDate>Fri, 25 Apr 2025 19:27:41 +0000</pubDate>
      <link>https://forem.com/mgbec/lets-build-agents-25a2</link>
      <guid>https://forem.com/mgbec/lets-build-agents-25a2</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AIfTKtnEyDCI-YTEy" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AIfTKtnEyDCI-YTEy" width="760" height="570"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I’ve been doing a bit of research into generative AI and security. My last article focused on security risks in a simple bot- &lt;a href="https://medium.com/@mgbecken/for-those-about-to-bedrock-751fbc804012." rel="noopener noreferrer"&gt;https://medium.com/@mgbecken/for-those-about-to-bedrock-751fbc804012.&lt;/a&gt; This time around I wanted to experiment with Bedrock agents and investigate some of the things that are specific to agentic AI. Some distinct issues include:&lt;/p&gt;

&lt;p&gt;Complexity and orchestration of tasks performed&lt;br&gt;&lt;br&gt;
Potential access of enterprise data sources&lt;br&gt;&lt;br&gt;
Ability to perform real time tasks with real time data&lt;br&gt;&lt;br&gt;
Tooling integration&lt;br&gt;&lt;br&gt;
Memory- both long term and short term&lt;/p&gt;

&lt;p&gt;Once again, OWASP has some excellent material to read- &lt;a href="https://genai.owasp.org/resource/agentic-ai-threats-and-mitigations/" rel="noopener noreferrer"&gt;https://genai.owasp.org/resource/agentic-ai-threats-and-mitigations/&lt;/a&gt; directly addresses agent scenarios.&lt;/p&gt;

&lt;p&gt;Another great article — &lt;a href="https://cloudsecurityalliance.org/blog/2025/02/06/agentic-ai-threat-modeling-framework-maestro#" rel="noopener noreferrer"&gt;Agentic AI Threat Modeling Framework: MAESTRO | CSA&lt;/a&gt;. breaks threat modeling and potential mitigation into a layered framework.&lt;/p&gt;

&lt;p&gt;A wonderful GitHub repo with incredible information is — &lt;a href="http://github.com/precize/OWASP-Agentic-AI" rel="noopener noreferrer"&gt;github.com/precize/OWASP-Agentic-AI&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As I build a simple single agent application, I wanted to think through and comment on some of the security issues. I broke my categories of possible issues to address into three rough steps at this point- “Prebuild”, “During Build”, and “Postbuild”. Many of these topics are not specific to agentic AI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PREBUILD&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Marketplace&lt;/strong&gt; :&lt;br&gt;&lt;br&gt;
Choosing our foundation model- possible threats are a noncompliant model and trustworthy model information. I talked about this in my last article, so I won’t go into detail here.&lt;br&gt;&lt;br&gt;
This time around I am using Amazon Nova Micro as a foundation model for cost and performance reasons. I am building my own agents in Bedrock but in a different situation, I would need to think about secure agent selection.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Threat Modeling:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The articles above have some great places to start. There are quite a few factors to consider depending on your architecture.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Is my data AI ready? Is it labeled with access restrictions and other metadata?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Operations planning:&lt;br&gt;&lt;br&gt;
 — &lt;/strong&gt; Plan for keeping our CICD workflow secure to prevent IaC manipulation. You could also use code signing and integrity verification.&lt;/p&gt;

&lt;p&gt;— Plan on control- what boundaries and constraints can we set up between components, users, roles, and agents?&lt;/p&gt;

&lt;p&gt;— Plan for updates and vulnerability management. An AI BOM would be helpful here to detail all the components you will be using from data and algorithms to dependencies and metadata. We would want to have a system for supply chain monitoring.&lt;/p&gt;

&lt;p&gt;— Plan your operations monitoring and incident response strategy. How will we detect problems and attacks and how will we respond to them? What type of communications will we have in place and will we have a feedback loop to self correct? Will we need system redundancies in case of failure or resource exhaustion?&lt;/p&gt;

&lt;p&gt;— Plan to train people. We might need to train our model, but we also need to train the humans in the loop. What should the end user expect? How will support deal with issues? What is the business goal?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DURING BUILD&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data&lt;/strong&gt; - what kind of data am I using, and who is allowed access? What type of authentication am I using? Am I making sure data is encrypted with modern methods? I am specifically thinking of the DeepSeek iOS app here using 3DES with hard-coded encryption credentials.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tools&lt;/strong&gt;  — How can I make sure my tools remain safe and isolated? What are our isolation requirements? We would want to make sure we have authentication, boundaries, and monitoring in place. I would also want to make sure I kept the tools up to date, so we aren’t sitting on any old vulnerabilities. We could scan the Lambda based tooling and report on outdated components in AWS to help with that.&lt;/p&gt;

&lt;p&gt;It will be interesting to see our risks evolve with MCP usage. That is next on the bucket list.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Agents&lt;/strong&gt; - we will want to think about potential hijacking and keeping multi-agent communications secure. What monitoring can we build to catch any problems? Agent to agent communication could have mutual authentication and continuous reauthentication for long running processes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompts&lt;/strong&gt; - am I being careful to have sufficient input validation? We would want to prevent code injection and system compromise. Another threat vector might be computationally expensive inputs to create resource exhaustion. An interesting threat to read about is temporal manipulation in prompts — &lt;a href="https://github.com/precize/OWASP-Agentic-AI/blob/main/agent-temporal-manipulation-timebased-attack-13.md" rel="noopener noreferrer"&gt;https://github.com/precize/OWASP-Agentic-AI/blob/main/agent-temporal-manipulation-timebased-attack-13.md&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I was picturing the look on a coworker’s face if we triggered something resource intensive at peak usage hours.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F170%2F0%2AvFWUp79_KhgJHWjb" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F170%2F0%2AvFWUp79_KhgJHWjb" width="170" height="212"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Memory-&lt;/strong&gt; we would want to prevent both memory poisoning and possible data exfiltration. Memory content validation, session isolation, encryption, and authentication would be important. We would also want to monitor memory logs for anomalies in memory storage. If we are working with sensitive data, we would want to be especially careful and make sure we are not unnecessarily retaining the data. Bedrock encrypts session information with an AWS provided key but we could use a customer managed key if necessary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Logs-&lt;/strong&gt; are they encrypted, sensitive data masked? Are they aggregated and stored for as long as is required by regulations?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Decisions&lt;/strong&gt;  — Is there decision traceability and transparency? Are these being analyzed? Is there human intervention for high risk decisions?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output &lt;/strong&gt; — is there validation and constraints to detect and prevent hallucinations, etc?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resource exhaustion&lt;/strong&gt; - possibly we can have process control policies that would trigger throttling or auto suspension if one of our parameters goes over a defined limit?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Redundancy&lt;/strong&gt;  — is this in place for high value workflows?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Alerts and feedback loop-&lt;/strong&gt; is there a way to alert on big problems and potentially fix them as we run?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Orchestration &lt;/strong&gt; — if we are using multiple agents or tools, are we able to monitor coordination and integration? I am picturing an evil orchestrator here. “Bwahaha, let me add more double bass.”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F465%2F0%2AcRo1VHVevBU9_XvP" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F465%2F0%2AcRo1VHVevBU9_XvP" width="465" height="297"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;POSTBUILD&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Logs and Traces&lt;/strong&gt;  — now it’s time to look at all the logs and traces we hopefully created in the operational step. Do we have everything we need? Are they decently easy to analyze? Can we find a digestible way to share them with non-technical managers?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Analysis-&lt;/strong&gt; is this providing the functionality and value we need? What are the costs associated with this workflow?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Vulnerabilities and observed attacks-&lt;/strong&gt; what issues do we need to fix and what is the priority? How are we going to communicate these to users who need to perform the work?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI BOM &lt;/strong&gt; — do we need to update this or update components in the build?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Foundation model &lt;/strong&gt; — do we need to switch out the model? Is it doing what we want? Could we use a cheaper model?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Continuous improvements &lt;/strong&gt; — Can we optimize anything? On this build, I definitely see some more prompt engineering needs to be done.&lt;/p&gt;

&lt;p&gt;Now it is on to my actual build procedure….&lt;/p&gt;

&lt;p&gt;1.) DynamoDB creation for two tables: I will use these two tables to look at the Dependabot Alerts and Developer Team Info. I had a previously created Dynamodb table populated with GitHub Dependabot alerts. I used GitHub CLI to get the alerts and associated data, if you want details on the process, here is a very quick article I wrote: &lt;a href="https://medium.com/@mgbecken/operation-dynamodb-wrangle-some-github-data-into-dynamodb-9947a1e99077" rel="noopener noreferrer"&gt;https://medium.com/@mgbecken/operation-dynamodb-wrangle-some-github-data-into-dynamodb-9947a1e99077&lt;/a&gt;. Security notes here, using roles, so IAM protection, baked in encryption at rest. Don’t put sensitive names or plaintext data in your Primary Key and Global Secondary Indexes, since the names will show up in your table definition.&lt;/p&gt;

&lt;p&gt;The table with alerts is called ‘concat_dependabotalert’. I also created some fake Team data to put into a DynamoDB, ‘concatTeamInfo’.&lt;/p&gt;

&lt;p&gt;2.) Create two Lambda functions to look up information in the DynamoDb tables: ‘concatAlertNumber’ and ‘concatTeamInfo’. The code for these is in my github at &lt;a href="https://github.com/mgbec/0425AgentSec." rel="noopener noreferrer"&gt;https://github.com/mgbec/0425AgentSec.&lt;/a&gt; You will also want to bump up the timeout for both of them. The default time out is 3 seconds and you will probably want more time than that.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F860%2F0%2ARIDYZtRJlpkIflS_" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F860%2F0%2ARIDYZtRJlpkIflS_" width="860" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You also need to add DynamoDB permissions to your execution role for each Lambda. In Configuration &amp;gt; Permissions click on the Role name. You will be redirected to IAM where you can click the “Add permissions” button and add the ability for this role to query the DynamoDB.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F980%2F0%2Aw2FD43z3el8zDDNe" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F980%2F0%2Aw2FD43z3el8zDDNe" width="980" height="342"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3.) Create an Open API schema: The tools my agent needs to run here are both using an OpenAPI schema to tell them how to work. You can write this in yaml or json and then put it in an S3 bucket. Security note: a potential threat vector is a malicious change to this file. We could scan this upload or file for evil doings and make sure our bucket is locked down. My OpenAPI yaml files are ConcatDependabotAlertStatus.yaml and concatTeamInfo.yaml, also available in my GitHub ‘&lt;a href="https://github.com/mgbec/0425AgentSec%E2%80%99" rel="noopener noreferrer"&gt;https://github.com/mgbec/0425AgentSec’&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4.) Now we get to build our agent. I am using Nova Micro, which is cheap, fast, and is working fine for the task at hand. More details about the Nova models:&lt;br&gt;&lt;br&gt;
Amazon Nova models, specifically Nova Micro, Nova Lite, and Nova Pro, have varying costs per 1,000 tokens. Nova Micro is the cheapest, with input tokens at $0.000035 and output tokens at $0.00014. Nova Lite is in the middle, costing $0.00006 for input tokens and $0.00024 for output tokens. Nova Pro is the most expensive, with input tokens at $0.0008 and output tokens at $0.0032.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aws.amazon.com/bedrock/pricing/" rel="noopener noreferrer"&gt;https://aws.amazon.com/bedrock/pricing/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F784%2F0%2AH1x69pPOGcZppi0g" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F784%2F0%2AH1x69pPOGcZppi0g" width="784" height="641"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One of the most important parts of building the agent is creating the ‘Instructions for the Agent’. I tried to be as specific as possible and went back and adjusted as I tested.&lt;/p&gt;

&lt;p&gt;There are additional settings that you can customize as needed. I left these as default but one potential setting that could affect security is the ‘idle session timeout’- your user’s submitted data remains in short term memory for the length of the session. The agents have additional memory configuration options, depending on the foundation model.&lt;/p&gt;

&lt;p&gt;Another setting is ‘KMS Key selection’. You could opt to use your own KMS key if that is a requirement.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AHdN7dYPrE6wtSztW" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AHdN7dYPrE6wtSztW" width="1024" height="585"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5.) Creating your action groups: (not the same thing as Azure action groups, as you might suspect.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F720%2F0%2AU73IZcQDL4s-a0Nd" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F720%2F0%2AU73IZcQDL4s-a0Nd" width="720" height="378"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is where our previous work creating our Lambda functions and OpenAPI schemas pays off. We will create an action group for each DynamoDB lookup we want to perform.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AJmdUcVGGcnAwstRS" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AJmdUcVGGcnAwstRS" width="1024" height="251"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can select the OpenAPI schema and Lambda function that corresponds with each tool.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2ALgXRdNwvs73xwoRJ" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2ALgXRdNwvs73xwoRJ" width="1024" height="636"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Save your Agent and take note of the Agent ARN, we will use it in the next step.&lt;/p&gt;

&lt;p&gt;6.) For both of your Lambda functions, you will want to let the agent have the permissions to be able to invoke them. Under Configuration&amp;gt;Permissions, you can add a resource based policy and enter the ARN of your agent in the Conditions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F482%2F0%2Ab7FU0_-ZZG5g-Bfs" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F482%2F0%2Ab7FU0_-ZZG5g-Bfs" width="482" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;7.) Now we can test our Bedrock agent. In the right side panel, you can try your input.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F515%2F0%2A28uShpw_v4KuXq8_" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F515%2F0%2A28uShpw_v4KuXq8_" width="515" height="526"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F451%2F0%2AW_WrRLAZ2szEnDEX" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F451%2F0%2AW_WrRLAZ2szEnDEX" width="451" height="330"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The traces will help you troubleshoot errors or unexpected output, and also look at the agent’s “thinking process”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F767%2F0%2AOXA_UewQ0ubyCHdk" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F767%2F0%2AOXA_UewQ0ubyCHdk" width="767" height="537"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You could possibly return the information in another format or determine what functionality you wish was there for future development.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F547%2F0%2AplhqO8TWMBIfv0ss" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F547%2F0%2AplhqO8TWMBIfv0ss" width="547" height="245"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;8.) Our next step could be to keep tweaking everything and adding more tooling. We might want to add a knowledge base or test MCP. GitHub does have an MCP server — &lt;a href="https://github.com/github/github-mcp-server." rel="noopener noreferrer"&gt;https://github.com/github/github-mcp-server.&lt;/a&gt; At the time I wrote this article, we would be able to add CodeQL or Secrets alerts. Other MCP servers I would like to check out for this particular project can create Excel workbooks and look up CVE’s.&lt;/p&gt;

&lt;p&gt;9.) Finally, if we are ready to deploy, we can create and publish a user interface in the method of our choice. This is another project on my list, to be continued. Thanks for reading!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F347%2F0%2AJbgnXhLaOE0UXNec" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F347%2F0%2AJbgnXhLaOE0UXNec" width="347" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>bedrock</category>
      <category>security</category>
      <category>ai</category>
      <category>nova</category>
    </item>
    <item>
      <title>Operation DynamoDB- wrangle some GitHub data into DynamoDB</title>
      <dc:creator>mgbec</dc:creator>
      <pubDate>Sun, 20 Apr 2025 20:34:39 +0000</pubDate>
      <link>https://forem.com/mgbec/operation-dynamodb-wrangle-some-github-data-into-dynamodb-3g0g</link>
      <guid>https://forem.com/mgbec/operation-dynamodb-wrangle-some-github-data-into-dynamodb-3g0g</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2A12H0NTKIpNnQIn1g" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2A12H0NTKIpNnQIn1g" width="800" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For a Bedrock project I am working on, I needed to get my GitHub Dependabot alerts into an AWS DynamoDB table. This may be a complete edge case, but in case it helps anybody, here is how it went:&lt;/p&gt;

&lt;p&gt;First, get your data out of GitHub using the REST API:&lt;/p&gt;

&lt;p&gt;Install GitHub CLI — &lt;a href="https://cli.github.com/" rel="noopener noreferrer"&gt;https://cli.github.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once the CLI is installed, you will need to authenticate to your GitHub account-&lt;br&gt;&lt;br&gt;
&lt;em&gt;gh auth login&lt;/em&gt;&lt;br&gt;&lt;br&gt;
Now you can call the API, see variations here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.github.com/en/rest/dependabot/alerts?apiVersion=2022-11-28" rel="noopener noreferrer"&gt;https://docs.github.com/en/rest/dependabot/alerts?apiVersion=2022-11-28&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are using data from your enterprise or organization, you will have a slightly different command line than I am showing for my personal GitHub repositories. You will also need to have the correct permissions to query the data. Also, if you are calling for an entity with quite a few alerts, you will probably want to add — paginate to get them all.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;gh api -H “Accept: application/vnd.github+json” -H “X-GitHub-Api-Version:2022–11–28” /repos/yourgithubaccount/yourrepo/dependabot/alerts &amp;gt; dependabot.json&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I redirected to a file and then I did this for the three repos I wanted to analyze. You can do it all in one fell swoop for an enterprise or organization.&lt;/p&gt;

&lt;p&gt;I am not a developer, nor do I play one on TV, but this is what worked for me in Python.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;## import your shenanigans
import pandas as pd
import boto3
import json
import awswrangler as wr

##read your json files produced by the GitHub CLI into dataframes
file_path = r"C:\Users\User\dependabot.json"
df = pd.read_json(file_path)

file_path = r"C:\Users\User\dependabot2.json"
df2 = pd.read_json(file_path)

file_path = r"C:\Users\User\dependabot3.json"
df3 = pd.read_json(file_path)

##Concatenate the files
concatdf= pd.concat([df, df2, df3])

#I ended up converting converting all the datatypes into string, which was fine in this case
concatdf = concatdf.astype(str)

## Function to trim URL path, I just want the repo name of this column. I also renamed that column to “repo”

def trim_url_path(url):
    return url.split('/')[4]  

concatdf['repo'] = concatdf['html_url'].apply(trim_url_path)

## Now let ’s wrangle my data with AWS SDK for pandas, formerly known as AWS Wrangler
wr.dynamodb.put_df(
    df=concatdf,
    table_name='concat_dependabotalert'
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Yay, and now it will upload. Note: I already had a table created in DynamoDB when I started this process. I did this a few separate times with the same amount of data and the time to upload to DynamoDB varied quite a bit. It might definitely be a user side issue- a watched table never populates. You can also use this process for GitHub CodeQL alerts, and Secrets alerts. Hope this helps somebody. Thanks for reading!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>python</category>
      <category>dynamodb</category>
    </item>
  </channel>
</rss>
