<?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: Muhammad Umair Ashraf</title>
    <description>The latest articles on DEV Community by Muhammad Umair Ashraf (@omayrashraf).</description>
    <link>https://dev.to/omayrashraf</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4134004%2F5d108082-c685-44a3-9afd-f94e943f3e26.jpg</url>
      <title>DEV Community: Muhammad Umair Ashraf</title>
      <link>https://dev.to/omayrashraf</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/omayrashraf"/>
    <language>en</language>
    <item>
      <title>Building a Serverless Multi-Agent Robotics Platform on AWS</title>
      <dc:creator>Muhammad Umair Ashraf</dc:creator>
      <pubDate>Wed, 28 Oct 2026 07:16:37 +0000</pubDate>
      <link>https://dev.to/omayrashraf/building-a-serverless-multi-agent-robotics-platform-on-aws-44f1</link>
      <guid>https://dev.to/omayrashraf/building-a-serverless-multi-agent-robotics-platform-on-aws-44f1</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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fftcvpfkil5gut5y1l7mj.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fftcvpfkil5gut5y1l7mj.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Imagine telling a robot:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Move forward, turn right, and wave.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Instead of writing a separate program for every instruction, what if an AI-powered application could understand the request, create an action plan, validate it, and communicate with the robot through cloud services?&lt;/p&gt;

&lt;p&gt;That is an interesting use case for combining &lt;strong&gt;AI agents, serverless architecture, and IoT messaging on AWS&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Inspired by the topic discussed in &lt;a href="https://builder.aws.com/content/3LB860PMSMhAGwIDvqi2Wc2afWz/building-a-serverless-multi-agent-robotics-platform-on-aws-lessons-from-aws-community-day-shenzhen" rel="noopener noreferrer"&gt;Building a Serverless Multi-Agent Robotics Platform on AWS — Lessons from AWS Community Day Shenzhen&lt;/a&gt;, this article explores a practical reference architecture for building such a system.&lt;/p&gt;

&lt;p&gt;The design and code snippets are illustrative examples, not a claim that a complete robotics platform has been deployed or tested.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why combine AI agents with serverless robotics?
&lt;/h2&gt;

&lt;p&gt;A robotics application needs more than a language model. It must interpret requests, manage tasks, communicate with devices, track execution, handle errors, and enforce safety rules.&lt;/p&gt;

&lt;p&gt;A useful architecture separates these responsibilities instead of putting everything inside one application.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An intent agent interprets the user's request.&lt;/li&gt;
&lt;li&gt;A planning agent proposes a sequence of actions.&lt;/li&gt;
&lt;li&gt;A safety layer checks whether those actions are permitted.&lt;/li&gt;
&lt;li&gt;An execution component sends approved commands.&lt;/li&gt;
&lt;li&gt;Event handlers track the robot's actual status.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AWS managed services can support the application and communication layers without requiring you to operate every supporting server yourself.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Architecture overview
&lt;/h2&gt;

&lt;p&gt;Here is the proposed architecture:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User / Web Application
          |
          v
Amazon Cognito + API Gateway
          |
          v
AWS Lambda — Request Handler
          |
          v
Agent Orchestration
(Strands Agents + Amazon Bedrock)
          |
          +--&amp;gt; Intent Interpretation
          |
          +--&amp;gt; Action Planning
          |
          +--&amp;gt; Safety Validation
          |
          v
Approved Command Tool
          |
          v
AWS IoT Core
          |
          v
       Robot Device
          |
          v
Status and Telemetry Events
          |
          v
AWS Lambda --&amp;gt; Amazon DynamoDB
          |
          v
Amazon CloudWatch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Amazon Bedrock provides foundation-model access, while Amazon Bedrock AgentCore can provide managed capabilities for deploying and operating agent workloads. Strands Agents can be used to define agent behavior and tool interactions.&lt;/p&gt;

&lt;p&gt;The exact integration depends on the selected AgentCore components and the requirements of the robot.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Choose AWS services for specific responsibilities
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;AWS service&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Amazon Bedrock&lt;/td&gt;
&lt;td&gt;Natural-language understanding and action planning&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Strands Agents&lt;/td&gt;
&lt;td&gt;Agent workflows and tool use&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Amazon Bedrock AgentCore&lt;/td&gt;
&lt;td&gt;Managed agent runtime and supporting capabilities&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Amazon API Gateway&lt;/td&gt;
&lt;td&gt;Application API endpoints&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AWS Lambda&lt;/td&gt;
&lt;td&gt;Request handling, validation, and event processing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Amazon Cognito&lt;/td&gt;
&lt;td&gt;User authentication&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AWS IoT Core&lt;/td&gt;
&lt;td&gt;Device connectivity and messaging&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Amazon DynamoDB&lt;/td&gt;
&lt;td&gt;Session, task, and command state&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Amazon CloudWatch&lt;/td&gt;
&lt;td&gt;Logs, metrics, and operational monitoring&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AWS Step Functions&lt;/td&gt;
&lt;td&gt;Optional orchestration for durable multi-step workflows&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;You do not need every service in the first version. Start with the smallest architecture that can demonstrate a complete and safe command lifecycle.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Create specialized agents
&lt;/h2&gt;

&lt;p&gt;A multi-agent system is most useful when responsibilities are clearly separated.&lt;/p&gt;

&lt;h3&gt;
  
  
  Intent agent
&lt;/h3&gt;

&lt;p&gt;The intent agent converts a natural-language request into a structured action proposal.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"robot_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"robot-001"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"turn_right"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"duration_ms"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is an example application schema, not an AWS-defined robot command format.&lt;/p&gt;

&lt;h3&gt;
  
  
  Planning agent
&lt;/h3&gt;

&lt;p&gt;For a multi-step task, the planning agent can propose an ordered list of supported actions.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Move forward.&lt;/li&gt;
&lt;li&gt;Turn right.&lt;/li&gt;
&lt;li&gt;Stop.&lt;/li&gt;
&lt;li&gt;Report the result.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The planner should use a known capability registry instead of assuming that every robot supports the same operations.&lt;/p&gt;

&lt;h3&gt;
  
  
  Safety validator
&lt;/h3&gt;

&lt;p&gt;The safety validator checks the proposed actions against deterministic application rules.&lt;/p&gt;

&lt;p&gt;It should verify:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The user is authorized to control the selected robot.&lt;/li&gt;
&lt;li&gt;The requested action is supported.&lt;/li&gt;
&lt;li&gt;Parameters are within configured limits.&lt;/li&gt;
&lt;li&gt;The device is in an acceptable state.&lt;/li&gt;
&lt;li&gt;Human approval is provided when required.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Its decision might be &lt;code&gt;ALLOW&lt;/code&gt;, &lt;code&gt;REJECT&lt;/code&gt;, or &lt;code&gt;REQUIRE_APPROVAL&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; AI-generated plans are proposals, not authorization to control physical hardware. Enforce safety rules in trusted application code and the robot's local controller.&lt;/p&gt;

&lt;h3&gt;
  
  
  Execution coordinator
&lt;/h3&gt;

&lt;p&gt;The execution component sends approved commands, tracks their status, and handles failures.&lt;/p&gt;

&lt;p&gt;Give it access only to specific, validated tools. Avoid giving an AI agent unrestricted permission to publish arbitrary commands to robot devices.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Connect the robot using AWS IoT Core
&lt;/h2&gt;

&lt;p&gt;AWS IoT Core can support MQTT-based communication with compatible robot devices.&lt;/p&gt;

&lt;p&gt;One possible topic structure is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;robots/robot-001/commands
robots/robot-001/status
robots/robot-001/telemetry
robots/robot-001/events
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A command might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"command_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"cmd-1001"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"robot_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"robot-001"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"move_forward"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"duration_ms"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The robot-side controller should validate the message before acting on it. It should reject expired or duplicate commands, enforce local limits, and report the actual execution outcome.&lt;/p&gt;

&lt;p&gt;Do not assume that successful message delivery means the physical action completed.&lt;/p&gt;

&lt;p&gt;For a reliable implementation, define:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Command IDs and duplicate detection.&lt;/li&gt;
&lt;li&gt;Acknowledgements and execution status.&lt;/li&gt;
&lt;li&gt;Timeouts and bounded retry behavior.&lt;/li&gt;
&lt;li&gt;Device authentication and least-privilege IoT policies.&lt;/li&gt;
&lt;li&gt;Behavior during network disconnection.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cloud-based AI is suitable for high-level planning and coordination. Time-critical motor control and emergency stopping should remain local to the robot.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Store task state in DynamoDB
&lt;/h2&gt;

&lt;p&gt;Amazon DynamoDB can store the state needed to track a robotics workflow.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Entity&lt;/th&gt;
&lt;th&gt;Example data&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Robot&lt;/td&gt;
&lt;td&gt;ID, supported actions, connection status&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Session&lt;/td&gt;
&lt;td&gt;Session ID, user ID, selected robot&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Task&lt;/td&gt;
&lt;td&gt;Task ID, action sequence, current step&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Command&lt;/td&gt;
&lt;td&gt;Command ID, approval state, execution result&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A command lifecycle could be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;REQUESTED
    |
    v
VALIDATED
    |
    v
APPROVED
    |
    v
SENT
    |
    v
COMPLETED
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Other outcomes can include &lt;code&gt;REJECTED&lt;/code&gt;, &lt;code&gt;FAILED&lt;/code&gt;, and &lt;code&gt;EXPIRED&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Use application-level state-transition checks and conditional writes where appropriate to avoid conflicting updates.&lt;/p&gt;

&lt;p&gt;For high-volume sensor telemetry, choose a storage design based on data volume and query requirements rather than placing every sensor reading into the same table as session state.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Build a simple capability validator
&lt;/h2&gt;

&lt;p&gt;Before connecting an AI agent to a real robot, define exactly which actions each device supports.&lt;/p&gt;

&lt;p&gt;Here is a small Python example:&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;ROBOT_CAPABILITIES&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;robot-001&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;move_forward&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;turn_right&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;turn_left&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;stop&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="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;validate_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;robot_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;capabilities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ROBOT_CAPABILITIES&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="n"&gt;robot_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;capabilities&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Unknown robot&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;capabilities&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Unsupported action&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Action is supported&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;


&lt;span class="n"&gt;allowed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;validate_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;robot-001&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;turn_right&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="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;allowed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a minimal illustration, not a production safety system. A real implementation also needs authentication, authorization, parameter validation, device health checks, movement limits, and local safety controls.&lt;/p&gt;

&lt;p&gt;The key idea is to validate every proposed action before it reaches the command interface.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Handle failures before scaling
&lt;/h2&gt;

&lt;p&gt;Robots and cloud services can fail independently. A robust system must account for both.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Robot offline:&lt;/strong&gt; Mark the robot unavailable and report the status to the user.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Duplicate command:&lt;/strong&gt; Use unique command IDs and device-side duplicate detection.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Agent timeout:&lt;/strong&gt; Apply execution deadlines and bounded retries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Partial task completion:&lt;/strong&gt; Record completed steps and determine whether the task can safely resume.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Out-of-order events:&lt;/strong&gt; Use command IDs, timestamps, and sequence checks to reject stale updates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Emergency stop:&lt;/strong&gt; Ensure that protective stopping does not depend on an AI model or a working cloud connection.&lt;/p&gt;

&lt;p&gt;For workflows involving multiple durable steps, retries, and recovery branches, AWS Step Functions may be useful. A simpler workflow can use Lambda and event-driven processing.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Secure and monitor the platform
&lt;/h2&gt;

&lt;p&gt;Security should be part of the architecture from the beginning.&lt;/p&gt;

&lt;p&gt;Use least-privilege IAM permissions, unique device identities, restricted IoT policies, and server-side authorization. Require explicit approval for high-impact actions where appropriate.&lt;/p&gt;

&lt;p&gt;Maintain an audit trail showing who requested a task, what was proposed, which checks passed, which command was sent, and what the robot reported.&lt;/p&gt;

&lt;p&gt;Use Amazon CloudWatch to monitor:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API and Lambda errors.&lt;/li&gt;
&lt;li&gt;Agent latency and invocation counts.&lt;/li&gt;
&lt;li&gt;Device connectivity.&lt;/li&gt;
&lt;li&gt;Command acknowledgement and completion rates.&lt;/li&gt;
&lt;li&gt;Safety rejections and failed tasks.&lt;/li&gt;
&lt;li&gt;Estimated cost per completed task.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Remember that serverless does not automatically mean free. Model inference, agent runtime, Lambda, messaging, storage, and monitoring can all contribute to the total cost.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Build it in stages
&lt;/h2&gt;

&lt;p&gt;I would approach implementation incrementally:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stage 1:&lt;/strong&gt; Connect one simulated or test robot and implement a few deterministic commands.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stage 2:&lt;/strong&gt; Add an API and authentication.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stage 3:&lt;/strong&gt; Introduce an AI agent to translate natural-language requests into structured proposals.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stage 4:&lt;/strong&gt; Add deterministic validation and an explicit approval workflow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stage 5:&lt;/strong&gt; Persist command state and process device status events.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stage 6:&lt;/strong&gt; Add monitoring, error recovery, and additional agents only where they provide measurable value.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stage 7:&lt;/strong&gt; Expand to multiple robots with device-specific permissions, concurrency limits, and capability discovery.&lt;/p&gt;

&lt;p&gt;This approach makes it easier to test the entire request-to-execution lifecycle before adding more complexity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;A serverless multi-agent robotics platform is not simply a chatbot connected to a robot. It is a system that combines AI reasoning, cloud services, device communication, state management, observability, and physical safety.&lt;/p&gt;

&lt;p&gt;AWS provides building blocks for these responsibilities through Amazon Bedrock, Strands Agents, Amazon Bedrock AgentCore, AWS Lambda, AWS IoT Core, and DynamoDB.&lt;/p&gt;

&lt;p&gt;My main takeaway is this:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let AI plan the action. Let trusted software authorize it. Let the robot's local controller enforce physical safety.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Start with one robot, a small set of supported actions, and a clear validation process. Once that workflow is reliable, expand toward more sophisticated agents and multi-robot coordination.&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://builder.aws.com/content/3LB860PMSMhAGwIDvqi2Wc2afWz/building-a-serverless-multi-agent-robotics-platform-on-aws-lessons-from-aws-community-day-shenzhen" rel="noopener noreferrer"&gt;AWS Builder Center: Serverless Multi-Agent Robotics Platform&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/bedrock-agentcore/" rel="noopener noreferrer"&gt;Amazon Bedrock AgentCore documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://strandsagents.com/" rel="noopener noreferrer"&gt;Strands Agents documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/iot/" rel="noopener noreferrer"&gt;AWS IoT Core documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/serverless/" rel="noopener noreferrer"&gt;AWS Serverless&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>ai</category>
      <category>robotics</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Build an Agentic Application Modernization Platform with Strands Agents and AWS Transform Custom</title>
      <dc:creator>Muhammad Umair Ashraf</dc:creator>
      <pubDate>Tue, 27 Oct 2026 02:34:42 +0000</pubDate>
      <link>https://dev.to/omayrashraf/build-an-agentic-application-modernization-platform-with-strands-agents-and-aws-transform-custom-1015</link>
      <guid>https://dev.to/omayrashraf/build-an-agentic-application-modernization-platform-with-strands-agents-and-aws-transform-custom-1015</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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr2otkq6kidkhe8jjih73.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr2otkq6kidkhe8jjih73.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What if you could submit 100 application repositories to one platform, analyze their modernization needs, reuse approved code transformations, and track execution results from a single dashboard?&lt;/p&gt;

&lt;p&gt;That is the idea behind &lt;strong&gt;ModernizeHub&lt;/strong&gt;, a project architecture for agentic application modernization on AWS.&lt;/p&gt;

&lt;p&gt;Modernizing one application can be challenging. Modernizing hundreds of applications introduces a different level of complexity: repository discovery, dependency upgrades, code transformation, testing, execution capacity, and reporting.&lt;/p&gt;

&lt;p&gt;In this article, we'll explore how to design a practical modernization platform using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Strands Agents&lt;/strong&gt; for agent orchestration&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Transform custom&lt;/strong&gt; for reusable code transformations&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon Bedrock AgentCore&lt;/strong&gt; for running and operating agents&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Batch&lt;/strong&gt; for parallel repository jobs&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon S3&lt;/strong&gt; for artifacts and reports&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon DynamoDB&lt;/strong&gt; for job tracking&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;React, Amazon CloudFront, API Gateway, and Lambda&lt;/strong&gt; for the application interface and backend&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; ModernizeHub is a project name used for this walkthrough. The architecture is inspired by AWS's public sample implementation. The examples and results shown below are illustrative, not claimed production test results.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  1. The problem: Modernization doesn't scale easily
&lt;/h2&gt;

&lt;p&gt;Imagine a company with 200 applications.&lt;/p&gt;

&lt;p&gt;Some use older Python runtimes. Others depend on legacy Java frameworks, outdated SDKs, or configurations that need to change before migration.&lt;/p&gt;

&lt;p&gt;The engineering team needs to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Understand each repository.&lt;/li&gt;
&lt;li&gt;Identify the required changes.&lt;/li&gt;
&lt;li&gt;Find an existing transformation or create a new one.&lt;/li&gt;
&lt;li&gt;Apply the transformation.&lt;/li&gt;
&lt;li&gt;Run builds and tests.&lt;/li&gt;
&lt;li&gt;Review failures and approve changes.&lt;/li&gt;
&lt;li&gt;Report the outcome.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Doing all this manually for every application consumes time and creates inconsistent results.&lt;/p&gt;

&lt;p&gt;An agentic workflow can help coordinate these activities, while reusable transformations and automated tests make the process more repeatable.&lt;/p&gt;

&lt;p&gt;The goal is not to let AI change everything without supervision. The goal is to automate repetitive work while keeping engineers in control.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. What are we building?
&lt;/h2&gt;

&lt;p&gt;ModernizeHub is a web application where developers can submit one repository or upload a CSV file containing many repositories.&lt;/p&gt;

&lt;p&gt;The workflow analyzes each application, identifies an appropriate transformation, routes missing transformations for review, executes approved jobs, and displays the results.&lt;/p&gt;

&lt;p&gt;The platform includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Repository analysis&lt;/li&gt;
&lt;li&gt;Transformation discovery&lt;/li&gt;
&lt;li&gt;Custom transformation creation&lt;/li&gt;
&lt;li&gt;Single-repository execution&lt;/li&gt;
&lt;li&gt;CSV batch processing&lt;/li&gt;
&lt;li&gt;Parallel job execution&lt;/li&gt;
&lt;li&gt;Build and test validation&lt;/li&gt;
&lt;li&gt;A dashboard for status and logs&lt;/li&gt;
&lt;li&gt;Human approval for sensitive changes&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Architecture
&lt;/h2&gt;

&lt;p&gt;Here's the high-level design.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Developer / Platform Engineer
            |
            v
     React Dashboard
            |
     CloudFront + S3
            |
            v
      API Gateway
            |
            v
       AWS Lambda
            |
            v
 Amazon Bedrock AgentCore
            |
            v
    Strands Orchestrator
            |
    +-------+--------+
    |       |        |
    v       v        v
 Analysis Discovery Custom
  Agent    Agent   Creation
                    Agent
                       |
                 Human Review
                       |
                       v
             Approved Transformation
                       |
                       v
                 AWS Batch
                       |
                       v
            AWS Transform Custom CLI
                       |
                       v
               Source Repository
                       |
                +------+------+
                |             |
                v             v
             Amazon S3    DynamoDB
            Artifacts    Job Tracking
                |             |
                +------+------+
                       |
                       v
                 Web Dashboard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a logical architecture. The application code must implement the API integrations, permissions, job submission, status updates, and result retrieval.&lt;/p&gt;

&lt;h3&gt;
  
  
  What does each service do?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;React, S3, and CloudFront&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Provide the user interface for repository submission, batch uploads, transformation review, and job tracking.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Amazon API Gateway and AWS Lambda&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Receive requests, validate input, create job records, check authorization, and initiate the asynchronous workflow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Strands Agents&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Coordinate specialized agents and tools. The orchestrator decides which step should happen next based on validated results.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Amazon Bedrock AgentCore&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Provides infrastructure for running and operating agents. AgentCore Runtime can host the orchestrator, while supporting capabilities can help with context and observability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AWS Transform custom&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Provides reusable code transformation capabilities for supported modernization tasks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AWS Batch&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Runs independent repository jobs according to the configured queue, compute resources, and concurrency limits.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Amazon S3 and DynamoDB&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Store output artifacts and job metadata so developers can retrieve results and track progress.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Why use multiple agents?
&lt;/h2&gt;

&lt;p&gt;Instead of asking one agent to analyze code, invent transformations, execute shell commands, and validate everything, we can separate the responsibilities.&lt;/p&gt;

&lt;h3&gt;
  
  
  Agent 1: Repository Analysis Agent
&lt;/h3&gt;

&lt;p&gt;This agent inspects a repository and identifies its technology stack, dependencies, build system, tests, and potential modernization blockers.&lt;/p&gt;

&lt;p&gt;An illustrative output could be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"language"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Java"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"build_tool"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Maven"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"framework"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Spring Boot"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"target"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Spring Boot 3"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"tests_detected"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"manual_review_recommended"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These values are examples. A real implementation must derive them from repository evidence.&lt;/p&gt;

&lt;h3&gt;
  
  
  Agent 2: Transformation Discovery Agent
&lt;/h3&gt;

&lt;p&gt;This agent checks whether a suitable transformation already exists.&lt;/p&gt;

&lt;p&gt;If an approved transformation matches the repository and target, the workflow can use it. Otherwise, the orchestrator can request a candidate transformation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Agent 3: Custom Transformation Creation Agent
&lt;/h3&gt;

&lt;p&gt;This agent helps translate a modernization requirement into a candidate transformation definition.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Create a reusable transformation for supported Spring Boot 2 to Spring Boot 3 migration patterns. Identify dependency changes, update supported configuration patterns, and flag unsupported cases for manual review.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The candidate must be tested and reviewed before it is added to a shared transformation catalog.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Never treat generated transformation logic as automatically trusted production code.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Agent 4: Execution Agent
&lt;/h3&gt;

&lt;p&gt;This agent coordinates the execution request and submits approved work to the execution system.&lt;/p&gt;

&lt;p&gt;AWS Batch runs the configured transformation container. The job's exit code and validation results determine the actual outcome.&lt;/p&gt;

&lt;h3&gt;
  
  
  The orchestrator
&lt;/h3&gt;

&lt;p&gt;The Strands orchestrator coordinates the workflow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Validate the request.&lt;/li&gt;
&lt;li&gt;Analyze the repository.&lt;/li&gt;
&lt;li&gt;Find an appropriate transformation.&lt;/li&gt;
&lt;li&gt;Request a new candidate if needed.&lt;/li&gt;
&lt;li&gt;Route it for approval.&lt;/li&gt;
&lt;li&gt;Submit approved work.&lt;/li&gt;
&lt;li&gt;Collect execution and test results.&lt;/li&gt;
&lt;li&gt;Update the job record.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This division makes the workflow easier to understand, test, and govern.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Design the web application
&lt;/h2&gt;

&lt;p&gt;A useful platform needs a clear interface, not just an agent that responds to prompts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Screen 1: Dashboard
&lt;/h3&gt;

&lt;p&gt;The dashboard shows the status of the modernization portfolio.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;+--------------------------------------------------+
| ModernizeHub                         Account      |
+--------------------------------------------------+
| Total Repositories: 200                           |
| Completed: 142        Running: 18                 |
| Failed: 12             Awaiting Review: 28        |
|                                                  |
| [Analyze Repository]      [Upload CSV Batch]      |
|                                                  |
| Repository          Transformation       Status  |
| payments-service    Java Upgrade         Complete|
| customer-api        Python Upgrade       Running |
| billing-worker      Custom Migration     Review  |
+--------------------------------------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are mock numbers for illustrating the interface, not real execution results.&lt;/p&gt;

&lt;p&gt;The production dashboard should retrieve actual data from the backend.&lt;/p&gt;

&lt;h3&gt;
  
  
  Screen 2: Analyze a repository
&lt;/h3&gt;

&lt;p&gt;A developer enters a repository URL and selects the modernization target.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Repository URL:
https://github.com/example-org/payments-service

Modernization Goal:
Upgrade supported Spring Boot 2 patterns to Spring Boot 3

Validation Profile:
Maven build and unit tests

[Analyze Repository]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The API validates the request, creates a job ID, and starts the asynchronous workflow.&lt;/p&gt;

&lt;p&gt;The example repository URL is illustrative.&lt;/p&gt;

&lt;h3&gt;
  
  
  Screen 3: Custom transformation builder
&lt;/h3&gt;

&lt;p&gt;If no suitable transformation exists, the developer can provide a natural-language requirement.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Transformation Name:
spring-boot-3-modernization

Requirements:
- Identify supported dependency changes
- Update compatible configuration patterns
- Flag unsupported changes
- Produce a reviewable transformation

[Generate Candidate]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The application displays the generated candidate so an engineer can inspect, test, approve, or reject it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Screen 4: Batch processing
&lt;/h3&gt;

&lt;p&gt;The developer uploads a CSV file, previews the repositories, fixes invalid rows, and submits the batch.&lt;/p&gt;

&lt;p&gt;Each accepted repository becomes an independent job.&lt;/p&gt;

&lt;h3&gt;
  
  
  Screen 5: Job details
&lt;/h3&gt;

&lt;p&gt;Each job should display:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Repository and revision&lt;/li&gt;
&lt;li&gt;Transformation name and version&lt;/li&gt;
&lt;li&gt;Current status&lt;/li&gt;
&lt;li&gt;Execution logs&lt;/li&gt;
&lt;li&gt;Build and test results&lt;/li&gt;
&lt;li&gt;Output artifact location&lt;/li&gt;
&lt;li&gt;Failure details&lt;/li&gt;
&lt;li&gt;Approval history&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This makes it easier to troubleshoot one application without losing visibility into the rest of the batch.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Example: Submit multiple repositories with CSV
&lt;/h2&gt;

&lt;p&gt;Create a file named &lt;code&gt;sample-batch.csv&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;repository_url,transformation_name,validation_profile,context
https://github.com/example-org/service-a,python-runtime-upgrade,python-tests,Upgrade supported Python patterns
https://github.com/example-org/service-b,spring-boot-modernization,maven-tests,Review framework dependencies
https://github.com/example-org/service-c,aws-sdk-migration,java-tests,Update supported SDK usage
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are example rows. The repositories must be accessible, and the transformation names and validation profiles must exist in the deployed platform.&lt;/p&gt;

&lt;h3&gt;
  
  
  What happens after upload?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Step 1 — Validate the input&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Check required fields, repository policies, transformation names, duplicate submissions, and file size.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2 — Preview the batch&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Show the parsed rows and allow the user to fix errors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3 — Create job records&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Create a unique ID for each accepted repository.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4 — Resolve transformations&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Find approved transformations and route missing or newly generated definitions through the appropriate review process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5 — Execute jobs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Submit approved jobs to AWS Batch, respecting concurrency limits.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 6 — Validate changes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Run the configured build and test commands.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 7 — Report results&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Update each job's status and expose available logs and artifacts.&lt;/p&gt;

&lt;p&gt;An illustrative outcome might be:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Repository&lt;/th&gt;
&lt;th&gt;Status&lt;/th&gt;
&lt;th&gt;Next step&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;service-a&lt;/td&gt;
&lt;td&gt;Completed&lt;/td&gt;
&lt;td&gt;Review validation report&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;service-b&lt;/td&gt;
&lt;td&gt;Failed validation&lt;/td&gt;
&lt;td&gt;Investigate build error&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;service-c&lt;/td&gt;
&lt;td&gt;Awaiting approval&lt;/td&gt;
&lt;td&gt;Review proposed transformation&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These results are examples, not claimed test results.&lt;/p&gt;

&lt;p&gt;A failure in one repository should not automatically mark every other job in the batch as failed.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Validate the transformed code
&lt;/h2&gt;

&lt;p&gt;An agent saying "completed" does not prove that the application works.&lt;/p&gt;

&lt;p&gt;Each execution should:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Check out an approved repository revision.&lt;/li&gt;
&lt;li&gt;Prepare an isolated working environment.&lt;/li&gt;
&lt;li&gt;Run the selected transformation.&lt;/li&gt;
&lt;li&gt;Capture logs and the exit code.&lt;/li&gt;
&lt;li&gt;Run approved build and test commands.&lt;/li&gt;
&lt;li&gt;Store the patch and reports.&lt;/li&gt;
&lt;li&gt;Update the job status.&lt;/li&gt;
&lt;li&gt;Flag failures for investigation.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For a Maven-based Java application, a test step might be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mvn &lt;span class="nt"&gt;-B&lt;/span&gt; &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a Python application, it might be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python &lt;span class="nt"&gt;-m&lt;/span&gt; pytest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are examples only. Use commands appropriate to the repository and toolchain.&lt;/p&gt;

&lt;p&gt;Do not execute arbitrary commands supplied by an untrusted repository or model output in a privileged environment.&lt;/p&gt;

&lt;p&gt;For more complete validation, add static analysis, dependency security scanning, integration tests, and application-specific acceptance tests.&lt;/p&gt;

&lt;p&gt;A successful build is useful evidence, but it does not guarantee that all application behavior remains correct.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Infrastructure as code: CDK, SAM, or Terraform?
&lt;/h2&gt;

&lt;p&gt;Infrastructure as code makes the deployment reproducible.&lt;/p&gt;

&lt;p&gt;The platform needs resources for the frontend, API, agent runtime, execution environment, storage, tracking, and monitoring.&lt;/p&gt;

&lt;p&gt;A project might organize its code like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;modernizehub/
├── frontend/
├── api/
├── agents/
│   ├── orchestrator.py
│   ├── analyze_agent.py
│   ├── discovery_agent.py
│   ├── create_agent.py
│   └── execute_agent.py
├── batch/
│   ├── Dockerfile
│   └── entrypoint.sh
├── transformations/
├── tests/
├── samples/
│   └── sample-batch.csv
└── infrastructure/
    ├── cdk-sam/
    └── terraform/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a suggested structure, not the exact structure of the AWS sample.&lt;/p&gt;

&lt;p&gt;AWS's public repository contains an implementation under &lt;code&gt;agentic-atx-platform&lt;/code&gt; and documents deployment using AWS CDK and AWS SAM.&lt;/p&gt;

&lt;p&gt;Explore it here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/aws-samples/aws-transform-custom-samples/tree/main/agentic-atx-platform" rel="noopener noreferrer"&gt;https://github.com/aws-samples/aws-transform-custom-samples/tree/main/agentic-atx-platform&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If your team uses Terraform, you can build an equivalent Terraform implementation for supported AWS resources and deployment steps. However, the linked sample should not be mistaken for a ready-made Terraform deployment.&lt;/p&gt;

&lt;p&gt;Before deploying, review current service availability, model access, IAM permissions, network requirements, and cleanup instructions.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Security considerations
&lt;/h2&gt;

&lt;p&gt;A modernization platform can read source code and execute build tools. Security must be part of the design.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Least privilege:&lt;/strong&gt; Give each component only the permissions it needs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Secure credentials:&lt;/strong&gt; Do not embed repository tokens in prompts, logs, or container images.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Isolated execution:&lt;/strong&gt; Run jobs in controlled environments with resource limits and restricted network access where practical.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Human approval:&lt;/strong&gt; Review new transformation definitions before publishing them for reuse.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reviewable changes:&lt;/strong&gt; Preserve the original revision and make patches easy to inspect.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Safe retries:&lt;/strong&gt; Track job IDs, transformation versions, and outputs to prevent blind repeat execution.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Auditability:&lt;/strong&gt; Record the requester, repository revision, transformation version, approval status, and validation results.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cost controls:&lt;/strong&gt; Limit concurrency and monitor model usage, compute, storage, and logging costs.&lt;/p&gt;

&lt;p&gt;The goal is to automate repetitive work without removing engineers from important decisions.&lt;/p&gt;

&lt;h2&gt;
  
  
  10. Try the public AWS sample
&lt;/h2&gt;

&lt;p&gt;You do not have to build every component from scratch.&lt;/p&gt;

&lt;p&gt;Start with the public repository:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/aws-samples/aws-transform-custom-samples" rel="noopener noreferrer"&gt;https://github.com/aws-samples/aws-transform-custom-samples&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Review the &lt;code&gt;agentic-atx-platform&lt;/code&gt; README and architecture.&lt;/li&gt;
&lt;li&gt;Check the current prerequisites, AWS Region, model access, and IAM requirements.&lt;/li&gt;
&lt;li&gt;Configure the required AWS credentials and development tools.&lt;/li&gt;
&lt;li&gt;Deploy the sample using its documented instructions.&lt;/li&gt;
&lt;li&gt;Test with one repository that you control.&lt;/li&gt;
&lt;li&gt;Verify job status, transformation output, logs, and validation results.&lt;/li&gt;
&lt;li&gt;Test a small CSV batch.&lt;/li&gt;
&lt;li&gt;Increase concurrency only after reviewing reliability and cost.&lt;/li&gt;
&lt;li&gt;Follow the documented cleanup procedure when finished.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Deployment commands and requirements can change, so use the repository's current instructions.&lt;/p&gt;

&lt;h2&gt;
  
  
  11. How do we measure success?
&lt;/h2&gt;

&lt;p&gt;Measure the platform using actual outcomes rather than the number of agents.&lt;/p&gt;

&lt;p&gt;Useful metrics include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Number of repositories submitted and completed&lt;/li&gt;
&lt;li&gt;Percentage matched to existing transformations&lt;/li&gt;
&lt;li&gt;Custom transformations approved or rejected&lt;/li&gt;
&lt;li&gt;Transformation execution success rate&lt;/li&gt;
&lt;li&gt;Build and test pass rate&lt;/li&gt;
&lt;li&gt;Average processing time per repository&lt;/li&gt;
&lt;li&gt;Manual intervention rate&lt;/li&gt;
&lt;li&gt;Cost per completed repository&lt;/li&gt;
&lt;li&gt;Changes successfully reviewed and merged&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Compare these metrics with your existing modernization process before claiming productivity improvements.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Modernizing hundreds of applications is a coordination challenge involving code analysis, transformation selection, execution, testing, and governance.&lt;/p&gt;

&lt;p&gt;Strands Agents can coordinate the workflow. AWS Transform custom provides reusable transformation capabilities. Amazon Bedrock AgentCore supports the agent runtime, while AWS Batch enables independent repository jobs to run in parallel.&lt;/p&gt;

&lt;p&gt;A dashboard, API, S3, DynamoDB, and infrastructure as code bring these capabilities together into an application that engineers can monitor and extend.&lt;/p&gt;

&lt;p&gt;The most important lesson is this:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Don't give AI unrestricted control over every repository. Let agents help plan the work, use approved transformations to make changes, validate the results, and keep engineers in control of important decisions.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Start with one repository. Prove the workflow. Test a small batch. Then scale based on evidence.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/blogs/devops/use-generative-ai-agents-for-application-modernization-at-scale-with-strands-amazon-transform-custom-and-amazon-bedrock-agentcore/" rel="noopener noreferrer"&gt;AWS Blog: Agentic application modernization at scale with Strands and AWS Transform custom&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/aws-samples/aws-transform-custom-samples" rel="noopener noreferrer"&gt;AWS Transform custom samples on GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/aws-samples/aws-transform-custom-samples/tree/main/agentic-atx-platform" rel="noopener noreferrer"&gt;Agentic ATX Platform sample&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://strandsagents.com/" rel="noopener noreferrer"&gt;Strands Agents documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/bedrock/agentcore/" rel="noopener noreferrer"&gt;Amazon Bedrock AgentCore&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>ai</category>
      <category>devops</category>
      <category>python</category>
    </item>
    <item>
      <title>Building REST APIs on AWS with API Gateway, Lambda, and DynamoDB</title>
      <dc:creator>Muhammad Umair Ashraf</dc:creator>
      <pubDate>Mon, 26 Oct 2026 02:35:55 +0000</pubDate>
      <link>https://dev.to/omayrashraf/building-rest-apis-on-aws-with-api-gateway-lambda-and-dynamodb-3jef</link>
      <guid>https://dev.to/omayrashraf/building-rest-apis-on-aws-with-api-gateway-lambda-and-dynamodb-3jef</guid>
      <description>&lt;p&gt;Modern applications depend on APIs to exchange data. A web application retrieves products, a mobile app submits orders, and an internal dashboard fetches operational 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuat232jnsvzm19dnlbck.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuat232jnsvzm19dnlbck.jpeg" alt=" " width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;REST APIs provide a standard way for these applications to communicate over HTTP.&lt;/p&gt;

&lt;p&gt;On AWS, you can build a serverless REST API using &lt;strong&gt;Amazon API Gateway, AWS Lambda, and Amazon DynamoDB&lt;/strong&gt;. This approach reduces infrastructure management while giving you managed services for API routing, application logic, and data storage.&lt;/p&gt;

&lt;p&gt;In this tutorial, we'll explore the architecture and build a simple product endpoint using Python.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. What Is a REST API?
&lt;/h2&gt;

&lt;p&gt;A REST API exposes resources through URLs and uses HTTP methods to perform operations.&lt;/p&gt;

&lt;p&gt;Imagine you're building a product catalog API:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Endpoint&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GET&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/products&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;List products&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GET&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/products/101&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Retrieve one product&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;POST&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/products&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Create a product&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;PUT&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/products/101&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Replace a product&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;PATCH&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/products/101&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Update selected fields&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;DELETE&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/products/101&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Delete a product&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A response might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"101"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Cloud Fundamentals Guide"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"category"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Education"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"available"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A good REST API uses consistent resource names, appropriate HTTP methods, meaningful status codes, input validation, and predictable response formats.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The AWS Architecture
&lt;/h2&gt;

&lt;p&gt;Our example uses four primary services:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Amazon API Gateway:&lt;/strong&gt; Receives HTTP requests and routes them to the backend.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Lambda:&lt;/strong&gt; Executes the application logic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon DynamoDB:&lt;/strong&gt; Stores product records.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon CloudWatch:&lt;/strong&gt; Collects logs and metrics to help troubleshoot problems.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The request flow is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Client → API Gateway → Lambda → DynamoDB&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The response travels back to the client through API Gateway.&lt;/p&gt;

&lt;p&gt;IAM controls the permissions that allow Lambda to access DynamoDB and allow API Gateway to invoke Lambda.&lt;/p&gt;

&lt;p&gt;This separation makes the application easier to maintain and scale without managing API servers.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Create a Lambda Function
&lt;/h2&gt;

&lt;p&gt;Let's begin with a simple endpoint that returns a sample product.&lt;/p&gt;

&lt;p&gt;In the AWS Lambda console, create a function named &lt;code&gt;GetProductFunction&lt;/code&gt; using a supported Python runtime.&lt;/p&gt;

&lt;p&gt;Add the following code:&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="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;lambda_handler&lt;/span&gt;&lt;span class="p"&gt;(&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;context&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;product&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;id&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;101&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;name&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;Cloud Fundamentals Guide&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;category&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;Education&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;available&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&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;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;statusCode&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;headers&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;Content-Type&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;application/json&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;body&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;product&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;This function returns a JSON response with an HTTP status code of &lt;code&gt;200&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For now, the product is hard-coded. That keeps the first example focused on the API request and response flow.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Configure Amazon API Gateway
&lt;/h2&gt;

&lt;p&gt;Next, expose the Lambda function through an API endpoint.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the Amazon API Gateway console.&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Create API&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;REST API&lt;/strong&gt; and choose &lt;strong&gt;Build&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Name the API &lt;code&gt;ProductManagementAPI&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Create a resource named &lt;code&gt;/products&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Add a &lt;code&gt;GET&lt;/code&gt; method.&lt;/li&gt;
&lt;li&gt;Configure the method to invoke &lt;code&gt;GetProductFunction&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Save the configuration.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Make sure API Gateway has permission to invoke the Lambda function. Verify the function's resource-based policy if you encounter an invocation error.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deploy the API
&lt;/h3&gt;

&lt;p&gt;Deploy the API to a stage named &lt;code&gt;dev&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The invoke URL will look similar to this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://{api-id}.execute-api.{region}.amazonaws.com/dev/products
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;{api-id}&lt;/code&gt; and &lt;code&gt;{region}&lt;/code&gt; with the values from your API.&lt;/p&gt;

&lt;h3&gt;
  
  
  Test the endpoint
&lt;/h3&gt;

&lt;p&gt;You can use &lt;code&gt;curl&lt;/code&gt; to send an HTTP request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="s2"&gt;"https://{api-id}.execute-api.{region}.amazonaws.com/dev/products"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the integration is configured correctly, the response should contain &lt;code&gt;200 OK&lt;/code&gt; and the product JSON.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You've now created a basic serverless API endpoint on AWS.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Official walkthrough: &lt;a href="https://docs.aws.amazon.com/lambda/latest/dg/services-apigateway-tutorial.html" rel="noopener noreferrer"&gt;Using AWS Lambda with Amazon API Gateway&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Connect the API to DynamoDB
&lt;/h2&gt;

&lt;p&gt;Hard-coded data is useful for a first test, but real applications need persistent storage.&lt;/p&gt;

&lt;p&gt;Create a DynamoDB table named &lt;code&gt;Products&lt;/code&gt; with a string partition key named &lt;code&gt;id&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now configure a &lt;code&gt;GET&lt;/code&gt; resource at &lt;code&gt;/products/{id}&lt;/code&gt; and connect it to a Lambda function like this:&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="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&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;dynamodb&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;resource&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;dynamodb&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;table&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dynamodb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Table&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;PRODUCTS_TABLE&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;lambda_handler&lt;/span&gt;&lt;span class="p"&gt;(&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;context&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;path_parameters&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="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;pathParameters&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
    &lt;span class="n"&gt;product_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;path_parameters&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;id&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="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;product_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;statusCode&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;headers&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;Content-Type&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;application/json&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;body&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;message&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;Product ID is required&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;try&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;table&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_item&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;Key&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;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;product_id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;product&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="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;Item&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="n"&gt;product&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;statusCode&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;404&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;headers&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;Content-Type&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;application/json&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;body&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
                    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;message&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;Product not found&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;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;statusCode&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;headers&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;Content-Type&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;application/json&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;body&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;product&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&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;Product lookup failed&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;statusCode&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;headers&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;Content-Type&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;application/json&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;body&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;message&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;Internal server error&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;Before testing this version:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set the Lambda environment variable &lt;code&gt;PRODUCTS_TABLE&lt;/code&gt; to &lt;code&gt;Products&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Give the Lambda execution role &lt;code&gt;dynamodb:GetItem&lt;/code&gt; permission on the specific table.&lt;/li&gt;
&lt;li&gt;Ensure the table's partition key is the string attribute &lt;code&gt;id&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Deploy the updated Lambda function and API configuration.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The function returns &lt;code&gt;404&lt;/code&gt; when a product doesn't exist and avoids exposing internal exception details to the caller.&lt;/p&gt;

&lt;p&gt;For production use, add structured logging, tests, and appropriate exception classification. Avoid logging sensitive information.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. REST API or HTTP API?
&lt;/h2&gt;

&lt;p&gt;Amazon API Gateway offers both REST APIs and HTTP APIs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;REST API&lt;/strong&gt; is worth considering when you need features such as usage plans, API keys, configurable request validation, or supported AWS WAF integration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTTP API&lt;/strong&gt; can be a good fit for simpler applications that need HTTP routing and backend integrations without the full REST API feature set.&lt;/p&gt;

&lt;p&gt;Compare the current feature set and pricing before deciding.&lt;/p&gt;

&lt;p&gt;Documentation: &lt;a href="https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html" rel="noopener noreferrer"&gt;Amazon API Gateway Developer Guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Secure Your API
&lt;/h2&gt;

&lt;p&gt;A working API isn't necessarily a secure API. Build security into the design from the beginning.&lt;/p&gt;

&lt;h3&gt;
  
  
  Authentication and authorization
&lt;/h3&gt;

&lt;p&gt;Depending on your application, API Gateway can use IAM authorization, Amazon Cognito user pools, or Lambda authorizers.&lt;/p&gt;

&lt;p&gt;Authentication identifies the caller. Authorization determines which operations and resources that caller may access.&lt;/p&gt;

&lt;h3&gt;
  
  
  Least-privilege permissions
&lt;/h3&gt;

&lt;p&gt;A Lambda function that reads products should not have unrestricted access to every AWS resource.&lt;/p&gt;

&lt;p&gt;Grant only the permissions required for its task. Use separate permissions for functions that create, update, or delete data where appropriate.&lt;/p&gt;

&lt;h3&gt;
  
  
  Input validation
&lt;/h3&gt;

&lt;p&gt;Validate path parameters, query strings, request bodies, data types, and allowed values. Reject invalid requests before they reach sensitive application logic.&lt;/p&gt;

&lt;h3&gt;
  
  
  Throttling and abuse protection
&lt;/h3&gt;

&lt;p&gt;Configure throttling limits appropriate for the workload. AWS WAF can provide additional filtering for supported API Gateway REST API configurations.&lt;/p&gt;

&lt;h3&gt;
  
  
  Protect sensitive information
&lt;/h3&gt;

&lt;p&gt;Use HTTPS, avoid putting credentials in URLs, keep secrets out of source code, and review logging policies to prevent accidental exposure of tokens or personal information.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Monitor and Troubleshoot
&lt;/h2&gt;

&lt;p&gt;Amazon CloudWatch provides logs and metrics that help you understand API behavior.&lt;/p&gt;

&lt;p&gt;Pay attention to these signals:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Signal&lt;/th&gt;
&lt;th&gt;Possible cause&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;4XX&lt;/code&gt; responses&lt;/td&gt;
&lt;td&gt;Invalid requests, missing resources, or authorization problems&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;5XX&lt;/code&gt; responses&lt;/td&gt;
&lt;td&gt;Backend errors or integration failures&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;High latency&lt;/td&gt;
&lt;td&gt;Slow Lambda execution or downstream operations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lambda errors&lt;/td&gt;
&lt;td&gt;Application exceptions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DynamoDB throttling&lt;/td&gt;
&lt;td&gt;Capacity constraints or access-pattern problems&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These metrics help narrow down issues, but they don't always identify the root cause. Correlate API Gateway metrics with Lambda logs and DynamoDB metrics to investigate failures.&lt;/p&gt;

&lt;p&gt;For production systems, consider structured logging, request IDs, CloudWatch alarms, and appropriate log retention.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Manage Costs and Scaling
&lt;/h2&gt;

&lt;p&gt;Serverless services reduce infrastructure management, but they still incur costs.&lt;/p&gt;

&lt;p&gt;Your bill may include API requests, Lambda execution duration, DynamoDB usage, CloudWatch logs, and optional security services.&lt;/p&gt;

&lt;p&gt;A few practical ways to manage costs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose the API type based on actual requirements.&lt;/li&gt;
&lt;li&gt;Optimize Lambda execution duration through testing.&lt;/li&gt;
&lt;li&gt;Design DynamoDB keys and indexes around your access patterns.&lt;/li&gt;
&lt;li&gt;Configure log retention.&lt;/li&gt;
&lt;li&gt;Monitor usage and establish budgets.&lt;/li&gt;
&lt;li&gt;Test expected traffic before production deployment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Review &lt;a href="https://aws.amazon.com/api-gateway/pricing/" rel="noopener noreferrer"&gt;Amazon API Gateway pricing&lt;/a&gt; and the pricing for other services in your architecture.&lt;/p&gt;

&lt;h2&gt;
  
  
  10. Production Readiness Checklist
&lt;/h2&gt;

&lt;p&gt;Before releasing your API, check the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Use consistent resource names and HTTP methods.&lt;/li&gt;
&lt;li&gt;[ ] Validate incoming requests.&lt;/li&gt;
&lt;li&gt;[ ] Return meaningful HTTP status codes.&lt;/li&gt;
&lt;li&gt;[ ] Configure authentication and authorization.&lt;/li&gt;
&lt;li&gt;[ ] Apply least-privilege IAM permissions.&lt;/li&gt;
&lt;li&gt;[ ] Set appropriate throttling and abuse protection.&lt;/li&gt;
&lt;li&gt;[ ] Configure logs, metrics, and alarms.&lt;/li&gt;
&lt;li&gt;[ ] Test invalid requests and backend failures.&lt;/li&gt;
&lt;li&gt;[ ] Plan deployment stages and API versioning.&lt;/li&gt;
&lt;li&gt;[ ] Review cost estimates and test realistic traffic.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Building a REST API on AWS involves more than creating an endpoint. It requires a thoughtful combination of routing, application logic, data storage, permissions, monitoring, and operational controls.&lt;/p&gt;

&lt;p&gt;Amazon API Gateway, AWS Lambda, and DynamoDB provide a practical foundation for serverless APIs. Start with a simple &lt;code&gt;GET&lt;/code&gt; endpoint, connect it to persistent data, and then add the security and monitoring your application requires.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Question for the community:&lt;/strong&gt; For a new AWS application, would you choose API Gateway REST API or HTTP API? What requirements influence your choice?&lt;/p&gt;

&lt;h2&gt;
  
  
  Further Reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-rest-tutorials.html" rel="noopener noreferrer"&gt;Amazon API Gateway REST API tutorials&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/lambda/latest/dg/services-apigateway-tutorial.html" rel="noopener noreferrer"&gt;AWS Lambda and API Gateway tutorial&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/api-gateway/pricing/" rel="noopener noreferrer"&gt;Amazon API Gateway pricing&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  AWS #Serverless #Python #APIs
&lt;/h1&gt;

</description>
      <category>aws</category>
      <category>serverless</category>
      <category>python</category>
      <category>webdev</category>
    </item>
    <item>
      <title>PHP2Shell: How AI Is Transforming Vulnerability Discovery and AWS Cloud Security</title>
      <dc:creator>Muhammad Umair Ashraf</dc:creator>
      <pubDate>Sun, 25 Oct 2026 08:52:00 +0000</pubDate>
      <link>https://dev.to/omayrashraf/php2shell-how-ai-is-transforming-vulnerability-discovery-and-aws-cloud-security-4clf</link>
      <guid>https://dev.to/omayrashraf/php2shell-how-ai-is-transforming-vulnerability-discovery-and-aws-cloud-security-4clf</guid>
      <description>&lt;p&gt;AI is changing how developers write code, test applications, and operate cloud infrastructure. It is also changing how security researchers discover vulnerabilities hidden deep inside mature software.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe1mhdgpvth3aidi8anke.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe1mhdgpvth3aidi8anke.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In October 2026, two critical PHP vulnerabilities brought this shift into focus: &lt;strong&gt;CVE-2026-109618&lt;/strong&gt; and &lt;strong&gt;CVE-2026-109619&lt;/strong&gt;, collectively known as PHP2Shell.&lt;/p&gt;

&lt;p&gt;The incident raises an important question for developers, DevOps engineers, and cloud security teams:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If AI can help discover vulnerabilities in software that has existed for years, how should we redesign our security workflows to keep up?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The answer is not simply to add another AI tool. We need reliable asset inventories, fast patch deployment, defense in depth, and AI-assisted workflows with clear safety boundaries.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; This article discusses defensive security, vulnerability remediation, and secure cloud architecture. Always validate current vulnerability status against official advisories and your software vendor's guidance.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  1. What Is PHP2Shell?
&lt;/h2&gt;

&lt;p&gt;PHP2Shell refers to two critical vulnerabilities affecting memory handling in the PHP runtime.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CVE-2026-109618:&lt;/strong&gt; A memory-corruption issue associated with out-of-memory handling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CVE-2026-109619:&lt;/strong&gt; A use-after-free issue involving stale internal state.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both issues have been reported as potentially enabling unauthenticated remote code execution in affected environments. Each received a CVSS v4.0 score of 9.2.&lt;/p&gt;

&lt;p&gt;References: &lt;a href="https://openai.com/index/coordinated-disclosure-of-critical-vulnerabilities/" rel="noopener noreferrer"&gt;OpenAI's coordinated disclosure report&lt;/a&gt; and &lt;a href="https://www.csa.gov.sg/alerts-and-advisories/alerts/al-2026-151/" rel="noopener noreferrer"&gt;Cyber Security Agency of Singapore advisory&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why should developers care?
&lt;/h3&gt;

&lt;p&gt;Many web vulnerabilities originate in application code, such as an authorization mistake or unsafe input handling.&lt;/p&gt;

&lt;p&gt;PHP2Shell is different because it involves the underlying runtime.&lt;/p&gt;

&lt;p&gt;Even a well-designed application may remain exposed if it executes a vulnerable PHP version. Updating application code alone does not necessarily fix a defect in the runtime itself.&lt;/p&gt;

&lt;p&gt;This is a reminder that application security includes the entire software stack:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Application code&lt;/li&gt;
&lt;li&gt;Frameworks and dependencies&lt;/li&gt;
&lt;li&gt;Language runtimes&lt;/li&gt;
&lt;li&gt;Container images&lt;/li&gt;
&lt;li&gt;Operating systems&lt;/li&gt;
&lt;li&gt;Cloud infrastructure and identity permissions&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. How AI Can Help Find Vulnerabilities
&lt;/h2&gt;

&lt;p&gt;Security researchers traditionally combine code review, debugging, fuzzing, static analysis, and specialized testing to identify difficult defects.&lt;/p&gt;

&lt;p&gt;AI can help accelerate parts of this work.&lt;/p&gt;

&lt;p&gt;For example, an AI-assisted research workflow can help engineers:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Understand an unfamiliar codebase.&lt;/li&gt;
&lt;li&gt;Identify suspicious memory-management patterns.&lt;/li&gt;
&lt;li&gt;Trace how external input reaches sensitive functions.&lt;/li&gt;
&lt;li&gt;Generate focused test cases.&lt;/li&gt;
&lt;li&gt;Summarize crash reports and execution traces.&lt;/li&gt;
&lt;li&gt;Review proposed fixes for possible gaps.&lt;/li&gt;
&lt;li&gt;Draft regression tests and remediation documentation.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In the PHP2Shell case, OpenAI reported AI-assisted vulnerability discovery through its Patch the Planet initiative. Wiz independently discovered and reported both vulnerabilities, and PHP maintainers and security partners coordinated remediation.&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://openai.com/index/coordinated-disclosure-of-critical-vulnerabilities/" rel="noopener noreferrer"&gt;OpenAI — Coordinated disclosure of critical vulnerabilities&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;However, &lt;strong&gt;AI-generated suspicion is not the same as a confirmed vulnerability&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A researcher still needs to reproduce the behavior safely, establish its security impact, validate the fix, and communicate the findings responsibly.&lt;/p&gt;

&lt;p&gt;AI is best treated as a force multiplier for experienced security engineers—not as an unquestionable security authority.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. AWS Architecture: Defend in Multiple Layers
&lt;/h2&gt;

&lt;p&gt;Suppose you operate a PHP application on AWS. It may run on Amazon EC2 or in containers on Amazon ECS or Amazon EKS.&lt;/p&gt;

&lt;p&gt;A defensive architecture could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                 Internet
                    |
                    v
             Amazon CloudFront
                    |
                    v
                AWS WAF
                    |
                    v
          Application Load Balancer
                    |
                    v
          PHP Runtime on EC2 / ECS
                    |
              +-----+-----+
              |           |
              v           v
        Private Data   Application Logs
        and Services         |
                             v
                    Amazon CloudWatch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;CloudFront is optional; the architecture should match your actual deployment.&lt;/p&gt;

&lt;p&gt;Each layer serves a different purpose:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Security purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;AWS WAF&lt;/td&gt;
&lt;td&gt;Filters requests using configured rules&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Load balancer&lt;/td&gt;
&lt;td&gt;Routes traffic to application targets&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Security groups&lt;/td&gt;
&lt;td&gt;Restrict network access&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IAM&lt;/td&gt;
&lt;td&gt;Limits access to AWS resources&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CloudWatch&lt;/td&gt;
&lt;td&gt;Supports logging, metrics, and alerts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Patch pipeline&lt;/td&gt;
&lt;td&gt;Deploys fixed runtime versions&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;AWS has published guidance on using AWS WAF to mitigate PHP2Shell attack paths. Such controls can reduce exposure, but they do not replace upgrading the affected PHP runtime.&lt;/p&gt;

&lt;p&gt;Reference: &lt;a href="https://aws.amazon.com/blogs/security/using-aws-waf-to-apply-mitigations-for-php2shell-rce-vulnerabilities-cve-2026-109618-and-cve-2026-109619/" rel="noopener noreferrer"&gt;AWS Security Blog — PHP2Shell mitigation guidance&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Security principle:&lt;/strong&gt; Network controls, WAF rules, and monitoring are additional defenses. They are not substitutes for fixing vulnerable software.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Immediate Remediation Checklist
&lt;/h2&gt;

&lt;p&gt;When a critical runtime vulnerability is disclosed, speed matters—but so does verification.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Inventory PHP versions
&lt;/h3&gt;

&lt;p&gt;On a Linux host, start by checking:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is only a starting point. For containerized workloads, inspect the PHP version inside the actual image or running container.&lt;/p&gt;

&lt;p&gt;Include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;EC2 instances&lt;/li&gt;
&lt;li&gt;ECS and EKS workloads&lt;/li&gt;
&lt;li&gt;CI/CD build images&lt;/li&gt;
&lt;li&gt;Development and staging systems&lt;/li&gt;
&lt;li&gt;Legacy applications&lt;/li&gt;
&lt;li&gt;Third-party software that bundles PHP&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 2: Upgrade affected environments
&lt;/h3&gt;

&lt;p&gt;The PHP fixes reported for supported branches include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PHP 8.5.12&lt;/li&gt;
&lt;li&gt;PHP 8.4.27&lt;/li&gt;
&lt;li&gt;PHP 8.3.36&lt;/li&gt;
&lt;li&gt;PHP 8.2.35&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Check the &lt;a href="https://www.wiz.io/blog/php2shell-php-rce" rel="noopener noreferrer"&gt;PHP2Shell security research&lt;/a&gt; and official PHP or distribution advisories to confirm the correct fixed release for your environment. Vendors may backport fixes, so version comparisons must account for package-specific guidance.&lt;/p&gt;

&lt;p&gt;For containers, rebuild and redeploy the image. Updating the host does not automatically update PHP embedded in an existing container image.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Apply temporary mitigations
&lt;/h3&gt;

&lt;p&gt;If patching is delayed, follow official vendor guidance for temporary protections. AWS WAF may provide an additional defensive layer, but no WAF configuration should be assumed to block every possible attack path.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Investigate potential compromise
&lt;/h3&gt;

&lt;p&gt;Review relevant application, web server, operating system, and security logs.&lt;/p&gt;

&lt;p&gt;Investigate unusual processes, unexpected file changes, suspicious outbound connections, and possible credential exposure. If compromise is suspected, follow your incident response process and preserve evidence.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Verify remediation
&lt;/h3&gt;

&lt;p&gt;Confirm that every affected instance and container is running a fixed runtime. Run application tests and retain evidence of the deployed version.&lt;/p&gt;

&lt;p&gt;A successful build does not prove that every production replica has been updated.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Build an AI-Assisted Vulnerability Remediation Workflow
&lt;/h2&gt;

&lt;p&gt;We can use AWS services to coordinate vulnerability findings, AI-assisted analysis, approval, and verification.&lt;/p&gt;

&lt;p&gt;Here is one possible design:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     Asset Inventory and Security Scans
                    |
                    v
         EventBridge / Lambda
                    |
                    v
          Normalize Findings
                    |
                    v
       AI-Assisted Triage (Optional)
             Amazon Bedrock
                    |
                    v
        Deterministic Policy Checks
                    |
                    v
             Human Approval
                    |
                    v
             CI/CD Pipeline
                    |
                    v
       Verify Runtime and Deployment
                    |
                    v
          Audit Evidence and Alerts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a proposed architecture, not a built-in integration automatically provided by these services.&lt;/p&gt;

&lt;h3&gt;
  
  
  Possible AWS service responsibilities
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;Example responsibility&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Amazon S3&lt;/td&gt;
&lt;td&gt;Store scan reports and remediation evidence&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AWS Lambda&lt;/td&gt;
&lt;td&gt;Process findings and trigger bounded tasks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Amazon EventBridge&lt;/td&gt;
&lt;td&gt;Route relevant events&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AWS Step Functions&lt;/td&gt;
&lt;td&gt;Coordinate multi-step workflows&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Amazon Bedrock&lt;/td&gt;
&lt;td&gt;Summarize findings and suggest remediation plans&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AWS Security Hub&lt;/td&gt;
&lt;td&gt;Aggregate supported findings from integrated sources&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Amazon CloudWatch&lt;/td&gt;
&lt;td&gt;Monitor workflow activity and alerts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AWS IAM&lt;/td&gt;
&lt;td&gt;Enforce least-privilege permissions&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Start small. A team may initially need only a reliable scanner, a runtime inventory, and a patch-verification script. Add AI orchestration when it solves a clear problem.&lt;/p&gt;

&lt;h3&gt;
  
  
  What should AI handle?
&lt;/h3&gt;

&lt;p&gt;An AI component can help:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Explain technical findings to developers.&lt;/li&gt;
&lt;li&gt;Group related issues by application.&lt;/li&gt;
&lt;li&gt;Draft remediation tickets.&lt;/li&gt;
&lt;li&gt;Suggest upgrade paths using approved advisory data.&lt;/li&gt;
&lt;li&gt;Summarize test results.&lt;/li&gt;
&lt;li&gt;Identify missing evidence in a remediation report.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What should deterministic code handle?
&lt;/h3&gt;

&lt;p&gt;Use trusted tools and ordinary code to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Compare installed versions against authoritative advisories.&lt;/li&gt;
&lt;li&gt;Enforce risk policies.&lt;/li&gt;
&lt;li&gt;Require approvals.&lt;/li&gt;
&lt;li&gt;Control deployment permissions.&lt;/li&gt;
&lt;li&gt;Verify that a patch is deployed.&lt;/li&gt;
&lt;li&gt;Record audit evidence.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A language model should not be the sole authority deciding whether a production environment is secure.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Example: A Simple PHP Inventory Check
&lt;/h2&gt;

&lt;p&gt;You can start with a basic shell script that reports the PHP version on a Linux host.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/usr/bin/env bash&lt;/span&gt;

&lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-euo&lt;/span&gt; pipefail

&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="nb"&gt;command&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; php &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null 2&amp;gt;&amp;amp;1&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"PHP executable: &lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;command&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; php&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
    php &lt;span class="nt"&gt;-v&lt;/span&gt; | &lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; 1
&lt;span class="k"&gt;else
    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"PHP is not available in the current PATH."&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save this as &lt;code&gt;check-php-version.sh&lt;/code&gt;, then run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;chmod&lt;/span&gt; +x check-php-version.sh
./check-php-version.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This script reports a version; it &lt;strong&gt;does not determine whether the system is vulnerable&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For a real remediation workflow, collect runtime inventory from approved asset-management systems and compare it with authoritative vendor advisories. Account for vendor backports, custom builds, and multiple PHP installations.&lt;/p&gt;

&lt;p&gt;For containerized applications, run equivalent checks against the deployed image or container rather than relying on the host version.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. What Could AI Security Look Like Next?
&lt;/h2&gt;

&lt;p&gt;These are projections, not guaranteed timelines.&lt;/p&gt;

&lt;h3&gt;
  
  
  Near term: Faster triage
&lt;/h3&gt;

&lt;p&gt;AI-assisted code review, test generation, and remediation drafting can help teams investigate findings more efficiently.&lt;/p&gt;

&lt;h3&gt;
  
  
  Medium term: Continuous security testing
&lt;/h3&gt;

&lt;p&gt;AI may help generate tests for code changes, examine infrastructure configurations, and identify inconsistencies between security policies and deployed environments.&lt;/p&gt;

&lt;h3&gt;
  
  
  Longer term: Bounded autonomous remediation
&lt;/h3&gt;

&lt;p&gt;Security agents may coordinate asset discovery, patch preparation, staged testing, and verification with less manual intervention.&lt;/p&gt;

&lt;p&gt;But granting an AI agent unrestricted production permissions would introduce significant operational and security risks.&lt;/p&gt;

&lt;p&gt;A safer design combines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Read-only analysis by default&lt;/li&gt;
&lt;li&gt;Least-privilege permissions&lt;/li&gt;
&lt;li&gt;Human approval for high-impact changes&lt;/li&gt;
&lt;li&gt;Staging validation&lt;/li&gt;
&lt;li&gt;Independent post-deployment checks&lt;/li&gt;
&lt;li&gt;Audit trails and rollback procedures&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is not unlimited autonomy. It is faster, safer, and measurable remediation.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. The Bigger Risk: AI Is Dual-Use
&lt;/h2&gt;

&lt;p&gt;The same tools that help defenders analyze code can also help attackers investigate software and automate parts of an attack.&lt;/p&gt;

&lt;p&gt;As vulnerability discovery accelerates, organizations need to reduce the time between disclosure and verified remediation.&lt;/p&gt;

&lt;p&gt;That means maintaining accurate asset inventories, automating patch delivery, improving monitoring, and rehearsing incident response before an incident occurs.&lt;/p&gt;

&lt;p&gt;Longer term, secure-by-design engineering matters too. Memory-safe technologies can reduce entire classes of memory errors, while fuzzing, regression tests, and formal verification can improve confidence in critical components.&lt;/p&gt;

&lt;p&gt;AI can assist these efforts, but it cannot guarantee bug-free software.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;PHP2Shell is a useful case study in the changing relationship between AI and cybersecurity.&lt;/p&gt;

&lt;p&gt;AI can help researchers investigate complex software and identify defects. But finding a vulnerability is only the beginning. The actual security outcome depends on validation, responsible disclosure, patch delivery, and verification.&lt;/p&gt;

&lt;p&gt;For AWS engineers, the practical takeaway is straightforward:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Combine AI-assisted analysis with reliable inventory, least privilege, layered defenses, controlled remediation, and independent verification.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The future of cloud security will not be measured only by how quickly AI finds vulnerabilities. It will also be measured by how reliably engineering teams turn those discoveries into secure and resilient systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://openai.com/index/coordinated-disclosure-of-critical-vulnerabilities/" rel="noopener noreferrer"&gt;OpenAI: Coordinated disclosure of critical vulnerabilities&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/blogs/security/using-aws-waf-to-apply-mitigations-for-php2shell-rce-vulnerabilities-cve-2026-109618-and-cve-2026-109619/" rel="noopener noreferrer"&gt;AWS Security Blog: PHP2Shell and AWS WAF mitigations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.wiz.io/blog/php2shell-php-rce" rel="noopener noreferrer"&gt;Wiz: PHP2Shell security research&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.csa.gov.sg/alerts-and-advisories/alerts/al-2026-151/" rel="noopener noreferrer"&gt;Cyber Security Agency of Singapore: PHP2Shell advisory&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/bedrock/" rel="noopener noreferrer"&gt;Amazon Bedrock&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/security-hub/" rel="noopener noreferrer"&gt;AWS Security Hub&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;What do you think?&lt;/strong&gt; Should AI-powered security agents eventually be allowed to deploy low-risk patches automatically, or should every production change require human approval?&lt;/p&gt;

&lt;p&gt;I'd be interested to hear how your team is approaching AI-assisted vulnerability management.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cybersecurity</category>
      <category>ai</category>
      <category>devsecops</category>
    </item>
    <item>
      <title>Building a Data Fabric on AWS: Connect Data, Improve Governance, and Power AI</title>
      <dc:creator>Muhammad Umair Ashraf</dc:creator>
      <pubDate>Sat, 24 Oct 2026 02:50:54 +0000</pubDate>
      <link>https://dev.to/omayrashraf/building-a-data-fabric-on-aws-connect-data-improve-governance-and-power-ai-3l00</link>
      <guid>https://dev.to/omayrashraf/building-a-data-fabric-on-aws-connect-data-improve-governance-and-power-ai-3l00</guid>
      <description>&lt;p&gt;Modern organizations store data across databases, applications, data lakes, and streaming platforms. The challenge is making all that data discoverable, secure, and useful without building a completely separate integration solution for every team.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1o6rkn50z7vo3jznnpid.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1o6rkn50z7vo3jznnpid.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Fabric on AWS&lt;/strong&gt; offers an architectural approach to connecting data sources, managing metadata, enforcing governance, and enabling analytics and AI applications.&lt;/p&gt;

&lt;p&gt;In this tutorial, we'll explore an AWS data fabric architecture and build a small customer analytics project using Amazon S3, AWS Glue, and Amazon Athena.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Data Fabric?
&lt;/h2&gt;

&lt;p&gt;A data fabric is an architecture that connects data discovery, integration, metadata management, and governance across distributed systems.&lt;/p&gt;

&lt;p&gt;On AWS, you can use services such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Amazon S3:&lt;/strong&gt; Store raw and curated datasets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Glue:&lt;/strong&gt; Discover, catalog, and transform data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Glue Data Catalog:&lt;/strong&gt; Maintain metadata and table definitions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Lake Formation:&lt;/strong&gt; Manage permissions for supported data lake resources.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon Athena:&lt;/strong&gt; Query data in S3 using SQL.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon Redshift:&lt;/strong&gt; Support data warehousing and analytical workloads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon DataZone:&lt;/strong&gt; Help teams discover, share, and govern data assets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon Bedrock:&lt;/strong&gt; Build generative AI applications that use approved business information through controlled retrieval and data-access layers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These services are building blocks. A data fabric is an architecture you design and configure, not a single AWS service that automatically connects everything.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Does It Matter?
&lt;/h2&gt;

&lt;p&gt;Imagine an e-commerce company with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Customer records in Amazon RDS.&lt;/li&gt;
&lt;li&gt;Order history in S3 files.&lt;/li&gt;
&lt;li&gt;Website events arriving through streaming services.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without a coordinated approach, different teams may duplicate datasets, define metrics differently, and manage permissions inconsistently.&lt;/p&gt;

&lt;p&gt;A data fabric can help teams improve data discovery, reduce repeated integration work, and establish more consistent governance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reference Architecture
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;       DATA SOURCES
  ┌────────┬─────────┬───────────┐
  │ RDS    │ S3 Files│ Event Data│
  └────┬───┴────┬────┴─────┬─────┘
       └────────┼──────────┘
                ▼
         DATA INGESTION
        AWS Glue / Streams
                │
                ▼
           AMAZON S3
       Raw → Clean → Curated
                │
        ┌───────┴────────┐
        ▼                ▼
   Glue Catalog     Lake Formation
        │                │
        └───────┬────────┘
                ▼
          QUERY LAYER
        Athena / Redshift
                │
                ▼
       Analytics / Reports / AI
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a conceptual design. Each source needs an appropriate ingestion process, and access policies must be configured for the services involved.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hands-On Project: Customer Order Analytics
&lt;/h2&gt;

&lt;p&gt;Let's create a simple data pipeline and query customer orders using SQL.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Create a sample CSV file
&lt;/h3&gt;

&lt;p&gt;Create &lt;code&gt;orders.csv&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;order_id,customer_id,region,amount,status
1001,C101,Asia,250,COMPLETED
1002,C102,Europe,180,COMPLETED
1003,C101,Asia,90,PENDING
1004,C103,North America,420,COMPLETED
1005,C104,Europe,120,CANCELLED
1006,C102,Europe,310,COMPLETED
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Upload it to an S3 location such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;s3://your-data-fabric-bucket/raw/orders/orders.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;your-data-fabric-bucket&lt;/code&gt; with your own bucket name. Keep public access blocked and configure appropriate encryption and permissions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Catalog the dataset with AWS Glue
&lt;/h3&gt;

&lt;p&gt;Open the AWS Glue console and:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a database named &lt;code&gt;customer_analytics&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Create a crawler that points to your S3 &lt;code&gt;raw/orders/&lt;/code&gt; prefix.&lt;/li&gt;
&lt;li&gt;Configure an IAM role with the required S3 read and Data Catalog permissions.&lt;/li&gt;
&lt;li&gt;Run the crawler.&lt;/li&gt;
&lt;li&gt;Review the table schema and confirm the column types.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The crawler can discover the CSV structure and register a table in the Glue Data Catalog. Always verify inferred types before relying on them in production.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Query the data with Athena
&lt;/h3&gt;

&lt;p&gt;Open Amazon Athena and configure an S3 query-results location. Then execute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="n"&gt;region&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;completed_orders&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;total_revenue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;average_order_value&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;customer_analytics&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;orders&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'COMPLETED'&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;region&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;total_revenue&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expected output:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Region&lt;/th&gt;
&lt;th&gt;Completed orders&lt;/th&gt;
&lt;th&gt;Total revenue&lt;/th&gt;
&lt;th&gt;Average order value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Europe&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;490&lt;/td&gt;
&lt;td&gt;245&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;North America&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;420&lt;/td&gt;
&lt;td&gt;420&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Asia&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;250&lt;/td&gt;
&lt;td&gt;250&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The query filters out pending and cancelled orders and calculates revenue by region.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; Your actual database and table names depend on your Glue configuration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Add Governance
&lt;/h2&gt;

&lt;p&gt;A useful data platform must control access as well as provide discovery.&lt;/p&gt;

&lt;p&gt;For this project:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Give analysts access only to the datasets they need.&lt;/li&gt;
&lt;li&gt;Separate engineering and administrative permissions.&lt;/li&gt;
&lt;li&gt;Configure Lake Formation permissions where applicable.&lt;/li&gt;
&lt;li&gt;Protect sensitive customer information.&lt;/li&gt;
&lt;li&gt;Review access logs and test permissions using a restricted analyst identity.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A catalog entry does not automatically grant permission to query the underlying data. Configure the required catalog, storage, query, IAM, and Lake Formation permissions consistently.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Extend the Architecture
&lt;/h2&gt;

&lt;p&gt;Once the basic project works, you can improve it by adding:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS Glue ETL jobs&lt;/strong&gt; to validate and transform records.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parquet datasets&lt;/strong&gt; to improve query efficiency for suitable workloads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon Redshift&lt;/strong&gt; for more demanding warehouse analytics.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon DataZone&lt;/strong&gt; to improve discovery and sharing across teams.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon Bedrock&lt;/strong&gt; for an AI assistant that answers business questions using approved data through a controlled retrieval or query layer.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For AI applications, validate generated queries and enforce permissions in the data-access layer. Do not give an AI model unrestricted access to every dataset.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Fabric vs. Data Lake vs. Data Mesh
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Concept&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Data lake&lt;/td&gt;
&lt;td&gt;Stores large amounts of data in formats such as CSV, JSON, and Parquet.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data fabric&lt;/td&gt;
&lt;td&gt;Connects data discovery, integration, metadata, and governance.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data mesh&lt;/td&gt;
&lt;td&gt;Organizes data ownership around business domains and data products.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These approaches can complement each other. Amazon S3 can provide the storage foundation, a data fabric architecture can connect and govern datasets, and a data mesh operating model can define domain ownership.&lt;/p&gt;

&lt;h2&gt;
  
  
  Production Best Practices
&lt;/h2&gt;

&lt;p&gt;Before scaling your implementation:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Improve metadata quality:&lt;/strong&gt; Document schemas, owners, and dataset descriptions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enforce least privilege:&lt;/strong&gt; Keep administrative, engineering, and analyst permissions separate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Validate data:&lt;/strong&gt; Check missing values, duplicates, and schema changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitor pipelines:&lt;/strong&gt; Track failures, processing time, and data freshness.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optimize costs:&lt;/strong&gt; Use appropriate partitioning and file formats to reduce unnecessary Athena scans.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Document lineage:&lt;/strong&gt; Record where data originates and how it changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Secure AI access:&lt;/strong&gt; Use controlled tools, authorization, and query validation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Start small:&lt;/strong&gt; Prove value with one business use case before connecting every source.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Data Fabric on AWS is not about moving all your data into one database. It is about making distributed data easier to discover, integrate, govern, and use.&lt;/p&gt;

&lt;p&gt;With Amazon S3, AWS Glue, the Glue Data Catalog, Lake Formation, and Athena, you can build a foundation for reliable analytics and future AI applications.&lt;/p&gt;

&lt;p&gt;Start with one dataset, catalog it, secure it, and demonstrate a useful business query. Then expand as your organization's needs grow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The goal is simple: make the right data available to the right people and applications, securely.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Official AWS Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/what-is/data-fabric/" rel="noopener noreferrer"&gt;What Is Data Fabric?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/glue/" rel="noopener noreferrer"&gt;AWS Glue&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/lake-formation/" rel="noopener noreferrer"&gt;AWS Lake Formation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/s3/" rel="noopener noreferrer"&gt;Amazon S3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/athena/" rel="noopener noreferrer"&gt;Amazon Athena&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/datazone/" rel="noopener noreferrer"&gt;Amazon DataZone&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>dataengineering</category>
      <category>cloud</category>
      <category>analytics</category>
    </item>
    <item>
      <title>AWS Agentic AI Services: Build an Intelligent Architecture Workflow on AWS</title>
      <dc:creator>Muhammad Umair Ashraf</dc:creator>
      <pubDate>Fri, 23 Oct 2026 03:55:17 +0000</pubDate>
      <link>https://dev.to/omayrashraf/aws-agentic-ai-services-build-an-intelligent-architecture-workflow-on-aws-3lfo</link>
      <guid>https://dev.to/omayrashraf/aws-agentic-ai-services-build-an-intelligent-architecture-workflow-on-aws-3lfo</guid>
      <description>&lt;p&gt;What if you could describe an application in plain English and have an AI-powered workflow help you design its AWS architecture, review security requirements, identify cost drivers, and prepare infrastructure code?&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4u2u6wwb20cgq977xec2.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4u2u6wwb20cgq977xec2.jpg" alt=" " width="800" height="537"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That is the idea behind &lt;strong&gt;agentic AI&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A traditional AI chatbot can recommend AWS services and explain how they work. An agentic workflow can go further by coordinating tasks, using approved tools, checking intermediate results, and revising its recommendations when problems are found.&lt;/p&gt;

&lt;p&gt;In this article, we'll explore how to build an AWS Architecture Copilot using Amazon Bedrock, Bedrock AgentCore, Strands Agents, AWS Lambda, and other AWS services.&lt;/p&gt;

&lt;p&gt;We'll also create a small Python validation example and discuss how to keep the workflow secure.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. What Makes Agentic AI Different?
&lt;/h2&gt;

&lt;p&gt;Consider this request:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Design a secure and cost-effective AWS architecture for an online store with a web frontend, product API, relational database, and product-image storage.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A basic chatbot might suggest Amazon S3, Amazon RDS, and compute services.&lt;/p&gt;

&lt;p&gt;An agentic workflow could coordinate several additional steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Analyze the application requirements.&lt;/li&gt;
&lt;li&gt;Retrieve relevant architecture standards.&lt;/li&gt;
&lt;li&gt;Propose an AWS architecture.&lt;/li&gt;
&lt;li&gt;Review the design against security requirements.&lt;/li&gt;
&lt;li&gt;Identify missing information for cost estimation.&lt;/li&gt;
&lt;li&gt;Generate an infrastructure-as-code proposal.&lt;/li&gt;
&lt;li&gt;Request approval before deployment.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The important difference is not simply using a more advanced model. It is coordinating &lt;strong&gt;reasoning, tool use, validation, and controlled actions&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;These capabilities must be implemented in the application; they are not automatically provided as one complete workflow by a single AWS service.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. AWS Services for an Agentic Workflow
&lt;/h2&gt;

&lt;p&gt;Here are the main building blocks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Amazon Bedrock
&lt;/h3&gt;

&lt;p&gt;Amazon Bedrock provides access to foundation models for generative AI applications. A model can interpret requirements, generate structured recommendations, summarize technical documentation, and help an agent choose among its available tools.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Amazon Bedrock AgentCore
&lt;/h3&gt;

&lt;p&gt;AgentCore provides modular capabilities for deploying, connecting, securing, and monitoring agents.&lt;/p&gt;

&lt;p&gt;Depending on your architecture, you may use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Runtime&lt;/strong&gt; to run agents.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gateway&lt;/strong&gt; to connect agents to approved tools and APIs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory&lt;/strong&gt; to retain relevant context.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Identity and Policy&lt;/strong&gt; capabilities to support controlled access and actions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Observability and Evaluations&lt;/strong&gt; to inspect and assess agent behavior.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can use the capabilities that fit your application instead of adopting every component at once.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Strands Agents
&lt;/h3&gt;

&lt;p&gt;Strands Agents is an open-source SDK for building AI agents. It helps developers define agent behavior and connect models to tools.&lt;/p&gt;

&lt;p&gt;It can be used to implement an architecture planner, a security reviewer, or a coordinator for a multi-step workflow.&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/strands-agents" rel="noopener noreferrer"&gt;https://github.com/strands-agents&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Other AWS Services
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;Role in the workflow&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Amazon S3&lt;/td&gt;
&lt;td&gt;Store architecture documents and generated artifacts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Amazon Bedrock Knowledge Bases&lt;/td&gt;
&lt;td&gt;Retrieve relevant approved technical information&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AWS Lambda&lt;/td&gt;
&lt;td&gt;Run bounded validation and helper functions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AWS Step Functions&lt;/td&gt;
&lt;td&gt;Coordinate predictable steps, retries, and approvals&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AWS IAM&lt;/td&gt;
&lt;td&gt;Apply least-privilege access&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Amazon CloudWatch&lt;/td&gt;
&lt;td&gt;Collect logs, metrics, and alarms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AWS CloudFormation or AWS CDK&lt;/td&gt;
&lt;td&gt;Define infrastructure as code&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A useful design principle is to use agents for flexible analysis and conventional software for deterministic rules and controlled execution.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Reference Architecture
&lt;/h2&gt;

&lt;p&gt;The following is a proposed architecture for an AI Architecture Copilot.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Developer
   |
   v
Web Application / API
   |
   v
Workflow Coordinator
   |
   v
AgentCore Runtime + Strands Agents
   |
   +------------------+------------------+
   |                  |                  |
   v                  v                  v
Architecture       Security             Cost
Planner            Reviewer             Analyst
   |                  |                  |
   +------------------+------------------+
                      |
                      v
             Schema and Rule Checks
                      |
             +--------+--------+
             |                 |
             v                 v
        Needs Changes      Ready for Review
             |                 |
             v                 v
         Revise Plan       Human Approval
                               |
                               v
                     Controlled Deployment
                               |
                               v
                         AWS Resources
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The application can use Amazon Bedrock for model access, AgentCore for agent operations, S3 and Knowledge Bases for reference information, Lambda for validation, and Step Functions for workflow coordination.&lt;/p&gt;

&lt;p&gt;The deployment stage can use CloudFormation or CDK through a controlled pipeline.&lt;/p&gt;

&lt;p&gt;This is a reference design, not a deployed solution. The integrations and permissions must be implemented and tested.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Design the Agent Roles
&lt;/h2&gt;

&lt;p&gt;You do not necessarily need four separate agents. These roles can be implemented as independent agents or as stages within one agentic application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Architecture Planner
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Extracts requirements.&lt;/li&gt;
&lt;li&gt;Recommends AWS services.&lt;/li&gt;
&lt;li&gt;Identifies dependencies.&lt;/li&gt;
&lt;li&gt;Produces a structured architecture specification.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Security Reviewer
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Reviews network and identity assumptions.&lt;/li&gt;
&lt;li&gt;Checks whether data-protection requirements are addressed.&lt;/li&gt;
&lt;li&gt;Identifies missing evidence.&lt;/li&gt;
&lt;li&gt;Returns findings and remediation recommendations.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Cost Analyst
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Identifies compute, storage, database, and data-transfer cost drivers.&lt;/li&gt;
&lt;li&gt;Requests missing workload assumptions.&lt;/li&gt;
&lt;li&gt;Uses verified pricing data where available.&lt;/li&gt;
&lt;li&gt;Clearly labels estimates and unknowns.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Infrastructure Planner
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Prepares CloudFormation or CDK artifacts.&lt;/li&gt;
&lt;li&gt;Validates generated files.&lt;/li&gt;
&lt;li&gt;Summarizes proposed infrastructure changes.&lt;/li&gt;
&lt;li&gt;Waits for approval before deployment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The benefit is separation of responsibility. A security reviewer should independently examine the architecture instead of simply repeating the planner's recommendations.&lt;/p&gt;

&lt;p&gt;Multiple agents do not automatically mean better results, so test their outputs and measure their performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Mini Project: Validate Architecture Requirements with Python
&lt;/h2&gt;

&lt;p&gt;Before sending a request to an AI agent, validate the input. Missing or inconsistent requirements can lead to poor recommendations.&lt;/p&gt;

&lt;p&gt;Create a file named &lt;code&gt;requirements.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"application"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"online-store"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"region"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"us-east-1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"frontend"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"web"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"api"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"relational_database"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"product_image_storage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"requirements"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"private_database"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"monitoring"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"human_approval_before_deployment"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now create &lt;code&gt;validate_requirements.py&lt;/code&gt;:&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="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;

&lt;span class="n"&gt;REQUIRED_FIELDS&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;application&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;region&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;frontend&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;api&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;relational_database&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;product_image_storage&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;requirements&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;def&lt;/span&gt; &lt;span class="nf"&gt;validate_requirements&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;encoding&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;utf-8&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;missing&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;REQUIRED_FIELDS&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;missing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&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;Missing fields: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;, &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;missing&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="n"&gt;requirements&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;requirements&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="ow"&gt;not&lt;/span&gt; &lt;span class="nf"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;requirements&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"'&lt;/span&gt;&lt;span class="s"&gt;requirements&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; must be an object.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;required_controls&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;private_database&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;monitoring&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;human_approval_before_deployment&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="n"&gt;missing_controls&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;required_controls&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;requirements&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;missing_controls&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Missing controls: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
            &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;, &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;missing_controls&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="n"&gt;requirements&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;human_approval_before_deployment&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&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;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Human approval must be enabled before deployment.&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;PASS: Required input fields are present.&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;PASS: Human approval is enabled.&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Next: Generate and review the architecture proposal.&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="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;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;filename&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;requirements.json&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;validate_requirements&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;except &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nb"&gt;OSError&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;JSONDecodeError&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nb"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;error&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;FAIL: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;error&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="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python validate_requirements.py requirements.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expected output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PASS: Required input fields are present.
PASS: Human approval is enabled.
Next: Generate and review the architecture proposal.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example validates input fields and the approval setting. It does not verify that the proposed architecture is secure, correctly configured, or deployable.&lt;/p&gt;

&lt;p&gt;For production, add JSON Schema validation, type checks, allowed-value checks, and tests for malformed input.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Give the Architecture Agent a Defined Task
&lt;/h2&gt;

&lt;p&gt;Once the input is validated, an agent can analyze the requirements and produce a structured proposal.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You are the Architecture Planner for an AWS Architecture Copilot.

Analyze the supplied requirements and approved architecture references.

Return a structured proposal containing:
1. Recommended AWS services
2. Purpose of each service
3. Network and data-flow relationships
4. Security assumptions
5. Availability and scaling considerations
6. Missing requirements
7. Validation checks

Rules:
- Do not invent requirements.
- Mark assumptions and unknowns explicitly.
- Use approved architecture references when available.
- Do not claim checks passed without evidence.
- Do not deploy or modify AWS infrastructure.
- Return machine-readable JSON.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your application should validate the returned JSON before passing it to the security-review stage.&lt;/p&gt;

&lt;p&gt;The Security Reviewer can then return a status such as &lt;code&gt;PASS&lt;/code&gt;, &lt;code&gt;FAIL&lt;/code&gt;, or &lt;code&gt;UNKNOWN&lt;/code&gt;, along with findings and supporting evidence.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Never treat &lt;code&gt;UNKNOWN&lt;/code&gt; as &lt;code&gt;PASS&lt;/code&gt;.&lt;/strong&gt; If important information is missing, stop and request clarification.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Cost Analysis and Infrastructure Generation
&lt;/h2&gt;

&lt;p&gt;After the architecture passes its required checks, the workflow can prepare cost and infrastructure artifacts.&lt;/p&gt;

&lt;p&gt;The Cost Analyst should identify inputs such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS Region.&lt;/li&gt;
&lt;li&gt;Expected request volume.&lt;/li&gt;
&lt;li&gt;Compute requirements.&lt;/li&gt;
&lt;li&gt;Database size and availability.&lt;/li&gt;
&lt;li&gt;Storage consumption.&lt;/li&gt;
&lt;li&gt;Data transfer.&lt;/li&gt;
&lt;li&gt;Logging and monitoring usage.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use verified AWS pricing data and document the assumptions behind the estimate. A model-generated number alone is not a verified price.&lt;/p&gt;

&lt;p&gt;The Infrastructure Planner can then prepare a CloudFormation template or CDK application. Validate the generated artifacts and review the proposed changes before allowing a deployment pipeline to execute them.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Security Controls for Production
&lt;/h2&gt;

&lt;p&gt;Giving an AI agent access to cloud tools introduces risks. Build the controls into the architecture from the beginning.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Least privilege:&lt;/strong&gt; Give each component only the permissions it requires.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Approved tools:&lt;/strong&gt; Expose narrowly scoped operations instead of unrestricted AWS access.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Human approval:&lt;/strong&gt; Require explicit authorization for impactful changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Input and output validation:&lt;/strong&gt; Reject malformed or incomplete data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Secrets management:&lt;/strong&gt; Never place credentials in prompts or generated source files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auditability:&lt;/strong&gt; Record tool calls, validation results, approvals, and deployment outcomes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bounded execution:&lt;/strong&gt; Apply timeouts, retry limits, and resource limits.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Evaluation:&lt;/strong&gt; Test for incorrect recommendations, prompt injection, and unsafe tool use.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rollback planning:&lt;/strong&gt; Define a recovery path for unsuccessful deployments.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Amazon Bedrock Guardrails can provide additional safeguards for supported model interactions. They do not replace IAM, application authorization, infrastructure validation, or security testing.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. When Should You Use Agentic AI?
&lt;/h2&gt;

&lt;p&gt;Agentic workflows are useful when tasks involve multiple steps, changing context, tool usage, and decisions that may need revision.&lt;/p&gt;

&lt;p&gt;Potential use cases include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS architecture recommendation.&lt;/li&gt;
&lt;li&gt;Cloud migration planning.&lt;/li&gt;
&lt;li&gt;Infrastructure troubleshooting.&lt;/li&gt;
&lt;li&gt;Cost-optimization analysis.&lt;/li&gt;
&lt;li&gt;Documentation and compliance preparation.&lt;/li&gt;
&lt;li&gt;Developer workflow automation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, a simple deterministic task may be better handled by a Lambda function or conventional workflow. Agents introduce additional latency, cost, complexity, and evaluation requirements.&lt;/p&gt;

&lt;p&gt;A strong production architecture combines flexible AI reasoning with deterministic controls.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Agentic AI can help developers move beyond one-off AI responses toward workflows that coordinate architecture design, security review, cost analysis, and infrastructure preparation.&lt;/p&gt;

&lt;p&gt;Using Amazon Bedrock, Bedrock AgentCore, Strands Agents, AWS Lambda, Step Functions, Amazon S3, IAM, and controlled deployment pipelines, teams can build an Architecture Copilot that turns natural-language requirements into a reviewable technical proposal.&lt;/p&gt;

&lt;p&gt;Start small, validate every important output, and measure the quality of the results before expanding the workflow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The goal isn't to give AI unrestricted access to AWS. It's to let AI handle more of the analysis while engineers stay in control of critical decisions.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Official AWS Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/bedrock/" rel="noopener noreferrer"&gt;Amazon Bedrock&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/bedrock-agentcore/" rel="noopener noreferrer"&gt;Amazon Bedrock AgentCore&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/strands-agents" rel="noopener noreferrer"&gt;Strands Agents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base.html" rel="noopener noreferrer"&gt;Amazon Bedrock Knowledge Bases&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/lambda/" rel="noopener noreferrer"&gt;AWS Lambda&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/step-functions/" rel="noopener noreferrer"&gt;AWS Step Functions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html" rel="noopener noreferrer"&gt;Amazon Bedrock Guardrails&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>ai</category>
      <category>cloud</category>
      <category>productivity</category>
    </item>
    <item>
      <title>AWS AI Agent Migration Planning: Build a Smarter Cloud Migration Roadmap with AWS Transform</title>
      <dc:creator>Muhammad Umair Ashraf</dc:creator>
      <pubDate>Thu, 22 Oct 2026 06:09:30 +0000</pubDate>
      <link>https://dev.to/omayrashraf/aws-ai-agent-migration-planning-build-a-smarter-cloud-migration-roadmap-with-aws-transform-6lk</link>
      <guid>https://dev.to/omayrashraf/aws-ai-agent-migration-planning-build-a-smarter-cloud-migration-roadmap-with-aws-transform-6lk</guid>
      <description>&lt;p&gt;Cloud migration is not just about moving servers from one environment to another. The real challenge is understanding application dependencies, choosing the right migration strategy, grouping workloads, and planning migration waves without disrupting business operations.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2ml20llhrpegktwigcqi.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2ml20llhrpegktwigcqi.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is where AI-assisted migration planning can help.&lt;/p&gt;

&lt;p&gt;In this article, we’ll explore how &lt;strong&gt;AWS Transform&lt;/strong&gt; can support migration planning, how to validate infrastructure inventory with Python, and how to use an AI agent to create a structured migration roadmap while keeping engineers in control of critical decisions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Does Cloud Migration Planning Need Improvement?
&lt;/h2&gt;

&lt;p&gt;Many teams still plan migrations using spreadsheets, manual dependency analysis, and disconnected documentation.&lt;/p&gt;

&lt;p&gt;This can lead to several problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Application dependencies are missed.&lt;/li&gt;
&lt;li&gt;Databases and applications are scheduled in different migration waves.&lt;/li&gt;
&lt;li&gt;Teams underestimate testing and rollback requirements.&lt;/li&gt;
&lt;li&gt;Migration priorities are based on assumptions instead of evidence.&lt;/li&gt;
&lt;li&gt;Infrastructure and security requirements are discovered too late.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A better approach combines reliable inventory data, dependency analysis, AI-assisted recommendations, and human approval.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is AWS Transform?
&lt;/h2&gt;

&lt;p&gt;AWS Transform is an AI-powered service designed to help organizations accelerate IT transformation, including cloud migration and modernization.&lt;/p&gt;

&lt;p&gt;For migration planning, AWS Transform can help teams work through activities such as:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Scope and analyze:&lt;/strong&gt; Review the migration scope and available discovery information.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Group applications:&lt;/strong&gt; Identify workloads that belong together based on dependencies and business context.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create move groups:&lt;/strong&gt; Organize related infrastructure into manageable migration units.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build migration waves:&lt;/strong&gt; Arrange workloads into a sequence that supports migration execution.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The exact capabilities available depend on the transformation workflow and the data provided.&lt;/p&gt;

&lt;p&gt;The important point is that AI can help accelerate planning, but the resulting recommendations still need technical validation.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Practical AI-Assisted Migration Workflow
&lt;/h2&gt;

&lt;p&gt;A useful migration-planning workflow can be organized into five steps.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Collect the infrastructure inventory
&lt;/h3&gt;

&lt;p&gt;Start by collecting information about servers, applications, databases, and their dependencies.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Workload&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Depends On&lt;/th&gt;
&lt;th&gt;Priority&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;portal-app&lt;/td&gt;
&lt;td&gt;Application&lt;/td&gt;
&lt;td&gt;portal-db&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;portal-db&lt;/td&gt;
&lt;td&gt;Database&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;reporting-app&lt;/td&gt;
&lt;td&gt;Application&lt;/td&gt;
&lt;td&gt;reporting-db&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;reporting-db&lt;/td&gt;
&lt;td&gt;Database&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This is synthetic example data for demonstration, not an actual AWS discovery report.&lt;/p&gt;

&lt;p&gt;In a real project, inventory data might come from existing configuration management systems, discovery tools, application owners, or AWS migration assessment workflows.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Validate the inventory before using AI
&lt;/h3&gt;

&lt;p&gt;AI recommendations are only as reliable as the information supplied to them. First, validate the inventory for missing fields, duplicate workload IDs, invalid resource values, and dependencies that reference nonexistent workloads.&lt;/p&gt;

&lt;p&gt;Create a file named &lt;code&gt;inventory.csv&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;workload_id,name,type,depends_on,cpu,ram_gb,priority
1,portal-app,application,portal-db,2,4,high
2,portal-db,database,,4,16,high
3,reporting-app,application,reporting-db,2,8,medium
4,reporting-db,database,,4,16,medium
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now create &lt;code&gt;validate_inventory.py&lt;/code&gt;:&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="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;csv&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;

&lt;span class="n"&gt;REQUIRED_FIELDS&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;workload_id&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;name&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;type&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;depends_on&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;cpu&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;ram_gb&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;priority&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;def&lt;/span&gt; &lt;span class="nf"&gt;validate_inventory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;errors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
    &lt;span class="n"&gt;workloads&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;newline&lt;/span&gt;&lt;span class="o"&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;encoding&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;utf-8&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;reader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;csv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DictReader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;reader&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fieldnames&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;CSV file is empty or has no header.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

        &lt;span class="n"&gt;missing&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;REQUIRED_FIELDS&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;reader&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fieldnames&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;missing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&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;Missing required columns: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;, &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;missing&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="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;line_number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;enumerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;reader&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;strip&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;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&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="nf"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;field&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;field&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;workload_id&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;name&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;type&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;priority&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
            &lt;span class="p"&gt;)):&lt;/span&gt;
                &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&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;Line &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;line_number&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;: required value is missing.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
                &lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;continue&lt;/span&gt;

            &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;cpu&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cpu&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
                &lt;span class="n"&gt;ram_gb&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ram_gb&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="n"&gt;cpu&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;ram_gb&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nb"&gt;ValueError&lt;/span&gt;
            &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&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;Line &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;line_number&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;: CPU and RAM must be positive numbers.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
                &lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;continue&lt;/span&gt;

            &lt;span class="n"&gt;workloads&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;ids&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;workload_id&lt;/span&gt;&lt;span class="sh"&gt;"&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;row&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;workloads&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;names&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&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;row&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;workloads&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ids&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ids&lt;/span&gt;&lt;span class="p"&gt;)):&lt;/span&gt;
        &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Duplicate workload IDs found.&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="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;names&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;names&lt;/span&gt;&lt;span class="p"&gt;)):&lt;/span&gt;
        &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Duplicate workload names found.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;known_names&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;names&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;row&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;workloads&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;dependencies&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&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;item&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;depends_on&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;;&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="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;()&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;dependency&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;dependencies&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;dependency&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;known_names&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&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="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;name&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="s"&gt;: unknown dependency &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;dependency&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
                &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;


&lt;span class="k"&gt;if&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;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;filename&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;inventory.csv&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="n"&gt;validation_errors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;validate_inventory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;validation_errors&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;Inventory validation failed:&lt;/span&gt;&lt;span class="sh"&gt;"&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;error&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;validation_errors&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;- &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;error&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="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&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;Inventory validation passed.&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Ready for migration-planning review.&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;Run the script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python validate_inventory.py inventory.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expected output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Inventory validation passed.
Ready for migration-planning review.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This small validation step catches common data-quality issues before they affect migration planning. For production use, add schema validation, dependency-cycle detection, and tests for malformed input.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Ask an AI agent to propose migration waves
&lt;/h3&gt;

&lt;p&gt;After validating the inventory, provide the data to your approved AI-assisted planning workflow.&lt;/p&gt;

&lt;p&gt;For example, use this prompt with an appropriate AI assistant or agent:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You are assisting a cloud migration planning team.

Analyze the supplied infrastructure inventory.

Your tasks:
1. Identify application and database dependencies.
2. Propose logical migration groups.
3. Recommend a sequence of migration waves.
4. Explain the reasoning behind each recommendation.
5. Identify missing information and migration risks.
6. Suggest testing and rollback checkpoints.

Rules:
- Do not invent dependencies or infrastructure details.
- Clearly label assumptions and unknown information.
- Do not execute AWS changes.
- Do not approve production migration decisions.
- Flag workloads requiring additional discovery.
- Keep dependent workloads together when appropriate,
  or explain how their dependency will be maintained.

Return a table containing:
Workload, Proposed Wave, Dependencies, Risks,
Validation Required, and Reasoning.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For AWS-specific migration planning, use the relevant AWS Transform workflow and its supported inputs rather than assuming that a generic AI assistant has access to your AWS inventory.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Review an illustrative migration plan
&lt;/h3&gt;

&lt;p&gt;For the sample inventory, an initial plan might look like this:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Wave&lt;/th&gt;
&lt;th&gt;Workloads&lt;/th&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Wave 1&lt;/td&gt;
&lt;td&gt;reporting-db, reporting-app&lt;/td&gt;
&lt;td&gt;Lower-priority example workload for validating the migration process&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wave 2&lt;/td&gt;
&lt;td&gt;portal-db, portal-app&lt;/td&gt;
&lt;td&gt;Higher-priority application group requiring careful testing&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These waves are illustrative, not an AWS Transform-generated result. A real plan must consider application criticality, dependency evidence, compatibility, downtime tolerance, network connectivity, data replication, and business approval.&lt;/p&gt;

&lt;p&gt;Before approving a wave, confirm:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Application and database dependencies are understood.&lt;/li&gt;
&lt;li&gt;The target architecture is validated.&lt;/li&gt;
&lt;li&gt;Data migration and consistency checks are defined.&lt;/li&gt;
&lt;li&gt;Security controls and connectivity are tested.&lt;/li&gt;
&lt;li&gt;Rollback procedures are documented.&lt;/li&gt;
&lt;li&gt;Business owners have approved the migration window.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 5: Track the results
&lt;/h3&gt;

&lt;p&gt;Once planning and pilot migrations begin, measure whether the approach is actually helping.&lt;/p&gt;

&lt;p&gt;Useful metrics include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Time required to create a migration plan.&lt;/li&gt;
&lt;li&gt;Number of dependency issues discovered before migration.&lt;/li&gt;
&lt;li&gt;Percentage of workloads with validated owners and inventory data.&lt;/li&gt;
&lt;li&gt;Migration success and rollback rates.&lt;/li&gt;
&lt;li&gt;Unplanned downtime.&lt;/li&gt;
&lt;li&gt;Estimated versus actual migration costs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AI-generated plans should be evaluated against engineering-reviewed plans and actual migration outcomes, not just the speed at which the recommendations are produced.&lt;/p&gt;

&lt;h2&gt;
  
  
  Security and Governance Considerations
&lt;/h2&gt;

&lt;p&gt;Migration planning often involves sensitive infrastructure details. Treat inventory files and AI prompts as potentially sensitive data.&lt;/p&gt;

&lt;p&gt;Follow these practices:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use approved services and access controls.&lt;/li&gt;
&lt;li&gt;Apply least-privilege permissions.&lt;/li&gt;
&lt;li&gt;Avoid including credentials, secrets, or unnecessary personal data.&lt;/li&gt;
&lt;li&gt;Keep a record of recommendations and human approvals.&lt;/li&gt;
&lt;li&gt;Require explicit authorization before production changes.&lt;/li&gt;
&lt;li&gt;Verify cost estimates against current AWS pricing and the intended Region.&lt;/li&gt;
&lt;li&gt;Test migrations in controlled environments before expanding the rollout.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;A useful rule: let AI assist with analysis and recommendations, while accountable engineers retain control over production decisions.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;AI-assisted migration planning can help teams turn fragmented infrastructure information into a more structured migration roadmap. AWS Transform provides migration-focused capabilities that can support this process, while inventory validation and human review help improve the quality of the resulting plan.&lt;/p&gt;

&lt;p&gt;Start with a small, well-understood application group. Validate the inventory, review the proposed dependencies and waves, and measure the results before scaling the approach across a larger portfolio.&lt;/p&gt;

&lt;p&gt;The goal is not simply to migrate faster. It is to make migration decisions more traceable, better informed, and safer to execute.&lt;/p&gt;

&lt;h2&gt;
  
  
  Official AWS Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/transform/latest/userguide/" rel="noopener noreferrer"&gt;AWS Transform documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/transform/latest/userguide/transform-vmware-review-groupings-and-waves.html" rel="noopener noreferrer"&gt;AWS Transform migration planning: reviewing groupings and waves&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/application-discovery/latest/userguide/what-is-appdiscovery.html" rel="noopener noreferrer"&gt;AWS Application Discovery Service&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/prescriptive-guidance/latest/application-portfolio-assessment-guide/wave-planning.html" rel="noopener noreferrer"&gt;AWS Prescriptive Guidance: Wave planning&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>ai</category>
      <category>cloud</category>
      <category>devops</category>
    </item>
    <item>
      <title>AWS PyTorch: Build, Train, and Deploy Deep Learning Models in the Cloud</title>
      <dc:creator>Muhammad Umair Ashraf</dc:creator>
      <pubDate>Wed, 21 Oct 2026 02:34:59 +0000</pubDate>
      <link>https://dev.to/omayrashraf/aws-pytorch-build-train-and-deploy-deep-learning-models-in-the-cloud-40i5</link>
      <guid>https://dev.to/omayrashraf/aws-pytorch-build-train-and-deploy-deep-learning-models-in-the-cloud-40i5</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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9a10049ya4tnau7sep6t.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9a10049ya4tnau7sep6t.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;PyTorch makes it easier to experiment with neural networks, computer vision, natural language processing, and deep learning.&lt;/p&gt;

&lt;p&gt;But building a model is only one part of a machine learning project.&lt;/p&gt;

&lt;p&gt;When it's time to move from experimentation to production, you need reliable compute, data storage, repeatable training, model artifacts, deployment, monitoring, and cost controls.&lt;/p&gt;

&lt;p&gt;This is where AWS can help.&lt;/p&gt;

&lt;p&gt;By combining &lt;strong&gt;PyTorch, Amazon SageMaker AI, Amazon S3, and Amazon CloudWatch&lt;/strong&gt;, developers can build machine learning workflows that move from local experiments toward scalable cloud deployments.&lt;/p&gt;

&lt;p&gt;In this article, we'll build a simple image classifier and explore how to extend the project into an AWS-based machine learning pipeline.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. What Is PyTorch on AWS?
&lt;/h2&gt;

&lt;p&gt;PyTorch is an open-source deep learning framework that provides tensor operations, automatic differentiation, GPU acceleration, and tools for creating neural networks.&lt;/p&gt;

&lt;p&gt;AWS provides several services that can support PyTorch workloads:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Amazon SageMaker AI:&lt;/strong&gt; Run managed training jobs and deploy machine learning models.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon S3:&lt;/strong&gt; Store datasets, model artifacts, and training outputs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon EC2:&lt;/strong&gt; Run PyTorch on virtual machines, including suitable GPU instances.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Deep Learning Containers:&lt;/strong&gt; Use supported, preconfigured machine learning environments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon CloudWatch:&lt;/strong&gt; Monitor supported metrics, logs, and application behavior.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS IAM:&lt;/strong&gt; Control access to training data, infrastructure, and model artifacts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You don't need all these services for every project. Start with what your workload requires and add complexity when it provides a clear benefit.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Understand the Architecture
&lt;/h2&gt;

&lt;p&gt;A typical workflow looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        Training Dataset
               |
               v
         Amazon S3
               |
               v
      Amazon SageMaker AI
          Training Job
               |
               v
         PyTorch Model
               |
               v
       Model Artifacts in S3
               |
               v
       Deployment / Inference
               |
               v
       Application Predictions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Amazon S3 provides durable storage for datasets and artifacts. SageMaker AI can run managed training jobs, while a suitable inference service can expose the trained model to applications.&lt;/p&gt;

&lt;p&gt;CloudWatch and related AWS monitoring capabilities help you investigate failures, latency, and resource usage.&lt;/p&gt;

&lt;p&gt;For small experiments, you can train locally first. For larger workloads, managed training can reduce infrastructure-management overhead.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Hands-On Project: Build a Digit Classifier
&lt;/h2&gt;

&lt;p&gt;We'll train a small neural network on the MNIST handwritten-digit dataset.&lt;/p&gt;

&lt;p&gt;Our model will learn to classify grayscale images into one of ten categories, representing the digits from 0 to 9.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;You'll need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python 3.&lt;/li&gt;
&lt;li&gt;Basic Python knowledge.&lt;/li&gt;
&lt;li&gt;An internet connection to download the dataset.&lt;/li&gt;
&lt;li&gt;An AWS account only when you move to the cloud steps.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The first part runs locally and does not require AWS resources.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Create a project environment
&lt;/h3&gt;

&lt;p&gt;Create a project directory and enter it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;aws-pytorch-demo
&lt;span class="nb"&gt;cd &lt;/span&gt;aws-pytorch-demo
python &lt;span class="nt"&gt;-m&lt;/span&gt; venv .venv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Activate the virtual environment on Windows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;venv&lt;/span&gt;&lt;span class="n"&gt;\Scripts\Activate.ps1&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On Linux or macOS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;source&lt;/span&gt; .venv/bin/activate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install the dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;torch torchvision
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For GPU training, install a PyTorch build compatible with your GPU and CUDA configuration. Follow the official installation instructions: &lt;a href="https://pytorch.org/get-started/locally/" rel="noopener noreferrer"&gt;https://pytorch.org/get-started/locally/&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Create the training script
&lt;/h3&gt;

&lt;p&gt;Create &lt;code&gt;train.py&lt;/code&gt;:&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="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;nn&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;torch.utils.data&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;DataLoader&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;torchvision&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datasets&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;transforms&lt;/span&gt;

&lt;span class="n"&gt;device&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;device&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cuda&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cuda&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;is_available&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cpu&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;Training device: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;device&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="n"&gt;transform&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;transforms&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ToTensor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;train_data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datasets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;MNIST&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;data&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;train&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="n"&gt;download&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="n"&gt;transform&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;test_data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datasets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;MNIST&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;data&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;train&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;download&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="n"&gt;transform&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;train_loader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;DataLoader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;train_data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;batch_size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;64&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;shuffle&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="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;test_loader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;DataLoader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;test_data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;batch_size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;256&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;shuffle&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;DigitClassifier&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Module&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="nf"&gt;super&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;network&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Sequential&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Flatten&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
            &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Linear&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;28&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;128&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
            &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ReLU&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
            &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Linear&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;128&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;forward&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;network&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;DigitClassifier&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;criterion&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;CrossEntropyLoss&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;optimizer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;optim&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Adam&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parameters&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="n"&gt;lr&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.001&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Training loop
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;epoch&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;train&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;total_loss&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;images&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;labels&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;train_loader&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;images&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;images&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;labels&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;labels&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;optimizer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zero_grad&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

        &lt;span class="n"&gt;outputs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;model&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;images&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;loss&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;criterion&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;outputs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;labels&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;loss&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;backward&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;optimizer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;step&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

        &lt;span class="n"&gt;total_loss&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;loss&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;item&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="n"&gt;average_loss&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;total_loss&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;train_loader&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;Epoch &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;epoch&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;/3, &lt;/span&gt;&lt;span class="sh"&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;Loss: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;average_loss&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="n"&gt;f&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;# Evaluation
&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;eval&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;correct&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;

&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;no_grad&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;images&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;labels&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;test_loader&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;images&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;images&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;labels&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;labels&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;outputs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;model&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;images&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;predictions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;outputs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;argmax&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;correct&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;predictions&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;labels&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;item&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;labels&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;size&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;accuracy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;correct&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;total&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;Test accuracy: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;accuracy&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&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;# Save model parameters
&lt;/span&gt;&lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;state_dict&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;digit_classifier.pth&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="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;Saved digit_classifier.pth&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;h3&gt;
  
  
  Step 3: Train the model
&lt;/h3&gt;

&lt;p&gt;Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python train.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The script downloads MNIST, trains the neural network, evaluates it against the test dataset, and saves the learned parameters.&lt;/p&gt;

&lt;p&gt;Your output should include:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Training device: cpu
Epoch 1/3, Loss: ...
Epoch 2/3, Loss: ...
Epoch 3/3, Loss: ...
Test accuracy: ...
Saved digit_classifier.pth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The loss and accuracy values depend on the training run. If a compatible GPU is available, the script can use it automatically.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Make a prediction
&lt;/h3&gt;

&lt;p&gt;Create &lt;code&gt;predict.py&lt;/code&gt;:&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="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;nn&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;torchvision&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datasets&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;transforms&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;DigitClassifier&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Module&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="nf"&gt;super&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;network&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Sequential&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Flatten&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
            &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Linear&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;28&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;128&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
            &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ReLU&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
            &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Linear&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;128&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;forward&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;network&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="n"&gt;device&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;device&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cuda&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cuda&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;is_available&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cpu&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;DigitClassifier&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;digit_classifier.pth&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;map_location&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;weights_only&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="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load_state_dict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;eval&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;dataset&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datasets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;MNIST&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;data&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;train&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;download&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="n"&gt;transform&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;transforms&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ToTensor&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;actual_label&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dataset&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;no_grad&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;logits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;model&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;unsqueeze&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="n"&gt;predicted_label&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;logits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;argmax&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;item&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;Predicted digit: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;predicted_label&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="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;Actual digit: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;actual_label&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;Run the prediction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python predict.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Predicted digit: 7
Actual digit: 7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These values are illustrative. The actual result depends on your trained model.&lt;/p&gt;

&lt;p&gt;You now have a basic end-to-end deep learning workflow: train, evaluate, save, reload, and predict.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Move the Project to AWS
&lt;/h2&gt;

&lt;p&gt;Once the model works locally, you can move the workflow to AWS.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Create an S3 bucket
&lt;/h3&gt;

&lt;p&gt;Choose a globally unique bucket name:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws s3 mb s3://YOUR-UNIQUE-PYTORCH-BUCKET &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--region&lt;/span&gt; us-east-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace the placeholder with your actual bucket name.&lt;/p&gt;

&lt;p&gt;Upload the training script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws s3 &lt;span class="nb"&gt;cp &lt;/span&gt;train.py &lt;span class="se"&gt;\&lt;/span&gt;
  s3://YOUR-UNIQUE-PYTORCH-BUCKET/code/train.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For this example, the script downloads MNIST directly. A production pipeline should manage dataset preparation, storage, and versioning more explicitly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Run training with SageMaker AI
&lt;/h3&gt;

&lt;p&gt;Amazon SageMaker AI supports PyTorch training jobs using supported framework environments and training configurations.&lt;/p&gt;

&lt;p&gt;At a high level, you need to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Configure an execution role with appropriate permissions.&lt;/li&gt;
&lt;li&gt;Prepare your training script and dependencies.&lt;/li&gt;
&lt;li&gt;Select a supported PyTorch environment.&lt;/li&gt;
&lt;li&gt;Configure the training input and output locations.&lt;/li&gt;
&lt;li&gt;Choose an appropriate instance type.&lt;/li&gt;
&lt;li&gt;Set runtime limits and launch the job.&lt;/li&gt;
&lt;li&gt;Review the training logs and saved artifacts.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Use the current official guide for the SDK version you install:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/sagemaker/latest/dg/pytorch.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/sagemaker/latest/dg/pytorch.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SageMaker SDK interfaces evolve, so use examples matching your installed SDK version rather than mixing older estimator APIs with newer SDK workflows.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Store model artifacts in S3
&lt;/h3&gt;

&lt;p&gt;For a locally trained model, you can upload the saved parameters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws s3 &lt;span class="nb"&gt;cp &lt;/span&gt;digit_classifier.pth &lt;span class="se"&gt;\&lt;/span&gt;
  s3://YOUR-UNIQUE-PYTORCH-BUCKET/models/digit_classifier.pth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a managed training job, configure the output location so SageMaker AI saves the model artifacts automatically.&lt;/p&gt;

&lt;p&gt;Keep a record of the dataset version, source-code version, training parameters, framework version, and evaluation metrics. This makes it easier to reproduce and audit experiments.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Deploy the Model for Inference
&lt;/h2&gt;

&lt;p&gt;Training and inference are separate stages.&lt;/p&gt;

&lt;p&gt;For an application to request predictions, you need a serving interface that loads the model, validates input, executes inference, and returns a response.&lt;/p&gt;

&lt;p&gt;With Amazon SageMaker AI, you can deploy supported PyTorch models to a managed endpoint. The required model packaging and inference code depend on the selected deployment approach.&lt;/p&gt;

&lt;p&gt;A typical inference flow is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Load the approved model artifact.&lt;/li&gt;
&lt;li&gt;Convert the input into the tensor format expected by the model.&lt;/li&gt;
&lt;li&gt;Run the model in evaluation mode.&lt;/li&gt;
&lt;li&gt;Convert the output into a response your application can consume.&lt;/li&gt;
&lt;li&gt;Log relevant errors and operational metrics.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For the MNIST model, input should represent a grayscale image with dimensions of 28 × 28 pixels. Validate the request before running inference.&lt;/p&gt;

&lt;p&gt;For workloads that don't need immediate responses, consider batch inference instead of keeping an online endpoint available continuously.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Production Best Practices
&lt;/h2&gt;

&lt;p&gt;A model that works locally isn't automatically production-ready.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cost optimization
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Start with CPU training for small models when practical.&lt;/li&gt;
&lt;li&gt;Use GPU instances when benchmarks show a meaningful benefit.&lt;/li&gt;
&lt;li&gt;Set job time limits.&lt;/li&gt;
&lt;li&gt;Stop endpoints and compute resources when they are no longer required.&lt;/li&gt;
&lt;li&gt;Evaluate batch inference for offline workloads.&lt;/li&gt;
&lt;li&gt;Include storage, logging, data transfer, and supporting services in cost estimates.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Security
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Apply least-privilege IAM policies.&lt;/li&gt;
&lt;li&gt;Keep S3 buckets private.&lt;/li&gt;
&lt;li&gt;Encrypt sensitive datasets and artifacts.&lt;/li&gt;
&lt;li&gt;Avoid embedding credentials in source code.&lt;/li&gt;
&lt;li&gt;Restrict access to training data and deployed models.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Reproducibility
&lt;/h3&gt;

&lt;p&gt;Track dataset versions, dependencies, training parameters, random seeds, and model artifacts. Store code in version control and preserve evaluation results for each model version.&lt;/p&gt;

&lt;h3&gt;
  
  
  Monitoring
&lt;/h3&gt;

&lt;p&gt;Monitor training failures, compute utilization, inference latency, and application errors using supported AWS monitoring capabilities.&lt;/p&gt;

&lt;p&gt;Also evaluate model quality over time. A service can remain operational while its predictions become less accurate because real-world data has changed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Model evaluation
&lt;/h3&gt;

&lt;p&gt;Don't rely on training loss alone.&lt;/p&gt;

&lt;p&gt;For classification tasks, consider precision, recall, F1 score, confusion matrices, and performance on representative held-out data. Select metrics based on the real business problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Where Can You Use PyTorch on AWS?
&lt;/h2&gt;

&lt;p&gt;Common applications include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Computer vision:&lt;/strong&gt; Image classification and defect detection.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Natural language processing:&lt;/strong&gt; Text classification and domain-specific model fine-tuning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recommendation systems:&lt;/strong&gt; Ranking and personalization.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Forecasting:&lt;/strong&gt; Demand prediction and time-series analysis.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Generative AI:&lt;/strong&gt; Training or fine-tuning compatible neural network models.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For large-scale distributed training, additional planning is needed for GPU memory, network communication, checkpointing, and data loading.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;PyTorch provides the flexibility to build deep learning models, while AWS offers several ways to run training workloads, store model artifacts, and deploy predictions.&lt;/p&gt;

&lt;p&gt;Start with a small experiment, validate the results, and then introduce cloud infrastructure where it provides measurable value.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The real goal is not just to train a model in the cloud. It's to create a secure, reproducible, observable machine learning workflow that can grow with your application.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Official Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/sagemaker/latest/dg/pytorch.html" rel="noopener noreferrer"&gt;PyTorch on Amazon SageMaker AI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/blogs/machine-learning/" rel="noopener noreferrer"&gt;AWS machine learning blog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/s3/" rel="noopener noreferrer"&gt;Amazon S3 documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/cloudwatch/" rel="noopener noreferrer"&gt;Amazon CloudWatch documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pytorch.org/get-started/locally/" rel="noopener noreferrer"&gt;Install PyTorch&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  AWS #PyTorch #MachineLearning #DeepLearning #AmazonSageMaker
&lt;/h1&gt;

</description>
      <category>aws</category>
      <category>pytorch</category>
      <category>machinelearning</category>
      <category>python</category>
    </item>
    <item>
      <title>AWS Lambda Web Functions: Build and Scale Web Apps Without Managing Servers</title>
      <dc:creator>Muhammad Umair Ashraf</dc:creator>
      <pubDate>Tue, 20 Oct 2026 02:21:48 +0000</pubDate>
      <link>https://dev.to/omayrashraf/aws-lambda-web-functions-build-and-scale-web-apps-without-managing-servers-2eg6</link>
      <guid>https://dev.to/omayrashraf/aws-lambda-web-functions-build-and-scale-web-apps-without-managing-servers-2eg6</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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqngk8ki5899a39ruykhy.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqngk8ki5899a39ruykhy.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What if you could build a web application using a familiar Node.js framework, deploy it to AWS Lambda, and let AWS manage much of the infrastructure behind it?&lt;/p&gt;

&lt;p&gt;That is the idea behind &lt;strong&gt;AWS Lambda Web Functions&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Traditionally, running a web application means thinking about servers, scaling, deployment configuration, availability, and infrastructure maintenance. Serverless computing reduces some of that operational work, but web developers still need a deployment model that fits their application.&lt;/p&gt;

&lt;p&gt;Lambda Web Functions are designed to make that experience more natural for supported web applications.&lt;/p&gt;

&lt;p&gt;In this article, we'll explore the architecture, deploy a small example, and discuss what to consider before using this approach in production.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Are AWS Lambda Web Functions?
&lt;/h2&gt;

&lt;p&gt;AWS Lambda Web Functions provide a way to run web applications on Lambda using familiar HTTP application patterns.&lt;/p&gt;

&lt;p&gt;Instead of managing a traditional application server, you deploy your application to a managed environment that handles incoming HTTP requests and adjusts execution capacity according to demand.&lt;/p&gt;

&lt;p&gt;The approach is especially relevant to developers building with supported Node.js frameworks, such as Express and Hono.&lt;/p&gt;

&lt;p&gt;Some potential benefits include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Less server management:&lt;/strong&gt; Spend more time on application code and less time maintaining infrastructure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Managed scaling:&lt;/strong&gt; Adjust execution capacity as traffic changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Concurrent requests:&lt;/strong&gt; An execution environment can handle multiple requests concurrently, within service and configuration limits.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTTPS endpoints:&lt;/strong&gt; Expose your application through a managed HTTPS endpoint.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Familiar development patterns:&lt;/strong&gt; Build web applications without having to design every route around a custom event handler.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Always check the latest AWS documentation for supported runtimes, frameworks, limits, and regional availability.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Does the Architecture Work?
&lt;/h2&gt;

&lt;p&gt;The basic request flow looks like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Build a web application using a supported Node.js framework.&lt;/li&gt;
&lt;li&gt;Deploy the application as a Lambda Web Function.&lt;/li&gt;
&lt;li&gt;A browser or API client sends an HTTP request to the application's endpoint.&lt;/li&gt;
&lt;li&gt;The application processes the request and returns an HTTP response.&lt;/li&gt;
&lt;li&gt;AWS manages the underlying execution capacity and scaling behavior.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For applications serving users in multiple geographic locations, you can also evaluate Amazon CloudFront as an additional layer for custom domains, caching, and edge security controls.&lt;/p&gt;

&lt;p&gt;The right design depends on latency requirements, traffic patterns, security needs, and application state.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lambda Web Functions vs. Traditional Hosting
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Traditional hosting&lt;/th&gt;
&lt;th&gt;Lambda Web Functions&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Infrastructure&lt;/td&gt;
&lt;td&gt;Servers or containers must be configured and managed&lt;/td&gt;
&lt;td&gt;AWS manages the underlying execution environment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Scaling&lt;/td&gt;
&lt;td&gt;Often requires capacity and scaling configuration&lt;/td&gt;
&lt;td&gt;Designed for managed, demand-based scaling&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Application model&lt;/td&gt;
&lt;td&gt;Runs on a configured web server or platform&lt;/td&gt;
&lt;td&gt;Uses the Lambda Web Functions execution model&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Quiet periods&lt;/td&gt;
&lt;td&gt;Capacity may remain allocated&lt;/td&gt;
&lt;td&gt;Can scale down as demand falls&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Operations&lt;/td&gt;
&lt;td&gt;More infrastructure responsibilities may apply&lt;/td&gt;
&lt;td&gt;Reduced server-management overhead&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cost&lt;/td&gt;
&lt;td&gt;Depends on hosting resources and usage&lt;/td&gt;
&lt;td&gt;Depends on requests, compute, memory, data transfer, and supporting services&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Serverless isn't automatically cheaper for every workload. Applications with steady, high utilization or specialized infrastructure needs may be better suited to another hosting model.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hands-On: Deploy a Simple Web Application
&lt;/h2&gt;

&lt;p&gt;Let's walk through a small deployment workflow.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Prepare your environment
&lt;/h3&gt;

&lt;p&gt;You'll need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An AWS account with access to Lambda Web Functions in a supported Region.&lt;/li&gt;
&lt;li&gt;AWS CLI configured with appropriate credentials.&lt;/li&gt;
&lt;li&gt;The required deployment tooling.&lt;/li&gt;
&lt;li&gt;A compatible Node.js development environment.&lt;/li&gt;
&lt;li&gt;IAM permissions to deploy and manage the resources involved.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Follow the current AWS getting-started guide for the exact prerequisites.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Deploy a starter application
&lt;/h3&gt;

&lt;p&gt;The documented workflow includes deploying a sample application. The following illustrates the command format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws lambda-web deploy &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--name&lt;/span&gt; my-web-app &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--hello-world&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Review the current AWS documentation for installation and authentication instructions, as service tooling can evolve.&lt;/p&gt;

&lt;p&gt;After deployment, use the endpoint returned by the deployment process.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Test the endpoint
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl https://YOUR-APPLICATION-ENDPOINT
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;YOUR-APPLICATION-ENDPOINT&lt;/code&gt; with the actual hostname provided by AWS.&lt;/p&gt;

&lt;p&gt;A successful request should return an HTTP response from the sample application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Create a simple Express route
&lt;/h3&gt;

&lt;p&gt;Here is an illustrative Node.js example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;express&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nx"&gt;app&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;service&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Lambda Web Functions&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;running&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello from AWS!&lt;/span&gt;&lt;span class="dl"&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;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This route returns a JSON response when a client requests &lt;code&gt;/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Make sure your project uses the correct module format, entry point, and packaging structure required by the current Lambda Web Functions tooling. The example is not a substitute for the official framework setup instructions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Deploy your application code
&lt;/h3&gt;

&lt;p&gt;The documented workflow also illustrates deploying code from a local directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws lambda-web deploy &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--name&lt;/span&gt; my-web-app &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--code&lt;/span&gt; ./my-web-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Prepare the directory according to the current deployment requirements, then run the appropriate deployment command.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 6: Verify the result
&lt;/h3&gt;

&lt;p&gt;Send a request to the root route:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl https://YOUR-APPLICATION-ENDPOINT/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For the example route above, the expected JSON body is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"service"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Lambda Web Functions"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"running"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Hello from AWS!"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the request fails, inspect the deployment output, application logs, IAM permissions, and framework configuration.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 7: Clean up
&lt;/h3&gt;

&lt;p&gt;When you're finished experimenting, follow the current AWS cleanup instructions and remove resources you no longer need. Check for supporting resources that may continue to incur charges.&lt;/p&gt;

&lt;h2&gt;
  
  
  Production Considerations
&lt;/h2&gt;

&lt;p&gt;A successful deployment is only the beginning. Production applications need to be designed for concurrency, security, reliability, and cost.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Handle concurrent requests safely
&lt;/h3&gt;

&lt;p&gt;Don't assume every HTTP request gets its own isolated, permanent process.&lt;/p&gt;

&lt;p&gt;Avoid storing user-specific information in shared global variables. Keep request data isolated and use an appropriate external store for persistent state.&lt;/p&gt;

&lt;p&gt;Review the concurrency limits and configuration options for the service before deploying high-traffic workloads.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Keep application state external
&lt;/h3&gt;

&lt;p&gt;For durable application data, use an appropriate database or object store rather than relying on temporary execution-environment files.&lt;/p&gt;

&lt;p&gt;Use a suitable session-management strategy, and protect session identifiers and credentials.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Apply least-privilege security
&lt;/h3&gt;

&lt;p&gt;For production deployments:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Grant only the IAM permissions the application requires.&lt;/li&gt;
&lt;li&gt;Validate incoming data and handle errors safely.&lt;/li&gt;
&lt;li&gt;Store secrets in a dedicated secrets-management service.&lt;/li&gt;
&lt;li&gt;Protect downstream databases and APIs.&lt;/li&gt;
&lt;li&gt;Consider CloudFront and AWS WAF where caching, custom domains, or web traffic filtering are needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Monitor the application
&lt;/h3&gt;

&lt;p&gt;Monitor request volume, latency, errors, and downstream dependencies. Use the logging and monitoring options supported by the service to investigate slow requests and unexpected behavior.&lt;/p&gt;

&lt;p&gt;Managed infrastructure reduces operational effort, but it doesn't eliminate the need for observability.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Cost
&lt;/h2&gt;

&lt;p&gt;Before migrating an application, evaluate the complete cost rather than focusing on a single service.&lt;/p&gt;

&lt;p&gt;Depending on the architecture, costs may include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Requests and compute usage.&lt;/li&gt;
&lt;li&gt;Memory consumption over the applicable environment lifetime.&lt;/li&gt;
&lt;li&gt;Data transfer.&lt;/li&gt;
&lt;li&gt;Logging and monitoring.&lt;/li&gt;
&lt;li&gt;CloudFront, databases, and other supporting services.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Estimate traffic volume, average response time, memory requirements, and response sizes. Then test with realistic traffic and compare actual usage with your estimates.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Should You Consider Lambda Web Functions?
&lt;/h2&gt;

&lt;p&gt;This approach may be worth exploring for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Node.js web applications and APIs.&lt;/li&gt;
&lt;li&gt;Internal dashboards and developer tools.&lt;/li&gt;
&lt;li&gt;Prototypes and small web products.&lt;/li&gt;
&lt;li&gt;Applications with changing traffic levels.&lt;/li&gt;
&lt;li&gt;Teams that want to reduce server-management overhead.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It may not fit applications that require an unsupported runtime, a different execution model, or infrastructure behavior the service doesn't provide.&lt;/p&gt;

&lt;p&gt;Verify current framework and runtime support before planning a migration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;AWS Lambda Web Functions offer another option for building web applications on AWS: use familiar web development patterns while relying on managed infrastructure for execution and scaling.&lt;/p&gt;

&lt;p&gt;The real value isn't simply removing servers. It's reducing unnecessary operational work while keeping the application reliable, secure, observable, and cost-effective.&lt;/p&gt;

&lt;p&gt;Start with a small application, test its HTTP behavior, review its concurrency characteristics, and compare the results with your current hosting approach before moving production workloads.&lt;/p&gt;

&lt;h3&gt;
  
  
  Official AWS Resources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/blogs/aws/announcing-aws-lambda-web-functions-for-fast-consistent-web-app-performance-anywhere/" rel="noopener noreferrer"&gt;AWS announcement: Lambda Web Functions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/lambda/latest/dg/web-functions.html" rel="noopener noreferrer"&gt;Lambda Web Functions documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/lambda/latest/dg/web-functions-create.html" rel="noopener noreferrer"&gt;Getting started&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/lambda/latest/dg/web-functions-how-it-works.html" rel="noopener noreferrer"&gt;How it works&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/lambda/latest/dg/web-functions-best-practices.html" rel="noopener noreferrer"&gt;Best practices&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  AWS #Serverless #NodeJS #WebDevelopment #CloudComputing
&lt;/h1&gt;

</description>
      <category>aws</category>
      <category>serverless</category>
      <category>node</category>
      <category>webdev</category>
    </item>
    <item>
      <title>AWS Context: How Knowledge Graphs Give AI Agents Governed Enterprise Context</title>
      <dc:creator>Muhammad Umair Ashraf</dc:creator>
      <pubDate>Sat, 17 Oct 2026 02:52:46 +0000</pubDate>
      <link>https://dev.to/omayrashraf/aws-context-how-knowledge-graphs-give-ai-agents-governed-enterprise-context-515f</link>
      <guid>https://dev.to/omayrashraf/aws-context-how-knowledge-graphs-give-ai-agents-governed-enterprise-context-515f</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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fs5cioy2cxxvx93rywm0q.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fs5cioy2cxxvx93rywm0q.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AI agents can generate answers, write code, and automate workflows. But when they work with enterprise data, one important challenge remains: &lt;strong&gt;understanding how information connects across different systems.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Imagine asking an AI agent:&lt;/p&gt;

&lt;p&gt;"Why is this customer's order delayed, and are they eligible for a refund?"&lt;/p&gt;

&lt;p&gt;The answer may require customer records, order details, shipment status, refund policies, and business rules from multiple systems.&lt;/p&gt;

&lt;p&gt;Access to those sources is not enough. The agent needs to identify the correct relationships, retrieve relevant evidence, and follow the organization's access and approval rules.&lt;/p&gt;

&lt;p&gt;This is the problem &lt;strong&gt;AWS Context&lt;/strong&gt; is designed to address.&lt;/p&gt;

&lt;p&gt;AWS introduced AWS Context in June 2026 as a forthcoming service designed to map relationships across enterprise data into a knowledge graph, helping agents retrieve governed context at runtime.&lt;/p&gt;

&lt;p&gt;Check the latest AWS announcements for current service availability and supported capabilities before planning a deployment.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is AWS Context?
&lt;/h2&gt;

&lt;p&gt;AWS Context is designed to connect enterprise data, business concepts, and organizational knowledge through a shared knowledge graph.&lt;/p&gt;

&lt;p&gt;Its announced approach includes several capabilities:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Relationship discovery:&lt;/strong&gt; Identify relationships between data assets and business entities.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Knowledge graphs:&lt;/strong&gt; Represent connections between datasets, entities, and business concepts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Curated business knowledge:&lt;/strong&gt; Allow data stewards to review relationships and attach trusted definitions and rules.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Governed retrieval:&lt;/strong&gt; Help agents retrieve context while respecting the access boundaries established for the requesting identity.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Interoperability:&lt;/strong&gt; AWS has described publishing key context metadata in Apache Iceberg format in Amazon S3 Tables for use with compatible tools.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is to make enterprise knowledge reusable across multiple AI applications instead of embedding the same assumptions in every prompt.&lt;/p&gt;

&lt;p&gt;Official announcement: &lt;a href="https://aws.amazon.com/blogs/machine-learning/context-intelligence-for-your-data-and-ai-agents-at-scale/" rel="noopener noreferrer"&gt;https://aws.amazon.com/blogs/machine-learning/context-intelligence-for-your-data-and-ai-agents-at-scale/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Do AI Agents Need a Knowledge Graph?
&lt;/h2&gt;

&lt;p&gt;Traditional retrieval-augmented generation (RAG) often retrieves documents or passages that match a question. This is useful, but individual documents do not always reveal all the relationships needed to answer a business question.&lt;/p&gt;

&lt;p&gt;Consider this simplified knowledge graph:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Customer
   |
   | places
   v
Order
   |
   | has
   v
Shipment
   |
   | has status
   v
Delivery Delay

Order
   |
   | evaluated under
   v
Refund Policy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The graph connects the customer, order, shipment, and policy.&lt;/p&gt;

&lt;p&gt;An agent can use these relationships to investigate a question rather than treating each record as an isolated piece of information.&lt;/p&gt;

&lt;p&gt;For example, finding a refund policy is not enough. The agent must identify the relevant order, retrieve the current shipment status, and apply the correct policy.&lt;/p&gt;

&lt;p&gt;A knowledge graph helps organize these relationships. The underlying data must still be reliable, and the agent must validate its findings before making decisions.&lt;/p&gt;

&lt;h2&gt;
  
  
  How AWS Context Fits into an AI Architecture
&lt;/h2&gt;

&lt;p&gt;A simplified conceptual architecture looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;           User Request
                |
                v
          AI Application
                |
                v
              AI Agent
                |
                v
            AWS Context
                |
                v
      Governed Knowledge Graph
                |
       +--------+--------+
       |        |        |
       v        v        v
    Customer  Orders  Policies
      Data     Data   and Rules
                |
                v
      Evidence-Based Response
                |
                v
      Approval Before Action
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This diagram illustrates the intended workflow, not a deployed AWS Context configuration.&lt;/p&gt;

&lt;p&gt;The agent identifies the context required for a task, retrieves relevant relationships through configured interfaces, and uses the resulting evidence to prepare an answer.&lt;/p&gt;

&lt;p&gt;Access controls are essential. An agent should not retrieve restricted records simply because they are connected to another accessible entity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mini-Project: Build a Context-Aware Customer Support Agent
&lt;/h2&gt;

&lt;p&gt;Let's design a small customer-support workflow that connects customer information, order records, shipment status, and refund policies.&lt;/p&gt;

&lt;h3&gt;
  
  
  Project goal
&lt;/h3&gt;

&lt;p&gt;The agent should:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Identify the relevant customer and order.&lt;/li&gt;
&lt;li&gt;Retrieve the latest shipment status.&lt;/li&gt;
&lt;li&gt;Find the applicable refund policy.&lt;/li&gt;
&lt;li&gt;Explain the situation using evidence.&lt;/li&gt;
&lt;li&gt;Request human approval before executing a refund.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The following example uses fictional data. It demonstrates the intended workflow rather than a live AWS Context deployment or an executed integration test.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Prepare sample data
&lt;/h3&gt;

&lt;p&gt;Customer and order records:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Customer ID&lt;/th&gt;
&lt;th&gt;Order ID&lt;/th&gt;
&lt;th&gt;Status&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;C101&lt;/td&gt;
&lt;td&gt;O501&lt;/td&gt;
&lt;td&gt;Shipped&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;C102&lt;/td&gt;
&lt;td&gt;O502&lt;/td&gt;
&lt;td&gt;Processing&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Shipment records:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Shipment ID&lt;/th&gt;
&lt;th&gt;Order ID&lt;/th&gt;
&lt;th&gt;Shipment status&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;S801&lt;/td&gt;
&lt;td&gt;O501&lt;/td&gt;
&lt;td&gt;Delayed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;S802&lt;/td&gt;
&lt;td&gt;O502&lt;/td&gt;
&lt;td&gt;Awaiting dispatch&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Sample business rule:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Refund eligibility depends on order status, product category, delivery conditions, and the applicable return window. A delayed shipment alone does not automatically guarantee a refund.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In production, these records should come from authoritative systems, and the refund rule should come from an approved policy source.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Model the relationships
&lt;/h3&gt;

&lt;p&gt;The context model might contain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Customer C101
    |
    | owns
    v
Order O501
    |
    | has shipment
    v
Shipment S801
    |
    | current status
    v
Delayed

Order O501
    |
    | evaluated against
    v
Refund Policy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Where supported, record the source, freshness, and review status of important relationships. This helps distinguish verified facts from assumptions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Give the agent a task
&lt;/h3&gt;

&lt;p&gt;Use this prompt in your prototype:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A customer wants an update on a delayed order. Identify the relevant order, retrieve its latest shipment status, locate the applicable refund policy, and explain the available options. Use only authorized data and approved rules. If required information is missing, state what is missing. Do not initiate a refund or modify the order.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The intended workflow is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Resolve the customer and order identifiers.&lt;/li&gt;
&lt;li&gt;Retrieve the authorized shipment record.&lt;/li&gt;
&lt;li&gt;Retrieve the applicable policy.&lt;/li&gt;
&lt;li&gt;Evaluate the available evidence.&lt;/li&gt;
&lt;li&gt;Produce an explanation with source references.&lt;/li&gt;
&lt;li&gt;Escalate if the evidence is incomplete or human review is required.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The exact retrieval APIs and implementation steps depend on the interfaces available in your environment. Check the current AWS documentation before implementing a specific SDK call or endpoint.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Define the expected output
&lt;/h3&gt;

&lt;p&gt;For fictional order &lt;code&gt;O501&lt;/code&gt;, the agent could produce a response like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"order_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"O501"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"shipment_status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Delayed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"policy_check"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Additional information required"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"explanation"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"A shipment delay alone does not establish refund eligibility."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"next_step"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Check the applicable return window and order conditions."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"refund_execution"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"NOT_EXECUTED"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"human_review_required"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is an illustrative response schema, not actual output from AWS Context.&lt;/p&gt;

&lt;p&gt;The key behavior is that the agent does not invent a refund entitlement. It explains what is known, identifies missing information, and avoids executing an unapproved action.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Add security and governance
&lt;/h3&gt;

&lt;p&gt;For a production implementation, enforce controls outside the language model wherever possible.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Least privilege:&lt;/strong&gt; Give the agent only the access it needs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Identity-aware retrieval:&lt;/strong&gt; Ensure user permissions constrain accessible data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Human approval:&lt;/strong&gt; Require approval for refunds and other consequential actions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Source traceability:&lt;/strong&gt; Preserve references to the data and policies behind an answer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Audit logging:&lt;/strong&gt; Record relevant retrieval and execution activity.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Freshness checks:&lt;/strong&gt; Revalidate the order status before taking action.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Safe failure handling:&lt;/strong&gt; Escalate when records conflict or evidence is insufficient.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is not simply to make an agent more knowledgeable. It is to make its decisions more explainable and controllable.&lt;/p&gt;

&lt;h2&gt;
  
  
  AWS Context vs. Traditional RAG
&lt;/h2&gt;

&lt;p&gt;These approaches solve related but different problems.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Capability&lt;/th&gt;
&lt;th&gt;Traditional document RAG&lt;/th&gt;
&lt;th&gt;AWS Context's announced approach&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Main focus&lt;/td&gt;
&lt;td&gt;Retrieve relevant document passages&lt;/td&gt;
&lt;td&gt;Connect relationships and business context&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data representation&lt;/td&gt;
&lt;td&gt;Documents, chunks, and metadata&lt;/td&gt;
&lt;td&gt;Knowledge graph across connected data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Business definitions&lt;/td&gt;
&lt;td&gt;Often supplied through documents or application logic&lt;/td&gt;
&lt;td&gt;Can be curated in the context layer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cross-source relationships&lt;/td&gt;
&lt;td&gt;May require custom joins and retrieval logic&lt;/td&gt;
&lt;td&gt;Relationship discovery is a core design goal&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Governance&lt;/td&gt;
&lt;td&gt;Depends on implementation&lt;/td&gt;
&lt;td&gt;Designed around governed context retrieval&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;They can complement each other. A knowledge graph might identify the correct refund policy and order, while a RAG system retrieves the detailed policy paragraphs.&lt;/p&gt;

&lt;p&gt;A production architecture may benefit from both structured relationships and unstructured document retrieval.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Can This Make a Difference?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Customer support
&lt;/h3&gt;

&lt;p&gt;Connect customer profiles, orders, shipments, support cases, and policies to provide more relevant answers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Financial operations
&lt;/h3&gt;

&lt;p&gt;Relate transactions, accounts, approval rules, and audit records to support investigations while preserving access controls.&lt;/p&gt;

&lt;h3&gt;
  
  
  Enterprise analytics
&lt;/h3&gt;

&lt;p&gt;Connect metrics, data assets, ownership information, and definitions so agents can better understand what a metric means and where it originates.&lt;/p&gt;

&lt;h3&gt;
  
  
  Internal knowledge discovery
&lt;/h3&gt;

&lt;p&gt;Help employees navigate relationships between teams, projects, systems, and documentation rather than searching for isolated documents.&lt;/p&gt;

&lt;p&gt;The actual value depends on the quality of the data, the accuracy of the relationships, and the effectiveness of governance controls.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Should Teams Evaluate Before Production?
&lt;/h2&gt;

&lt;p&gt;Before adopting a context layer, ask:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data quality:&lt;/strong&gt; Are source records accurate and consistently identified?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Relationship quality:&lt;/strong&gt; Can inferred relationships be reviewed before they affect important decisions?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authority:&lt;/strong&gt; Which system is authoritative when sources disagree?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Permissions:&lt;/strong&gt; Does the user's identity constrain the context available to the agent?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Freshness:&lt;/strong&gt; How quickly are changes in data and policies reflected?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Traceability:&lt;/strong&gt; Can the team identify the sources and rules behind an answer?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Evaluation:&lt;/strong&gt; Are agent responses tested against known scenarios and conflicting evidence?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Failure handling:&lt;/strong&gt; Does the agent ask for clarification or escalate when context is incomplete?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A knowledge graph alone does not guarantee correct answers. Source quality, retrieval behavior, access controls, and testing remain essential.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started with AWS
&lt;/h2&gt;

&lt;p&gt;AWS introduced AWS Context in June 2026 as a forthcoming service. Check the latest announcements and documentation for availability, supported regions, prerequisites, and integration details.&lt;/p&gt;

&lt;p&gt;Useful resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS Context announcement:&lt;/strong&gt; &lt;a href="https://aws.amazon.com/blogs/machine-learning/context-intelligence-for-your-data-and-ai-agents-at-scale/" rel="noopener noreferrer"&gt;https://aws.amazon.com/blogs/machine-learning/context-intelligence-for-your-data-and-ai-agents-at-scale/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Summit New York 2026:&lt;/strong&gt; &lt;a href="https://www.aboutamazon.com/news/aws/aws-summit-nyc-2026-ai-agents" rel="noopener noreferrer"&gt;https://www.aboutamazon.com/news/aws/aws-summit-nyc-2026-ai-agents&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Context Ontology Accelerator:&lt;/strong&gt; &lt;a href="https://aws.github.io/context-ontology-accelerator/" rel="noopener noreferrer"&gt;https://aws.github.io/context-ontology-accelerator/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Prescriptive Guidance on knowledge bases for agentic AI:&lt;/strong&gt; &lt;a href="https://docs.aws.amazon.com/prescriptive-guidance/latest/govern-architect-agentic-ai/core-services-knowledge-bases.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/prescriptive-guidance/latest/govern-architect-agentic-ai/core-services-knowledge-bases.html&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want to experiment with knowledge graphs before a managed AWS Context deployment is available to you, explore the open-source Context Ontology Accelerator. It provides an alternative approach to modeling business entities and relationships, with human review and components such as Amazon Neptune, Amazon OpenSearch Serverless, and Amazon Bedrock.&lt;/p&gt;

&lt;p&gt;Its setup is different from the managed service.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;AI agents need more than access to data. They need to understand relationships, business definitions, and the rules that determine which information is relevant.&lt;/p&gt;

&lt;p&gt;AWS Context is designed to address this challenge through a shared knowledge graph and governed context retrieval at runtime.&lt;/p&gt;

&lt;p&gt;For teams building enterprise agents, the opportunity is to move from isolated answers toward decisions grounded in connected business information.&lt;/p&gt;

&lt;p&gt;Start with a small workflow, validate the relationships and source data, enforce least-privilege access, and keep human approval in place for consequential actions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The future of enterprise AI is not just about smarter models. It is about giving those models the right context, with the right controls, at the right time.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;What enterprise workflow would benefit most from a shared knowledge graph in your organization?&lt;/p&gt;

&lt;h1&gt;
  
  
  aws #ai #cloud #dataengineering
&lt;/h1&gt;

</description>
      <category>aws</category>
      <category>ai</category>
      <category>cloud</category>
      <category>dataengineering</category>
    </item>
    <item>
      <title>Redshift in the Agent Toolkit: Build, Query, and Troubleshoot with AI Coding Agents</title>
      <dc:creator>Muhammad Umair Ashraf</dc:creator>
      <pubDate>Fri, 16 Oct 2026 03:08:43 +0000</pubDate>
      <link>https://dev.to/omayrashraf/redshift-in-the-agent-toolkit-build-query-and-troubleshoot-with-ai-coding-agents-5b3g</link>
      <guid>https://dev.to/omayrashraf/redshift-in-the-agent-toolkit-build-query-and-troubleshoot-with-ai-coding-agents-5b3g</guid>
      <description>&lt;p&gt;AI coding agents are changing how developers interact with cloud infrastructure and databases. Instead of manually searching documentation and writing every query from scratch, developers can describe a task in natural language and use an AI assistant to help explore schemas, generate SQL, and investigate database problems.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsdyfsb2hih7oe7yjug9c.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsdyfsb2hih7oe7yjug9c.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With &lt;strong&gt;Agent Toolkit for AWS and Amazon Redshift integration&lt;/strong&gt;, developers can bring these workflows into coding environments such as Claude Code, Kiro, and Cursor.&lt;/p&gt;

&lt;p&gt;In this tutorial, we'll explore the concept and build a small sales analytics project using Amazon Redshift and SQL.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Redshift in the Agent Toolkit?
&lt;/h2&gt;

&lt;p&gt;Amazon Redshift is an AWS cloud data warehouse designed for analytics and SQL-based workloads.&lt;/p&gt;

&lt;p&gt;Agent Toolkit for AWS provides integrations and specialized skills that help supported AI coding agents work with AWS services. For Redshift-related workflows, these capabilities can help developers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Discover tables, columns, and database metadata.&lt;/li&gt;
&lt;li&gt;Generate and explain SQL queries.&lt;/li&gt;
&lt;li&gt;Analyze sales and reporting data.&lt;/li&gt;
&lt;li&gt;Troubleshoot SQL errors and performance issues.&lt;/li&gt;
&lt;li&gt;Review analytical query patterns and materialized views.&lt;/li&gt;
&lt;li&gt;Assist with data warehouse migration and validation workflows.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The agent helps developers understand and work with the data warehouse. It does not eliminate the need to review SQL, validate results, or control permissions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Official announcement:&lt;/strong&gt; &lt;a href="https://aws.amazon.com/about-aws/whats-new/2026/08/redshift-agenttoolkit-for-ai-assisted-datawarehouse-mgmt/" rel="noopener noreferrer"&gt;https://aws.amazon.com/about-aws/whats-new/2026/08/redshift-agenttoolkit-for-ai-assisted-datawarehouse-mgmt/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How the workflow works
&lt;/h2&gt;

&lt;p&gt;A simplified architecture looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Developer
   |
   v
AI Coding Agent
(Claude Code / Kiro / Cursor)
   |
   v
Agent Toolkit for AWS
   |
   v
Configured AWS Tools and Permissions
   |
   v
Amazon Redshift
   |
   v
Query Results and Recommendations
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The developer describes a task, the agent uses its configured capabilities to help perform it, and Redshift returns the query results.&lt;/p&gt;

&lt;p&gt;Actual functionality depends on the installed integrations, AWS credentials, region, and database permissions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project: Investigate a sales revenue decline
&lt;/h2&gt;

&lt;p&gt;Imagine your business team reports that revenue is declining in one region. You want to analyze daily sales and identify where the change occurred.&lt;/p&gt;

&lt;p&gt;For this demonstration, we'll use fictional sales data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;You'll need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An Amazon Redshift Serverless workgroup or provisioned cluster.&lt;/li&gt;
&lt;li&gt;A database and schema where you can create a sample table.&lt;/li&gt;
&lt;li&gt;Appropriate AWS credentials and database permissions.&lt;/li&gt;
&lt;li&gt;A supported coding agent with Agent Toolkit for AWS configured.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For learning, use a development environment and non-sensitive data.&lt;/p&gt;

&lt;p&gt;Getting started with Redshift: &lt;a href="https://docs.aws.amazon.com/redshift/latest/gsg/getting-started.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/redshift/latest/gsg/getting-started.html&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Create a sales table
&lt;/h3&gt;

&lt;p&gt;Run this SQL in your authorized Redshift query editor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;sales_orders&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;order_id&lt;/span&gt;     &lt;span class="nb"&gt;INTEGER&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;order_date&lt;/span&gt;   &lt;span class="nb"&gt;DATE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;region&lt;/span&gt;       &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;revenue&lt;/span&gt;      &lt;span class="nb"&gt;DECIMAL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;status&lt;/span&gt;       &lt;span class="nb"&gt;VARCHAR&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="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Insert sample records
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;sales_orders&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;region&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;revenue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;VALUES&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'2026-10-01'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'North'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1200&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'completed'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'2026-10-01'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'South'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="mi"&gt;900&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'completed'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'2026-10-02'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'North'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1500&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'completed'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'2026-10-02'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'South'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="mi"&gt;650&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'completed'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'2026-10-03'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'North'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="mi"&gt;800&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'completed'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'2026-10-03'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'South'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'completed'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We now have a small dataset with two regions and three days of sales.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Ask your AI coding agent to inspect the schema
&lt;/h3&gt;

&lt;p&gt;Try this prompt in your configured coding agent:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Inspect the accessible Amazon Redshift database and identify the tables and columns relevant to sales reporting. Explain which columns contain the order date, region, revenue, and status. Do not modify any data.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is a useful starting point because the agent can work with actual database metadata rather than relying entirely on assumptions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Generate a daily revenue report
&lt;/h3&gt;

&lt;p&gt;Next, ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Write a Redshift SQL query to calculate completed revenue by day and region. Exclude non-completed orders and sort the output by date and region. Explain the query before execution.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A suitable query is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;region&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;revenue&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;total_revenue&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;sales_orders&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'completed'&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt;
    &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;region&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt;
    &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;region&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Expected observations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;North revenue on October 1: $1,200&lt;/li&gt;
&lt;li&gt;North revenue on October 2: $1,500&lt;/li&gt;
&lt;li&gt;North revenue on October 3: $800&lt;/li&gt;
&lt;li&gt;South revenue on October 1: $900&lt;/li&gt;
&lt;li&gt;South revenue on October 2: $650&lt;/li&gt;
&lt;li&gt;South revenue on October 3: $400&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These values are based on the sample records above. The report makes daily changes visible without manually calculating totals.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Find the percentage change
&lt;/h3&gt;

&lt;p&gt;Now ask the agent:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Compare daily completed revenue for each region. Calculate the percentage change from the previous available date, and explain any limitations in the analysis. Generate a read-only query first.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here is one way to implement that analysis:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="n"&gt;daily_revenue&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt;
        &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;region&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;revenue&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;revenue&lt;/span&gt;
    &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;sales_orders&lt;/span&gt;
    &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'completed'&lt;/span&gt;
    &lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt;
        &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;region&lt;/span&gt;
&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="n"&gt;revenue_comparison&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt;
        &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;region&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;revenue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;LAG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;revenue&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="k"&gt;PARTITION&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;region&lt;/span&gt;
            &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;order_date&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;previous_revenue&lt;/span&gt;
    &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;daily_revenue&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;region&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;revenue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;previous_revenue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ROUND&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;revenue&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;previous_revenue&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="k"&gt;NULLIF&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;previous_revenue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="mi"&gt;2&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;percentage_change&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;revenue_comparison&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt;
    &lt;span class="n"&gt;region&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;LAG()&lt;/code&gt; window function retrieves the previous available revenue value for the same region. &lt;code&gt;NULLIF()&lt;/code&gt; prevents division by zero.&lt;/p&gt;

&lt;p&gt;This helps identify when revenue decreased. It does not establish the underlying cause. To investigate further, you might need order volumes, refunds, product categories, inventory data, or application logs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshooting Redshift with AI
&lt;/h2&gt;

&lt;p&gt;AI coding agents can also help review queries and explain possible performance problems.&lt;/p&gt;

&lt;p&gt;Try this prompt:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Review this Redshift query for correctness and performance. Identify potentially inefficient joins, unnecessary scans, filtering problems, and opportunities to improve the query. Explain each recommendation and do not execute changes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Depending on the available tools and information, an agent can help you investigate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SQL syntax and incorrect joins.&lt;/li&gt;
&lt;li&gt;Filters that change the meaning of a report.&lt;/li&gt;
&lt;li&gt;Table distribution and sort-key choices.&lt;/li&gt;
&lt;li&gt;Repeated analytical queries that may benefit from materialized views.&lt;/li&gt;
&lt;li&gt;Query plans and relevant performance metadata.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For meaningful performance tuning, provide actual query plans and workload evidence. Test the proposed query against representative data and verify that the output remains correct.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up Agent Toolkit for AWS
&lt;/h2&gt;

&lt;p&gt;Use the current official documentation to configure the toolkit and your preferred coding agent.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quick start:&lt;/strong&gt; &lt;a href="https://docs.aws.amazon.com/agent-toolkit/latest/userguide/quick-start.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/agent-toolkit/latest/userguide/quick-start.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The documented setup flow includes configuring your AWS environment and installing the integrations appropriate to your editor. A documented CLI setup command is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws configure agent-toolkit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify the required AWS CLI version and current setup instructions before running it.&lt;/p&gt;

&lt;p&gt;For editor-specific steps, see the &lt;a href="https://builder.aws.com/content/3FrAG0mXrqFbwHxp1ZOhubu84QY/setting-up-the-agent-toolkit-for-aws-in-kiro-and-codex-claude-code-and-cursor" rel="noopener noreferrer"&gt;AWS Builder Center setup guide for Kiro, Claude Code, and Cursor&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Installing an integration does not automatically grant database access. Your AWS identity, Redshift configuration, and database permissions must be set up appropriately.&lt;/p&gt;

&lt;h2&gt;
  
  
  Security practices you should follow
&lt;/h2&gt;

&lt;p&gt;Connecting an AI coding agent to a database requires careful permission management.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Start with read-only access.&lt;/strong&gt; Allow only the metadata inspection and queries needed for the task.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Review SQL before execution.&lt;/strong&gt; Check filters, joins, aggregation, and data scope.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Require approval for mutations.&lt;/strong&gt; Treat data changes, schema changes, and permission changes as higher-risk operations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Protect sensitive data.&lt;/strong&gt; Avoid exposing credentials or unnecessary confidential records in prompts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apply least privilege.&lt;/strong&gt; Configure AWS IAM and database-level permissions appropriately.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Audit activity.&lt;/strong&gt; Use available AWS and database logging to investigate access and execution.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verify every result.&lt;/strong&gt; Compare agent-generated reports with trusted queries and known totals.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The goal is to make database development more productive while keeping humans accountable for important decisions.&lt;/p&gt;

&lt;h2&gt;
  
  
  What should you measure?
&lt;/h2&gt;

&lt;p&gt;If you're introducing agent-assisted workflows to your team, measure the impact rather than assuming it will be positive.&lt;/p&gt;

&lt;p&gt;Useful metrics include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Time to create a report.&lt;/li&gt;
&lt;li&gt;Time to diagnose a query error.&lt;/li&gt;
&lt;li&gt;Percentage of generated queries accepted after review.&lt;/li&gt;
&lt;li&gt;Query execution time before and after optimization.&lt;/li&gt;
&lt;li&gt;Accuracy against an established reporting baseline.&lt;/li&gt;
&lt;li&gt;Unsafe operations prevented through approval controls.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Amazon Redshift and Agent Toolkit for AWS create new opportunities for AI-assisted data engineering.&lt;/p&gt;

&lt;p&gt;Developers using Claude Code, Kiro, and Cursor can explore schemas, generate analytical SQL, investigate data patterns, and review troubleshooting recommendations through a more conversational workflow.&lt;/p&gt;

&lt;p&gt;Start with a small read-only project, validate every query, and introduce broader capabilities only after you have reliable security and review processes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Useful resources&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/about-aws/whats-new/2026/08/redshift-agenttoolkit-for-ai-assisted-datawarehouse-mgmt/" rel="noopener noreferrer"&gt;Amazon Redshift Agent Toolkit announcement&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/agent-toolkit/latest/userguide/what-is-agent-toolkit.html" rel="noopener noreferrer"&gt;Agent Toolkit for AWS documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/agent-toolkit/latest/userguide/quick-start.html" rel="noopener noreferrer"&gt;Agent Toolkit quick start&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/blogs/big-data/query-amazon-redshift-using-natural-language-with-kiro/" rel="noopener noreferrer"&gt;Query Amazon Redshift using natural language with Kiro&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  aws #redshift #ai #sql #dataengineering #devtools
&lt;/h1&gt;

</description>
      <category>ai</category>
      <category>automation</category>
      <category>analytics</category>
      <category>aws</category>
    </item>
    <item>
      <title>Build Enterprise RAG on AWS with Managed Knowledge Bases, Smart Parsing, and Agentic Retrieval</title>
      <dc:creator>Muhammad Umair Ashraf</dc:creator>
      <pubDate>Thu, 15 Oct 2026 04:31:12 +0000</pubDate>
      <link>https://dev.to/omayrashraf/build-enterprise-rag-on-aws-with-managed-knowledge-bases-smart-parsing-and-agentic-retrieval-3amg</link>
      <guid>https://dev.to/omayrashraf/build-enterprise-rag-on-aws-with-managed-knowledge-bases-smart-parsing-and-agentic-retrieval-3amg</guid>
      <description>&lt;p&gt;Enterprise AI assistants need more than a language model. They need access to the right documents, reliable retrieval, and answers that users can verify.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0hhvlp8lf5vf2mty51t8.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0hhvlp8lf5vf2mty51t8.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Imagine asking an internal assistant:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Which team owns our ML platform, what is its annual cloud budget, and does our purchasing policy allow annual prepayment?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The answer may be spread across a team ownership document, a budget file, and an expense policy. A basic retrieval pipeline might find only one of them, leaving the answer incomplete.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Amazon Bedrock Managed Knowledge Base&lt;/strong&gt; helps simplify enterprise Retrieval-Augmented Generation (RAG) with managed ingestion and retrieval, native data connectors, Smart Parsing, and agentic retrieval.&lt;/p&gt;

&lt;p&gt;In this tutorial, we'll explore these capabilities and build a Python demo that retrieves evidence from multiple enterprise documents.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. What is Amazon Bedrock Managed Knowledge Base?
&lt;/h2&gt;

&lt;p&gt;RAG combines document retrieval with a generative AI model. Instead of relying only on information learned during training, an application retrieves relevant information from configured sources and uses it to generate an answer.&lt;/p&gt;

&lt;p&gt;A typical RAG pipeline includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data source connections&lt;/li&gt;
&lt;li&gt;Document parsing and chunking&lt;/li&gt;
&lt;li&gt;Embeddings and indexing&lt;/li&gt;
&lt;li&gt;Retrieval and ranking&lt;/li&gt;
&lt;li&gt;Answer generation&lt;/li&gt;
&lt;li&gt;Source references and evaluation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Managing each component independently can add operational complexity.&lt;/p&gt;

&lt;p&gt;Amazon Bedrock Managed Knowledge Base provides a managed approach to knowledge ingestion and retrieval, helping developers focus on the application rather than building every RAG component themselves.&lt;/p&gt;

&lt;p&gt;Official documentation: &lt;a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-build-managed.html" rel="noopener noreferrer"&gt;Amazon Bedrock Managed Knowledge Base&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Native data connectors
&lt;/h2&gt;

&lt;p&gt;Enterprise knowledge is often distributed across different platforms.&lt;/p&gt;

&lt;p&gt;Managed Knowledge Base supports native connectors for supported sources such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Amazon S3&lt;/li&gt;
&lt;li&gt;Microsoft SharePoint&lt;/li&gt;
&lt;li&gt;Atlassian Confluence&lt;/li&gt;
&lt;li&gt;Google Drive&lt;/li&gt;
&lt;li&gt;Microsoft OneDrive&lt;/li&gt;
&lt;li&gt;Web Crawler&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These connectors can reduce the amount of custom ingestion code required to bring enterprise content into a knowledge base.&lt;/p&gt;

&lt;p&gt;For example, a company could retrieve engineering runbooks from S3 and business policies from a supported collaboration platform, then use that information to answer internal questions.&lt;/p&gt;

&lt;p&gt;Connectors still require appropriate permissions, synchronization, and access-control configuration. Always confirm the currently supported sources and prerequisites in the AWS documentation.&lt;/p&gt;

&lt;p&gt;Reference: &lt;a href="https://aws.amazon.com/blogs/aws/introducing-amazon-bedrock-managed-knowledge-base-for-faster-more-accurate-enterprise-ai-applications/" rel="noopener noreferrer"&gt;Managed Knowledge Base announcement&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Smart Parsing for complex documents
&lt;/h2&gt;

&lt;p&gt;Not all enterprise data is plain text.&lt;/p&gt;

&lt;p&gt;PDFs, reports, presentations, and technical documents may contain tables, diagrams, screenshots, or complex layouts. Basic text extraction can lose important relationships between these elements.&lt;/p&gt;

&lt;p&gt;Smart Parsing helps process supported content so that it can be used more effectively during retrieval.&lt;/p&gt;

&lt;p&gt;Potential use cases include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Architecture documentation&lt;/li&gt;
&lt;li&gt;Technical reports&lt;/li&gt;
&lt;li&gt;Business policies&lt;/li&gt;
&lt;li&gt;Documents containing tables and diagrams&lt;/li&gt;
&lt;li&gt;Supported scanned or visual content&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Parsing quality should still be tested with representative documents. Important figures, table relationships, and diagram details may need verification.&lt;/p&gt;

&lt;p&gt;Reference: &lt;a href="https://aws.amazon.com/blogs/aws/introducing-amazon-bedrock-managed-knowledge-base-for-faster-more-accurate-enterprise-ai-applications/" rel="noopener noreferrer"&gt;Amazon Bedrock Managed Knowledge Base announcement&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Agentic retrieval: Handle multi-part questions
&lt;/h2&gt;

&lt;p&gt;Traditional retrieval typically searches for content relevant to a query. This works well for straightforward questions, but more complex questions may require multiple searches.&lt;/p&gt;

&lt;p&gt;Consider:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Compare our platform budget with the purchasing policy. Is annual prepayment permitted, and what approvals are required?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The application needs to retrieve the budget, find the policy, connect the relevant conditions, and generate an answer grounded in the available evidence.&lt;/p&gt;

&lt;p&gt;Agentic retrieval uses a foundation model to plan and refine retrieval across configured knowledge base retrievers. It can decompose a complex question into sub-queries, retrieve information iteratively, and assess whether enough evidence is available.&lt;/p&gt;

&lt;p&gt;This can help with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enterprise policy assistants&lt;/li&gt;
&lt;li&gt;Technical support&lt;/li&gt;
&lt;li&gt;Internal documentation search&lt;/li&gt;
&lt;li&gt;Cross-document comparisons&lt;/li&gt;
&lt;li&gt;Questions with multiple related parts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Agentic retrieval can improve the retrieval process, but it does not guarantee correct answers. Validate the results and citations before relying on them in production.&lt;/p&gt;

&lt;p&gt;Reference: &lt;a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-agentic-retrieve.html" rel="noopener noreferrer"&gt;Use agentic retrieval to query a knowledge base&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Demo architecture
&lt;/h2&gt;

&lt;p&gt;We'll create an enterprise policy assistant using three fictional documents.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Enterprise Documents
       |
       v
Amazon S3
       |
       v
Amazon Bedrock Managed Knowledge Base
       |
       v
Document Parsing and Indexing
       |
       v
Agentic Retrieval
       |
       +--&amp;gt; Team ownership
       +--&amp;gt; Cloud budget
       +--&amp;gt; Expense policy
       |
       v
Generated answer + source references
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Amazon Bedrock manages much of the underlying ingestion and retrieval infrastructure. The application still needs permissions, error handling, and security controls.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Build the Python demo
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;You'll need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An AWS account&lt;/li&gt;
&lt;li&gt;Access to Amazon Bedrock in a supported Region&lt;/li&gt;
&lt;li&gt;A Managed Knowledge Base&lt;/li&gt;
&lt;li&gt;An S3 bucket containing the sample documents&lt;/li&gt;
&lt;li&gt;An appropriate IAM identity and permissions&lt;/li&gt;
&lt;li&gt;Python 3 and Boto3&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 1: Create the project
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;enterprise-rag-demo/
├── documents/
│   ├── team-ownership.md
│   ├── cloud-budget.md
│   └── expense-policy.md
└── query_enterprise_kb.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Add sample documents
&lt;/h3&gt;

&lt;p&gt;Create &lt;code&gt;documents/team-ownership.md&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# ML Platform Team Ownership&lt;/span&gt;

The ML Platform team owns the internal machine learning
platform and its shared deployment infrastructure.

The team supports model deployment, platform monitoring,
and infrastructure reliability.

The team reports to the Engineering organization.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create &lt;code&gt;documents/cloud-budget.md&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# ML Platform Cloud Budget&lt;/span&gt;

The ML Platform team has an illustrative annual cloud
infrastructure budget of $120,000.

The budget covers approved compute, storage, networking,
monitoring, and platform infrastructure expenses.

Purchases must follow the company expense policy and
the organization's approval process.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create &lt;code&gt;documents/expense-policy.md&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Cloud Expense and Prepayment Policy&lt;/span&gt;

Annual cloud prepayment may be considered when the
purchase meets procurement requirements and has the
required financial approval.

The request must include the business justification,
contract terms, expected savings, and budget confirmation.

Having sufficient budget does not automatically approve
a purchase.

The responsible finance approver must review the request
before a commitment is made.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are fictional examples. The budget is not an AWS pricing estimate.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Upload documents to S3
&lt;/h3&gt;

&lt;p&gt;Create an S3 bucket in a supported Region and upload the three files to a prefix such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;s3://YOUR-BUCKET-NAME/enterprise-rag-demo/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;YOUR-BUCKET-NAME&lt;/code&gt; with your bucket name.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Create the Managed Knowledge Base
&lt;/h3&gt;

&lt;p&gt;Open the &lt;a href="https://console.aws.amazon.com/bedrock/" rel="noopener noreferrer"&gt;Amazon Bedrock console&lt;/a&gt; and:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to &lt;strong&gt;Knowledge Bases&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Create a Managed Knowledge Base.&lt;/li&gt;
&lt;li&gt;Configure the name and supported Region.&lt;/li&gt;
&lt;li&gt;Select Amazon S3 as the source.&lt;/li&gt;
&lt;li&gt;Configure the bucket or prefix containing your documents.&lt;/li&gt;
&lt;li&gt;Review the IAM permissions and role configuration.&lt;/li&gt;
&lt;li&gt;Complete creation and synchronize the data source.&lt;/li&gt;
&lt;li&gt;Wait for ingestion to finish successfully.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Save the knowledge base ID. We'll use it in the Python application.&lt;/p&gt;

&lt;p&gt;See the &lt;a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-build-managed.html" rel="noopener noreferrer"&gt;official setup guide&lt;/a&gt; for current requirements and console options.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Install Boto3
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python &lt;span class="nt"&gt;-m&lt;/span&gt; pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--upgrade&lt;/span&gt; boto3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Configure credentials through an appropriate IAM identity, CLI profile, or execution role.&lt;/p&gt;

&lt;p&gt;For a local AWS CLI setup, you can use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws configure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Avoid hardcoding AWS access keys in your application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 6: Query the knowledge base
&lt;/h3&gt;

&lt;p&gt;Create &lt;code&gt;query_enterprise_kb.py&lt;/code&gt;:&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="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&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;REGION&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AWS_REGION&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;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;KNOWLEDGE_BASE_ID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;KNOWLEDGE_BASE_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;client&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="n"&gt;REGION&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;question&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;Which team owns the ML platform, what is its annual &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cloud budget, and does the expense policy allow annual &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;prepayment? Explain the conditions and identify what &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;must happen before a commitment is made.&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;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;agentic_retrieve_stream&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&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;role&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&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;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="n"&gt;question&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="n"&gt;retrievers&lt;/span&gt;&lt;span class="o"&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;description&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;Enterprise policies and platform documents&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;configuration&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;knowledgeBase&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;knowledgeBaseId&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;KNOWLEDGE_BASE_ID&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;span class="n"&gt;agenticRetrieveConfiguration&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;foundationModelType&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;MANAGED&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;rerankingModelType&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;MANAGED&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="n"&gt;generateResponse&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;stream&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;responseEvent&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="nf"&gt;print&lt;/span&gt;&lt;span class="p"&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;responseEvent&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;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="p"&gt;),&lt;/span&gt;
            &lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="o"&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;flush&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;elif&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;traceEvent&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="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="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;[Retrieval trace event received]&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;result&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;result&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;result&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="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="s"&gt;--- Retrieved Sources ---&lt;/span&gt;&lt;span class="sh"&gt;"&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;index&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;enumerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;result&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;results&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="n"&gt;start&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;
        &lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;item&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;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="n"&gt;metadata&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;item&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;metadata&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="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="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Source &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;index&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="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;Retriever:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;item&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;sourceRetriever&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Metadata:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;metadata&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;Content:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;content&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;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="p"&gt;))&lt;/span&gt;

        &lt;span class="n"&gt;generated&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;result&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;generatedResponse&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="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="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;--- Citation Mappings ---&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;generated&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;citations&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;The example uses managed retrieval planning and reranking. The returned documents, response text, trace events, and citation mappings depend on the service configuration and available evidence.&lt;/p&gt;

&lt;p&gt;For production, send traces to structured logging rather than printing sensitive document contents.&lt;/p&gt;

&lt;p&gt;API reference: &lt;a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_AgenticRetrieveStream.html" rel="noopener noreferrer"&gt;AgenticRetrieveStream&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 7: Run the demo
&lt;/h3&gt;

&lt;p&gt;In PowerShell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$&lt;/span&gt;&lt;span class="nn"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nv"&gt;AWS_REGION&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"us-east-1"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nv"&gt;$&lt;/span&gt;&lt;span class="nn"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nv"&gt;KNOWLEDGE_BASE_ID&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"YOUR_KNOWLEDGE_BASE_ID"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;python&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;query_enterprise_kb.py&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Bash:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;AWS_REGION&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"us-east-1"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;KNOWLEDGE_BASE_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"YOUR_KNOWLEDGE_BASE_ID"&lt;/span&gt;

python query_enterprise_kb.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use your actual knowledge base ID and the Region in which it was created. Ensure the identity running the script has the required permissions for the agentic retrieval API and configured managed functionality.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. What should the answer contain?
&lt;/h2&gt;

&lt;p&gt;Based on the sample documents, a successful response should identify:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Team ownership:&lt;/strong&gt; The ML Platform team owns the internal ML platform.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Annual budget:&lt;/strong&gt; The illustrative annual cloud infrastructure budget is $120,000.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prepayment policy:&lt;/strong&gt; Annual prepayment may be considered, but is not automatically approved.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Required conditions:&lt;/strong&gt; The request needs a business justification, contract terms, expected savings, budget confirmation, and financial review before a commitment is made.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The response should include source references so that users can verify important claims.&lt;/p&gt;

&lt;p&gt;This is the expected result based on the example documents, not output from a live AWS execution. Run the demo and validate the actual response and citations in your environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Production considerations
&lt;/h2&gt;

&lt;p&gt;Before deploying an enterprise RAG application, consider these areas.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Access control:&lt;/strong&gt; Ensure users retrieve only documents they are authorized to access. Test supported access-control mechanisms and identity behavior.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data freshness:&lt;/strong&gt; Monitor synchronization and ingestion failures.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Grounded answers:&lt;/strong&gt; Require evidence for important claims and allow the assistant to say when information is missing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt injection:&lt;/strong&gt; Treat retrieved content as untrusted input. A document must not be able to override your application's security rules.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Observability:&lt;/strong&gt; Track failed queries, retrieval traces, latency, and source coverage while protecting sensitive information.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cost and latency:&lt;/strong&gt; Agentic retrieval may involve multiple retrieval steps. Measure whether the additional work improves results enough to justify the cost.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Evaluation:&lt;/strong&gt; Test against representative questions with known answers and expected sources. Measure answer accuracy, citation quality, and retrieval completeness.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. When should you use agentic retrieval?
&lt;/h2&gt;

&lt;p&gt;Use agentic retrieval when questions need information from multiple sources or involve several related steps.&lt;/p&gt;

&lt;p&gt;For straightforward lookups, conventional retrieval may be simpler and faster. Compare both approaches with a representative evaluation set before choosing the production design.&lt;/p&gt;

&lt;p&gt;Next, you can extend this demo by adding a second supported data connector, testing documents containing tables and diagrams, comparing retrieval approaches, and creating a simple web interface for employees.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Enterprise RAG is about more than searching document chunks. It requires connecting knowledge, processing documents, retrieving the right evidence, and generating answers that users can verify.&lt;/p&gt;

&lt;p&gt;Amazon Bedrock Managed Knowledge Base brings native data connectors, Smart Parsing, managed indexing, and agentic retrieval into an integrated experience.&lt;/p&gt;

&lt;p&gt;The demo illustrates how Python can query a knowledge base, retrieve information across documents, and expose source references for validation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My takeaway:&lt;/strong&gt; Build AI assistants that do not just answer questions—they find evidence, connect information, and make their conclusions verifiable.&lt;/p&gt;

&lt;p&gt;What would you build first: an internal policy assistant, a technical documentation assistant, or a customer support knowledge agent?&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-build-managed.html" rel="noopener noreferrer"&gt;Amazon Bedrock Managed Knowledge Base&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/blogs/aws/introducing-amazon-bedrock-managed-knowledge-base-for-faster-more-accurate-enterprise-ai-applications/" rel="noopener noreferrer"&gt;Managed Knowledge Base announcement&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-agentic-retrieve.html" rel="noopener noreferrer"&gt;Agentic retrieval guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_AgenticRetrieveStream.html" rel="noopener noreferrer"&gt;AgenticRetrieveStream API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/bedrock/pricing/" rel="noopener noreferrer"&gt;Amazon Bedrock pricing&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>generativeai</category>
      <category>awsbedrock</category>
    </item>
  </channel>
</rss>
