<?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>DEV Community: Sampath Karan</title>
    <description>The latest articles on DEV Community by Sampath Karan (@sampathkaran).</description>
    <link>https://dev.to/sampathkaran</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%2F1002222%2Fc0018cfe-9938-424c-8d88-63af6dadf07e.JPG</url>
      <title>DEV Community: Sampath Karan</title>
      <link>https://dev.to/sampathkaran</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sampathkaran"/>
    <language>en</language>
    <item>
      <title>AWS Bedrock AgentCore Memory: Give Your AI Agent a Brain That Actually Remembers</title>
      <dc:creator>Sampath Karan</dc:creator>
      <pubDate>Sat, 14 Mar 2026 11:51:41 +0000</pubDate>
      <link>https://dev.to/sampathkaran/aws-bedrock-agentcore-memory-give-your-ai-agent-a-brain-that-actually-remembers-12ie</link>
      <guid>https://dev.to/sampathkaran/aws-bedrock-agentcore-memory-give-your-ai-agent-a-brain-that-actually-remembers-12ie</guid>
      <description>&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Familiarity with AWS Bedrock, boto3, and building LLM-based agents.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem With Stateless Agents
&lt;/h2&gt;

&lt;p&gt;If we ship a Bedrock agent to production, we already hit this wall. Every invocation is stateless. We hack around it by stuffing conversation history into the prompt, bloating your token count, and eventually hitting context limits. Or you build your own memory layer — DynamoDB for session state, OpenSearch for semantic retrieval, some glue Lambda in between — and suddenly you're maintaining infrastructure that has nothing to do with your actual agent logic.&lt;br&gt;
AgentCore Memory is AWS's answer to this. It's a managed memory service purpose-built for agents, with three distinct memory tiers and a retrieval API that plugs directly into the Bedrock agent runtime. Let's actually use it.&lt;/p&gt;
&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;p&gt;Enabling AgentCore Memory&lt;br&gt;
First, make sure we're on a region that supports it (us-east-1, us-west-2 at GA). Create a memory store:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;python&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;

&lt;span class="n"&gt;bedrock_agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;bedrock-agent&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;region_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;us-east-1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bedrock_agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create_memory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;customer-support-memory&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Persistent memory for support agent&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;memoryConfiguration&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;enabledMemoryTypes&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SESSION_SUMMARY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SEMANTIC&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;storageDays&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;90&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;memory_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;memory&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;memoryId&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Memory store created: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;memory_id&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Store the memory_id — you'll attach it to every agent invocation. Think of it like a database connection string for our agent's brain.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Three Memory Tiers (What They Actually Do)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Session Memory
This is in-context working memory scoped to a single conversation. Bedrock manages it automatically when you pass a sessionId — you don't write to it directly. What we want to control is whether session summaries get promoted to long-term memory when the session ends.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;python&lt;/span&gt;
&lt;span class="n"&gt;bedrock_runtime&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;bedrock-agent-runtime&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;region_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;us-east-1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bedrock_runtime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;invoke_agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;agentId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YOUR_AGENT_ID&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;agentAliasId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YOUR_ALIAS_ID&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;sessionId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user-1234-session-abc&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;   &lt;span class="c1"&gt;# scopes the session memory
&lt;/span&gt;    &lt;span class="n"&gt;memoryId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;memory_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;                   &lt;span class="c1"&gt;# links to the persistent store
&lt;/span&gt;    &lt;span class="n"&gt;inputText&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;My order #9982 still hasn&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;t arrived after 10 days&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;enableTrace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Bedrock tracks everything in this session under user-1234-session-abc. When the session closes (or hits the TTL), it automatically summarises the key facts and pushes them into long-term memory.&lt;/p&gt;

&lt;p&gt;2.Long-Term (Semantic) Memory&lt;br&gt;
This is the tier that makes agents genuinely useful across sessions. Facts extracted from past conversations are embedded and stored in a managed vector store. When a new session starts, the agent runtime does semantic retrieval against this store before constructing the prompt.&lt;br&gt;
We can also write to it directly — useful for seeding known user preferences or backfilling from an existing CRM:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;python&lt;/span&gt;
&lt;span class="n"&gt;bedrock_agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;put_memory_record&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;memoryId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;memory_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;memoryRecord&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Customer John Doe (user-1234) has a Premium plan. &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
                    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Prefers resolution via email. Had delivery issue in Jan 2025.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;memoryRecordType&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SEMANTIC&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sessionId&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user-1234-bootstrap&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And to retrieve it manually (e.g., for a pre-flight check before invoking the agent):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;python&lt;/span&gt;
&lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bedrock_agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;retrieve_memory_records&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;memoryId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;memory_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;memoryRecordType&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SEMANTIC&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;searchQuery&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user-1234 preferences and history&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;maxResults&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;memoryRecordSummaries&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Score: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;score&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# cosine similarity
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The retrieval is semantic, not keyword-based. Querying "does this user have premium?" will match a record that says "subscribed to the top-tier plan" — no exact string match required.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Episodic Memory
This is the newest tier and the most powerful for iterative workflows. Episodic memory stores sequences of events — entire chains of tool calls, decisions, and outcomes — not just extracted facts. The agent can later retrieve past episodes and use them to inform strategy.
Enable it at store creation:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;python&lt;/span&gt;
&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bedrock_agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create_memory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;coding-assistant-memory&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;memoryConfiguration&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;enabledMemoryTypes&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SESSION_SUMMARY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SEMANTIC&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;EPISODIC&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;storageDays&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;180&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then tag sessions with a namespace so related episodes can be retrieved together:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;python&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bedrock_runtime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;invoke_agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;agentId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YOUR_AGENT_ID&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;agentAliasId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YOUR_ALIAS_ID&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;sessionId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user-5678-session-xyz&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;memoryId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;memory_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;inputText&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Debug why my FastAPI app returns 422 on file uploads&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;sessionAttributes&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;episodeNamespace&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user-5678-debugging&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After a few sessions, the agent accumulates episodes like: "For user-5678, file upload 422s were caused by missing Content-Type headers twice. Solution: always check middleware config first." It surfaces this automatically on the next relevant session.&lt;/p&gt;

&lt;p&gt;Controlling What Gets Remembered&lt;br&gt;
By default, AgentCore summarises everything. In production we'll need to be more aware. Use memory consolidation filters to control promotion from session → long-term:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;python&lt;/span&gt;
&lt;span class="n"&gt;bedrock_agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update_memory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;memoryId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;memory_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;memoryConfiguration&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;enabledMemoryTypes&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SESSION_SUMMARY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SEMANTIC&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;storageDays&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;90&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sessionSummaryConfiguration&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;maxRecentSessions&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;summaryPromptTemplate&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Extract only: user preferences, unresolved issues, &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;account facts. Ignore pleasantries and small talk.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The summaryPromptTemplate is a prompt sent to the underlying FM during consolidation. Customizing it prevents noise (greetings, filler, repeated questions) from polluting your long-term store.&lt;/p&gt;

&lt;p&gt;Deleting Memory (GDPR / Right to Erasure)&lt;br&gt;
This is non-negotiable in production. When a user requests data deletion:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;python&lt;/span&gt;
&lt;span class="c1"&gt;# List all records for a user
&lt;/span&gt;&lt;span class="n"&gt;records&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bedrock_agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;list_memory_records&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;memoryId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;memory_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;memoryRecordType&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SEMANTIC&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;maxResults&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Delete each one
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;records&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;memoryRecordSummaries&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user-1234&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sessionId&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;bedrock_agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;delete_memory_record&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;memoryId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;memory_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;memoryRecordId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;memoryRecordId&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or nuke the entire memory store for a user namespace if you're using per-user stores:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
&lt;span class="n"&gt;python&lt;/span&gt;
&lt;span class="n"&gt;bedrock_agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;delete_memory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;memoryId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;memory_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Architecture Pattern:
&lt;/h2&gt;

&lt;p&gt;Per-User vs Shared Memory Stores&lt;/p&gt;

&lt;h2&gt;
  
  
  Two approaches in production:
&lt;/h2&gt;

&lt;p&gt;Per-user store — one memoryId per user. Total isolation, clean deletion, but more stores to manage and higher overhead for low-activity users.&lt;br&gt;
Shared store with namespaced session IDs — one store, session IDs prefixed with user ID (user-1234-session-abc). Simpler operationally, but retrieval must filter carefully to avoid cross-user bleed. Always scope your searchQuery with user identifiers.&lt;br&gt;
For most B2C applications, the shared store with namespaced session IDs is the pragmatic choice. For enterprise multi-tenant SaaS, per-user (or per-tenant) stores are worth the overhead for the isolation guarantees.&lt;/p&gt;
&lt;h2&gt;
  
  
  Observability:
&lt;/h2&gt;

&lt;p&gt;Tracing Memory Retrievals&lt;br&gt;
Enable traces to see exactly what's being pulled from memory on each invocation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;python&lt;/span&gt;
&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bedrock_runtime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;invoke_agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;agentId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YOUR_AGENT_ID&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;agentAliasId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YOUR_ALIAS_ID&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;sessionId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user-1234-session-new&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;memoryId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;memory_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;inputText&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;What was that issue I had last month?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;enableTrace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;completion&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;trace&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;trace&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;trace&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;trace&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;orchestrationTrace&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;trace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;obs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;trace&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;orchestrationTrace&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;observation&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{})&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;knowledgeBaseLookupOutput&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;obs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Memory retrieved:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;obs&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;knowledgeBaseLookupOutput&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This surfaces which records were retrieved, their similarity scores, and how they were injected into the prompt. Essential for debugging why your agent is (or isn't) remembering something.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cost Considerations
&lt;/h2&gt;

&lt;p&gt;AgentCore Memory pricing has two components: storage (per GB/month for the vector store) and retrieval (per 1K queries). A few things to watch:&lt;/p&gt;

&lt;p&gt;Session summaries are generated by an FM call — this counts against our Bedrock token usage. Noisy sessions with long summaries add up. The summaryPromptTemplate customisation above directly controls this cost.&lt;br&gt;
Episodic memory stores more data than semantic — budget accordingly if you enable it.&lt;br&gt;
Set storageDays aggressively. 90 days is usually sufficient; most users don't need their agent to recall a conversation from 18 months ago.&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>aws</category>
      <category>llm</category>
    </item>
    <item>
      <title>Plug &amp; Productionize Your AI Agents with AWS Bedrock AgentCore</title>
      <dc:creator>Sampath Karan</dc:creator>
      <pubDate>Wed, 26 Nov 2025 09:38:15 +0000</pubDate>
      <link>https://dev.to/aws-builders/plug-productionize-your-ai-agents-with-aws-bedrock-agentcore-3g64</link>
      <guid>https://dev.to/aws-builders/plug-productionize-your-ai-agents-with-aws-bedrock-agentcore-3g64</guid>
      <description>&lt;p&gt;&lt;strong&gt;Deploying a Local AI Agent to AWS Bedrock AgentCore&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This post demonstrates a streamlined approach to deploying locally developed AI agents using AWS Bedrock AgentCore. We'll build a simple single-node LLM agent, extend it with real-time web search, and deploy it seamlessly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I have created a simple LLM agent using OpenAI and extended it with DuckDuckGoSearchResults (LangChain) to fetch current internet information. Once tested locally, the agent can be deployed to AWS Bedrock AgentCore, giving you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automatic scaling&lt;/li&gt;
&lt;li&gt;Serverless execution&lt;/li&gt;
&lt;li&gt;Fully managed runtime&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Tech Stack&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OpenAI Model **       : gpt-5-nano&lt;br&gt;
**Agent Framework&lt;/strong&gt;     : LangGraph&lt;br&gt;
&lt;strong&gt;Deployment&lt;/strong&gt;          : AWS Bedrock AgentCore&lt;br&gt;
&lt;strong&gt;Tooling&lt;/strong&gt;             : DuckDuckGoSearchResults (LangChain)&lt;/p&gt;

&lt;p&gt;Follow along Github repo link : &lt;a href="https://github.com/sampathkaran/langgraph-openai-agentcore-demo" rel="noopener noreferrer"&gt;https://github.com/sampathkaran/langgraph-openai-agentcore-demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before starting, make sure you have:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Python 3.10 installed&lt;/li&gt;
&lt;li&gt;AWS CLI configured with credentials&lt;/li&gt;
&lt;li&gt;Miniconda installed&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Local Setup &amp;amp; Testing&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a virtual environment.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;conda create -n agentcore python=3.10
conda activate agentcore
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Install dependencies.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd agentcore-deployment
pip install -r requirements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Store OpenAI API key in AWS Secrets Manager.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;-    Go to AWS Console → Secrets Manager → Store a new secret&lt;/li&gt;
&lt;li&gt;-    Select Other type of secret&lt;/li&gt;
&lt;li&gt;-    Key name: api-key, Value: &lt;/li&gt;
&lt;li&gt;-    Name the secret: my-api-key&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Now we can test the code locally.
Edit agent.py
Uncomment the print statement for a test query, and comment out 
aws_app.run()
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#print(langgraph_bedrock({"messages": "Who won the Formula 1 Singapore 2025 race? Give a brief answer"}))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Invoke the script&lt;br&gt;
&lt;code&gt;python agent.py&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Architecture Overview&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here’s what happens when you execute a query:&lt;/p&gt;

&lt;p&gt;The LLM checks if it already has the answer.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If not, it calls the DuckDuckGoSearchResults tool to fetch current information.&lt;/li&gt;
&lt;li&gt;The agent may loop through the search until it has sufficient data.&lt;/li&gt;
&lt;li&gt;Once complete, the LLM generates the final response.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Deploying to AWS Bedrock AgentCore&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Amazon Bedrock AgentCore provides the following features:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Serverless runtime&lt;/li&gt;
&lt;li&gt;Automatic scaling&lt;/li&gt;
&lt;li&gt;Session management&lt;/li&gt;
&lt;li&gt;Security isolation&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We'll use the AgentCore Starter Toolkit CLI to deploy our agent.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps to Deploy&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Update requirements.txt
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
bedrock-agentcore&amp;lt;=0.1.5
bedrock-agentcore-starter-toolkit==0.1.14

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Import AgentCore runtime library
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from bedrock_agentcore.runtime import BedrockAgentCoreApp

aws_app = BedrockAgentCoreApp()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Add the entrypoint decorator&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;@aws_app.entrypoint&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enable the runtime server
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# print(langgraph_bedrock(...))  # Comment out local print
aws_app.run()  # Starts HTTP server on port 8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Configure AgentCore CLI&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;agentcore configure --entrypoint agent.py&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Accept default options (IAM roles, permissions, etc.)&lt;br&gt;
 This generates a Dockerfile and deployment YAML&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Launch the agent&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;agentcore launch&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Attach the IAM role permission to access AWS Secrets Manager (secret-policy.json)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Verify your deployed agent in the AWS console&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Invoke the agent&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;agentcore invoke '{"message": "Hello"}'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Using AWS Bedrock AgentCore, you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Take a local LLM agent to production&lt;/li&gt;
&lt;li&gt;Enable serverless scaling and runtime management&lt;/li&gt;
&lt;li&gt;Integrate external tools for real-time information&lt;/li&gt;
&lt;li&gt;This approach keeps your AI agent lightweight locally while making it fully production-ready in the cloud.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>[Boost]</title>
      <dc:creator>Sampath Karan</dc:creator>
      <pubDate>Wed, 26 Nov 2025 09:15:13 +0000</pubDate>
      <link>https://dev.to/sampathkaran/-4i45</link>
      <guid>https://dev.to/sampathkaran/-4i45</guid>
      <description></description>
    </item>
    <item>
      <title>Plug &amp; Productionize Your AI Agents with AWS Bedrock AgentCore</title>
      <dc:creator>Sampath Karan</dc:creator>
      <pubDate>Wed, 26 Nov 2025 09:05:52 +0000</pubDate>
      <link>https://dev.to/sampathkaran/plug-productionize-your-ai-agents-with-aws-bedrock-agentcore-20ak</link>
      <guid>https://dev.to/sampathkaran/plug-productionize-your-ai-agents-with-aws-bedrock-agentcore-20ak</guid>
      <description></description>
      <category>awsco</category>
    </item>
    <item>
      <title>Prompt Engineering Techniques - AWS BedRock</title>
      <dc:creator>Sampath Karan</dc:creator>
      <pubDate>Mon, 30 Dec 2024 13:29:33 +0000</pubDate>
      <link>https://dev.to/sampathkaran/prompt-engineering-techniques-aws-bedrock-50om</link>
      <guid>https://dev.to/sampathkaran/prompt-engineering-techniques-aws-bedrock-50om</guid>
      <description>&lt;h2&gt;
  
  
  What is Prompt Engineering?
&lt;/h2&gt;

&lt;p&gt;In simple terms add more context to the user request is Prompt Engineering. Adding more context will basic aid the LLMs to generate appropriate responses.&lt;/p&gt;

&lt;p&gt;Let me illustrate by an example&lt;/p&gt;

&lt;p&gt;Here I am using AWS Bedrock Claude 3 Haiku as an example.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First I am adding a context that I am an experienced pilot and I wanted the LLM to explain me about the use of Flaps in Aircraft and you could see the response from the LLM that is more suited for an experienced pilot.&lt;/li&gt;
&lt;/ul&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%2F8sbix69w6deymbtd6yiq.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%2F8sbix69w6deymbtd6yiq.png" alt="Image description" width="800" height="186"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Next I am adding a context to the LLM that I am a school student. The LLM have changed the response now that is more suited for the School student as below&lt;/li&gt;
&lt;/ul&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%2F2x2p7drw5xjwn60nejrf.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%2F2x2p7drw5xjwn60nejrf.png" alt="Image description" width="800" height="236"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Zero Shot Prompting
&lt;/h2&gt;

&lt;p&gt;Here we provide the prompt without any specific examples and the response generated by LLMs are vry diverse.&lt;/p&gt;

&lt;h2&gt;
  
  
  Few Shot Prompting
&lt;/h2&gt;

&lt;p&gt;Here we provide multiple examples for a request and example response such that the LLMs understand well about and produce expected results&lt;/p&gt;

&lt;h2&gt;
  
  
  Chain of Thought Prompting(COT)
&lt;/h2&gt;

&lt;p&gt;COT prompting is basically used to breakdown a complex problem and try to produce the results step by step, basically it adds some thinking process to the LLMs.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>bedrock</category>
      <category>ai</category>
    </item>
    <item>
      <title>AWS Bedrock Knowledge Base - An overview</title>
      <dc:creator>Sampath Karan</dc:creator>
      <pubDate>Mon, 23 Dec 2024 19:37:25 +0000</pubDate>
      <link>https://dev.to/sampathkaran/aws-bedrock-knowledge-base-an-overview-5bne</link>
      <guid>https://dev.to/sampathkaran/aws-bedrock-knowledge-base-an-overview-5bne</guid>
      <description>&lt;h1&gt;
  
  
  Knowledge Base
&lt;/h1&gt;

&lt;p&gt;As we witness the rapid advancement of AI in this era, AI also play a pivotal role in every organization to assist the customer and the employees.&lt;/p&gt;

&lt;p&gt;For instance if an employee of an organization inference a Foundational model about the hierarchy of particular person. The FM may unable to generate the results as this is domain specific prompt that is scoped only within this organization and FM may no be trained on such internal data.&lt;/p&gt;

&lt;p&gt;To extract some domain specific data we can make use of a feature AWS  Bedrock Knowledge Base. Knowledge base is fully managed service that helps to  integrate the company proprietary information into the generative-AI applications using Retrieval Augmented Generation (RAG) technique.&lt;/p&gt;

&lt;h2&gt;
  
  
  Without using KnowlegeBase
&lt;/h2&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%2Fgmetsxiv5ai33l9fkb7y.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%2Fgmetsxiv5ai33l9fkb7y.png" alt="Image description" width="664" height="306"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here the FM model was unable to generate the output and it is asking for more context as it is more specific within that organization.&lt;/p&gt;

&lt;h2&gt;
  
  
  After using KnoweldgeBase
&lt;/h2&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%2Fhc0ti1y2mk6zhcjzu770.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%2Fhc0ti1y2mk6zhcjzu770.png" alt="Image description" width="800" height="575"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Below are the steps that happens with knowledge Base
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;The user prompt the query asking for the manager of John Doe.&lt;/li&gt;
&lt;li&gt;The query goes to the vector DB say Opensearch DB&lt;/li&gt;
&lt;li&gt;The proprietary documents can be uploaded to the a data source 
like S3.&lt;/li&gt;
&lt;li&gt;We use a agent FM model to convert the raw data to vector 
embedding that can be stored in the DB.&lt;/li&gt;
&lt;li&gt;The vector DB searches for this query in the DB and augments it 
with the prompt and send it to the FM model.&lt;/li&gt;
&lt;li&gt;The FM model then can able to find out the data and return back 
the response as the manager of John Doe&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>ai</category>
      <category>bedrock</category>
      <category>aws</category>
    </item>
    <item>
      <title>EKS Pod Identity AddOns</title>
      <dc:creator>Sampath Karan</dc:creator>
      <pubDate>Sat, 23 Dec 2023 17:47:39 +0000</pubDate>
      <link>https://dev.to/sampathkaran/eks-pod-identity-addons-26k0</link>
      <guid>https://dev.to/sampathkaran/eks-pod-identity-addons-26k0</guid>
      <description>&lt;p&gt;Recently a new EKS addons introduced an addon feature Pod Identities. Basically if the pod want to communicate with other AWS services it will happen through the IAM Roles for service account (IRSA) where the IAM role will be configured as service account and attached to pods and a switch happens between EKS and IAM. Now with Pod Identity addons we can provide granular permissions for the pods.&lt;/p&gt;

&lt;p&gt;You can install the addons and verify if it is added to the cluster&lt;/p&gt;

&lt;p&gt;&lt;code&gt;aws eks --region ap-south-1 list-addons --cluster-name demo&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "addons": [
        "coredns",
        "eks-pod-identity-agent",
        "kube-proxy",
        "vpc-cni"
    ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can verify the addons running as daemonset in the cluster&lt;/p&gt;

&lt;p&gt;&lt;code&gt;kubectl get daemonset -A&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
NAMESPACE     NAME                     DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE
kube-system   aws-node                 2         2         2       2            2           &amp;lt;none&amp;gt;          51m
kube-system   eks-pod-identity-agent   2         2         2       2            2           &amp;lt;none&amp;gt;          48m
kube-system   kube-proxy               2         2         2       2            2           &amp;lt;none&amp;gt;          51m


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let us break down and see how exactly it works, we will try to access S3 bucket from the pod using pod identity.&lt;/p&gt;

&lt;p&gt;Step 1. Create test S3 bucket name &lt;code&gt;test-884&lt;/code&gt;.&lt;br&gt;
Step 2. Create an IAM role &lt;code&gt;pod-identity-s3-demo&lt;/code&gt; choose trusted entity EKS and EKS pod identity.&lt;br&gt;
![Image description](&lt;a href="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8fwfyfwcs6tn5hqdnzqc.png"&gt;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8fwfyfwcs6tn5hqdnzqc.png&lt;/a&gt; &lt;br&gt;
Step 3. Click next and you could see a trust policy added to the role &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lqY9DdvY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t256uguecyap6gv7jf9n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lqY9DdvY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t256uguecyap6gv7jf9n.png" alt="Image description" width="800" height="331"&gt;&lt;/a&gt; &lt;br&gt;
Step 4. Click next and create the role.&lt;br&gt;
Step 5. After creating a role we can add inline policy with the bucket name specified as below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": "s3:GetObject",
      "Effect": "Allow",
      "Resource": "arn:aws:s3:::test-884/*",
      "Sid": "PodIdentity"
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VepQq2ND--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7pz3ah18oi7poi2tw10w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VepQq2ND--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7pz3ah18oi7poi2tw10w.png" alt="Image description" width="800" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 6. Now associate the IAM role with the EKS pod by using the Pod Identity association, navigate to the eks cluster and access tab and click on&lt;br&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--E_UYfG7r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/axgxour344i7cs93ghyb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--E_UYfG7r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/axgxour344i7cs93ghyb.png" alt="Image description" width="800" height="371"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 7. You can specify the existing namespace and service account as below &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VEqqwj1J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3jk333nk21whr83xw8p6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VEqqwj1J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3jk333nk21whr83xw8p6.png" alt="Image description" width="800" height="704"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;step7: Finally create a pod with the service account and the pod get the temporary access to S3 bucket&lt;/p&gt;

</description>
      <category>eks</category>
      <category>kubernetes</category>
    </item>
    <item>
      <title>AWS EKS Upgrade Insights</title>
      <dc:creator>Sampath Karan</dc:creator>
      <pubDate>Fri, 22 Dec 2023 08:21:28 +0000</pubDate>
      <link>https://dev.to/sampathkaran/aws-eks-upgrade-insights-2o6i</link>
      <guid>https://dev.to/sampathkaran/aws-eks-upgrade-insights-2o6i</guid>
      <description>&lt;p&gt;I had posted a block previously on &lt;a href="https://dev.to/sampathkaran/upgrade-aws-elastic-kubernetes-service-eks-cluster-via-terraform-4jfe"&gt;How to upgrade EKS version via terraform&lt;/a&gt;. This time I am back with some recent updates on how effectively we could able to upgrade the cluster seamlessly with recommendations from feature known as AWS EKS Cluster Insights.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is EKS Upgrade Insights ?
&lt;/h2&gt;

&lt;p&gt;Basically whenever we plan for EKS upgrade, we should basically get into details to understand what workloads are hosted within the cluster and how it is been impacted such as API deprecation and check the compatibility of external services hosted with the cluster for the new targeted version.&lt;/p&gt;

&lt;p&gt;EKS Upgrade insights will basically scan the cluster and let us know what API are getting deprecated when we upgrade to the new version with recommendations and remediation advice thus by reducing the administration effort and seamless upgrade.&lt;/p&gt;

&lt;p&gt;You can see this tab in the console as per the screenshot below &lt;/p&gt;

&lt;p&gt;Here I am running a EKS cluster of outdate version v1.23 and the below are the recommendations from the cluster what is going to get deprecated in the next higher versions&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XXFzjAzk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qwwv7d0babk28pgkzt74.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XXFzjAzk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qwwv7d0babk28pgkzt74.png" alt="Image description" width="800" height="358"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note: These insights shows recommendations only and the administrator have to take necessary steps to upgrade the deprecated APIs before upgrade.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The refresh of the cluster happens every once in a day, suppose if you update the deprecated API the cluster will still show that there are still deprecated APIs in the cluster. So we have to wait for a day to see the status change in the insights page.&lt;/p&gt;

</description>
      <category>eks</category>
      <category>aws</category>
      <category>kubernetes</category>
    </item>
    <item>
      <title>AWS FSx for ONTAP -Storage Provisioning</title>
      <dc:creator>Sampath Karan</dc:creator>
      <pubDate>Sat, 01 Jul 2023 07:17:40 +0000</pubDate>
      <link>https://dev.to/sampathkaran/aws-fsx-for-ontap-file-storage-provisioning-4de4</link>
      <guid>https://dev.to/sampathkaran/aws-fsx-for-ontap-file-storage-provisioning-4de4</guid>
      <description>&lt;h3&gt;
  
  
  Intro
&lt;/h3&gt;

&lt;p&gt;To manage unmanaged data, AWS introduced FSx - a storage offering from AWS which is a collaboration between AWS and NetApp. You can bring in the features of the NetApp ONTAP cluster within AWS and you can use AWS API or AWS cli to manage the storage. You could use the features of NetApp such as Snap-Mirror and Snapshots, De-duplication, Compression etc.&lt;/p&gt;

&lt;p&gt;Unlike traditional ONTAP cluster the AWS FSX for ONTAP is a fully managed cluster i.e. installation and maintenance is taken care by AWS. It has also automated storage tiering to move data into low cost storage for cold data. It supports multiprotocol access such as SMB, CIFS and iSCSI and we can access from AWS EC2 Linux, Windows OS and container services like ECS and EKS.&lt;/p&gt;

&lt;p&gt;FSx ONTAP Resources:&lt;/p&gt;

&lt;p&gt;Basically you provision the below 3 resource for your file storage&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Filesystem&lt;/strong&gt;&lt;br&gt;
A file system is the primary resource for ONTAP &lt;br&gt;
resource, similar to an on-premises NetApp ONTAP cluster.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Storage Virtual Machine(SVM)&lt;/strong&gt;&lt;br&gt;
A storage virtual machine(SVM) is an isolated file server with its own administrative and data access endpoints for &lt;br&gt;
administering and accessing data. A default SVM is create when &lt;br&gt;
you create a filesystem. We can add more SVMs if needed. &lt;br&gt;
Basically the clients and the work station access the data via &lt;br&gt;
the SVM endpoint.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Volumes&lt;/strong&gt;&lt;br&gt;
FSx for ONTAP volumes are virtual resources that you use for &lt;br&gt;
organizing and grouping your data. Volumes are logical &lt;br&gt;
containers, and data stored in them consumes physical capacity &lt;br&gt;
on your file system. Volumes are hosted on SVMs.&lt;/p&gt;

&lt;p&gt;By default, when you create a new file system from the AWS Management Console, Amazon FSx automatically creates a file system with a single storage virtual machine (SVM) and one volume. After your file system is created, you can create additional SVMs and volumes as needed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Data Migration
&lt;/h3&gt;

&lt;p&gt;To migrate the data from on-premise to AWS we can basically setup a SnapMirror replication between the on-premise volume to the AWS FSX volumes and sync all changes.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Create a FSX file system using Management Console
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Step 1
&lt;/h4&gt;

&lt;p&gt;Search for FSx and select create filesystem&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HUa1O7P6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t7yapwchbn2fmz30ja5l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HUa1O7P6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t7yapwchbn2fmz30ja5l.png" alt="Image description" width="800" height="248"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 2
&lt;/h4&gt;

&lt;p&gt;Select Amazon FSx for NetApp ONTAP and click next &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---BR9Kcbq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uuh5lvjr2w9zbo9sa3uk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---BR9Kcbq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uuh5lvjr2w9zbo9sa3uk.png" alt="Image description" width="800" height="295"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 3
&lt;/h4&gt;

&lt;p&gt;Select standard create option to customize various configuration.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Give a name for your filesystem.&lt;/li&gt;
&lt;li&gt;Select the deployment type where to be single AZ or multi AZ.&lt;/li&gt;
&lt;li&gt;Select the flash SSD storage capacity, the minimum is 1024 GiB&lt;/li&gt;
&lt;li&gt;We can customize your provisioned IOPS as per your application 
requirements by selecting User-provisioned option.&lt;/li&gt;
&lt;li&gt;Throughput Capacity is recommended based on your SSD capacity 
we can customize that as well.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0U1U4cLx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tcvcqfsotezi8xw2ai6g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0U1U4cLx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tcvcqfsotezi8xw2ai6g.png" alt="Image description" width="800" height="606"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 4 - Network Setup
&lt;/h4&gt;

&lt;p&gt;As we have selected Multi AZ in the previous step it will basically launch a 2 node ONTAP cluster i.e. an active node on 1 AZ and a passive node on other AZ.&lt;/p&gt;

&lt;p&gt;Select the VPC&lt;/p&gt;

&lt;p&gt;Attach the security Group of the VPC.&lt;br&gt;
Basically 2 subnets from the VPC were selected, there will be data sync happening between the preferred subnet cluster(active) and the standby cluster(passive).In event of any failure to the preferred subnet cluster the standby subnet cluster will become active.&lt;br&gt;
We can select the routes and as well as provide an endpoint IP address for the cluster. Here I am leaving it as default.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UdUh8BaK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j6g54pszrffp12hagvq3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UdUh8BaK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j6g54pszrffp12hagvq3.png" alt="Image description" width="800" height="793"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 5 - Setup the Security and Encryption
&lt;/h4&gt;

&lt;p&gt;We have the option to setup the encryption key from KMS, I would &lt;br&gt;
leave that to default for this demo.&lt;br&gt;
We have to specify the admin password for filesystem to access from ONTAP CLI&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oVX7nDIi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oqzw0bhw3qmwur7y51im.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oVX7nDIi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oqzw0bhw3qmwur7y51im.png" alt="Image description" width="800" height="524"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 6 - Storage Virtual Machine
&lt;/h4&gt;

&lt;p&gt;We need to create a separate admin access for SVMs, you can create multiple SVMs for multi tenancy requirement to share the same filesystem. you can also set a password for the SVM.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rFJtNEpa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vd95w7ixiy6bacbiu46o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rFJtNEpa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vd95w7ixiy6bacbiu46o.png" alt="Image description" width="794" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 7 - Create a volume
&lt;/h4&gt;

&lt;p&gt;These volume created support thin provisioning ie it consumes the storage of what we use. By enabling storage efficiency you could able to leverage ONTAP features such as compression, deduplication, snapshots etc. You can also set the snapshot policy&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_MNH1IK3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nz129vz22gl3a2r0vko5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_MNH1IK3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nz129vz22gl3a2r0vko5.png" alt="Image description" width="784" height="657"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you hit create you can able to create the filesystem and mount it on the VM&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Upgrade AWS Elastic Kubernetes Service (EKS) Cluster Via Terraform</title>
      <dc:creator>Sampath Karan</dc:creator>
      <pubDate>Sun, 14 May 2023 03:18:14 +0000</pubDate>
      <link>https://dev.to/sampathkaran/upgrade-aws-elastic-kubernetes-service-eks-cluster-via-terraform-4jfe</link>
      <guid>https://dev.to/sampathkaran/upgrade-aws-elastic-kubernetes-service-eks-cluster-via-terraform-4jfe</guid>
      <description>&lt;p&gt;Kubernetes is the new normal when it comes to host your applications.&lt;/p&gt;

&lt;p&gt;AWS Elastic Kubernetes service is a managed service where the control plane is deployed in a High Availability and it is completely managed by AWS in the backend allowing the administrators/SRE/DevOps Engineers to manage the data plane and the microservices running as pods.&lt;/p&gt;

&lt;p&gt;As of writing the post today Kubernetes community has a three releases per year cadence for the k8s version. On the other hand AWS has their own customized version of Kubernetes(EKS Version) and have their own release cadence. You could find this information at &lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note - EKS upgrade is a step upgrade and can be upgraded from one minor version at a time for e.g. 1.21 to 1.22&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Managing AWS EKS via terraform helps us to maintain the desired state and it also allows us seamlessly to perform the cluster upgrade.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pre-requisites in Terraform
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Verify that the state file of EKS does not throws any error before the upgrade.&lt;/li&gt;
&lt;li&gt;Ensure the state is stored in a remote place such as Amazon S3&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Pre-requisites in EKS
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Ensure 5 free IP addresses from the VPC subnets of EKS cluster (explained in below section)&lt;/li&gt;
&lt;li&gt;Ensure the Kubelet version is same as the control plane version&lt;/li&gt;
&lt;li&gt;Verify EKS addons version and upgrade if necessary before the start of cluster upgrade.&lt;/li&gt;
&lt;li&gt;Pod Disruption Budget (PDB) some time cause error while draining pods (recommended to disable it while upgrading)&lt;/li&gt;
&lt;li&gt;Use an K8s API depreciation finder tool like Pluto to support the API changes on the newer version.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Upgrade Process
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/update-cluster.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/eks/latest/userguide/update-cluster.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me break down the upgrade process that happens when we perform the upgrade. This is a sequential upgrade&lt;/p&gt;

&lt;h5&gt;
  
  
  Control Plane upgrade
&lt;/h5&gt;

&lt;p&gt;The control plane upgrade is an in-place upgrade means that it launches new control plane with the target version within the same subnet of the existing control plane and that is the where we need atleast 5 free IPs in the EKS subnet to accommodate the new control plane. The new control plane will go through readiness and health check and once passed the new control plane will replace the old plane. This process happens in the backend within AWS infrastructure and there will be no impact to application&lt;/p&gt;

&lt;h5&gt;
  
  
  Node upgrade
&lt;/h5&gt;

&lt;p&gt;The node upgrade is also an in-place upgrade where it launches new nodes with the target version and the pod from old nodes will get evicted and launched in the new node.&lt;/p&gt;

&lt;h5&gt;
  
  
  Add-ons upgrade
&lt;/h5&gt;

&lt;p&gt;The addons such as coredns, VPC CNI, kube-proxy etc on your cluster need to be upgraded accrodingly as per the matrix in &lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/managing-vpc-cni.html#vpc-add-on-update" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/eks/latest/userguide/managing-vpc-cni.html#vpc-add-on-update&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Let us take an example of upgrading from 1.21 to 1.22&lt;/p&gt;

&lt;h5&gt;
  
  
  Step-1:
&lt;/h5&gt;

&lt;p&gt;Ensure control plane and nodes are in same version&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;kubectl version --short &lt;br&gt;
kubectl get nodes&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h5&gt;
  
  
  Step-2:
&lt;/h5&gt;

&lt;p&gt;Before updating your cluster, ensure that the proper Pod security policies are in place. This is to avoid potential security issues&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;kubectl get psp eks.privileged&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h5&gt;
  
  
  Step-3:
&lt;/h5&gt;

&lt;p&gt;Update you target version in your terraform file to the target version say 1.22 and then perform a TF plan and apply&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%2F64lo98dhk2q43zqv1d4i.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%2F64lo98dhk2q43zqv1d4i.png" alt=" " width="800" height="282"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Step-4:
&lt;/h5&gt;

&lt;p&gt;Once the control is upgraded,the &lt;strong&gt;managed worker nodes&lt;/strong&gt; upgrade process get invoked automatically. In case you are using the &lt;strong&gt;self managed worker nodes&lt;/strong&gt; upgrade. Choose the AMI as per your control plane version and region in the matrix below &lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/retrieve-ami-id.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/eks/latest/userguide/retrieve-ami-id.html&lt;/a&gt;&lt;br&gt;
Update your worker nodes TF file with the new AMI id and run TF plan and apply&lt;/p&gt;

&lt;h5&gt;
  
  
  Step-5:
&lt;/h5&gt;

&lt;p&gt;Once control plane and workernodes upgrade were completed. Now it is time to upgrade the addons, see what addons are enabled in your cluster and upgrade each addons via console or eksctl based on how you manage it.&lt;br&gt;
Each addons has the compatiblity matrix from the AWS documentation and it has to be upgraded appropriately &lt;br&gt;
sample ref : &lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/managing-vpc-cni.html#vpc-add-on-update" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/eks/latest/userguide/managing-vpc-cni.html#vpc-add-on-update&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Step-6:
&lt;/h5&gt;

&lt;p&gt;If you wish to upgrade from 1.22 to 1.23 repeat the steps above&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
