<?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: TechEazy Consulting</title>
    <description>The latest articles on DEV Community by TechEazy Consulting (@techeazy_consulting).</description>
    <link>https://dev.to/techeazy_consulting</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%2F2041193%2Fa2134f35-95c1-4e56-aa5a-74d5480d53df.jpg</url>
      <title>DEV Community: TechEazy Consulting</title>
      <link>https://dev.to/techeazy_consulting</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/techeazy_consulting"/>
    <language>en</language>
    <item>
      <title>Why RAG If You Already Have a Database? Explained Simply 🔎</title>
      <dc:creator>TechEazy Consulting</dc:creator>
      <pubDate>Wed, 25 Nov 2026 07:57:16 +0000</pubDate>
      <link>https://dev.to/techeazy_consulting/why-rag-if-you-already-have-a-database-explained-simply-e82</link>
      <guid>https://dev.to/techeazy_consulting/why-rag-if-you-already-have-a-database-explained-simply-e82</guid>
      <description>&lt;p&gt;Your company already keeps its HR policies in a database. An employee types: &lt;em&gt;"Can I carry over my unused holidays to next year?"&lt;/em&gt; The answer is sitting right there in a table, and the search box still returns nothing useful.&lt;/p&gt;

&lt;p&gt;This post explains why that happens, what RAG (Retrieval-Augmented Generation) adds on top of your database, and when you don't need it at all. You'll see a small before-and-after in Python.&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR 📌
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;A database finds what you ask for exactly.&lt;/strong&gt; It matches words, numbers and IDs. It doesn't know what a sentence &lt;em&gt;means&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;People ask in their own words&lt;/strong&gt;, which are often different from the words in your documents.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RAG adds two things:&lt;/strong&gt; a search that matches by meaning, and an LLM that reads the found text and writes a plain answer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RAG still uses a database.&lt;/strong&gt; It doesn't replace yours; it reads from it in a smarter way.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;For counts, totals and exact lookups, plain SQL is still the right tool.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The idea in plain words 💡
&lt;/h2&gt;

&lt;p&gt;A database is a very fast, very literal librarian. Ask for the book with ID &lt;code&gt;4021&lt;/code&gt; and you get it instantly. Ask for "rows where the text contains &lt;em&gt;carry over&lt;/em&gt;" and it checks every row for those exact letters. If the policy says &lt;em&gt;"rolled forward"&lt;/em&gt; instead, the librarian shrugs. It isn't being lazy; it was never built to understand language.&lt;/p&gt;

&lt;p&gt;Here is our running example. The table holds four policy lines:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;id&lt;/th&gt;
&lt;th&gt;text&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Up to 5 days of unused annual leave may be rolled forward into the next calendar year.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;The office is closed on public holidays listed in the yearly calendar.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Sick leave requires a doctor's note after 3 consecutive days.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Employees can work from home up to 2 days per week with manager approval.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The employee says "carry over" and "holidays". The policy says "rolled forward" and "annual leave". Same meaning, zero shared words. Worse, the word "holidays" &lt;em&gt;does&lt;/em&gt; appear, but in the wrong row (public holidays).&lt;/p&gt;

&lt;p&gt;You might say: "Postgres has full-text search." It helps. Postgres can reduce words to a base form, so &lt;code&gt;rats&lt;/code&gt; matches &lt;code&gt;rat&lt;/code&gt;, and it can rank results by relevance. But matching &lt;em&gt;"carry over"&lt;/em&gt; to &lt;em&gt;"rolled forward"&lt;/em&gt; needs a synonym dictionary that someone writes and maintains by hand. Nobody can list every way a person might phrase a question.&lt;/p&gt;

&lt;p&gt;That gap is what RAG fills. Three terms first:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Embedding:&lt;/strong&gt; a list of numbers that represents the meaning of a piece of text. Texts with similar meaning get similar numbers, even when the words differ.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Similarity search:&lt;/strong&gt; comparing those number lists to find the closest ones. A common measure is &lt;em&gt;cosine similarity&lt;/em&gt;: a score where higher means "closer in meaning".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LLM (large language model):&lt;/strong&gt; a model like Claude or GPT that reads text and writes text.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;RAG&lt;/strong&gt; = &lt;strong&gt;R&lt;/strong&gt;etrieve the most relevant text by meaning, &lt;strong&gt;A&lt;/strong&gt;ugment (add) it to the question, and let the LLM &lt;strong&gt;G&lt;/strong&gt;enerate an answer from it. The idea was introduced in a 2020 paper by Lewis and colleagues at Facebook AI Research. Their main point still holds: a model's built-in knowledge is hard to update and hard to check, while text you fetch from a store can be updated any time and shown as evidence.&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%2Ftecheazyconsulting.com%2F_astro%2Fvisual-01.CLcfIQDi_1sbAH5.svg" 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%2Ftecheazyconsulting.com%2F_astro%2Fvisual-01.CLcfIQDi_1sbAH5.svg" alt="Notice the database is still there on the left. RAG changes how you search it and adds a reader at the end." width="100" height="13.712026338145487"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Notice the database is still there on the left. RAG changes how you search it and adds a reader at the end.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Step by step 🛠️
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Store: save the text and its meaning
&lt;/h3&gt;

&lt;p&gt;You keep your policy lines as before. Next to each one, you also save its embedding. This happens once, when a policy is added or changed, not on every question. The numbers can live in a dedicated vector database or in the database you already run (Postgres with the &lt;code&gt;pgvector&lt;/code&gt; extension, for example).&lt;/p&gt;
&lt;h3&gt;
  
  
  Retrieve: search by meaning, not by letters
&lt;/h3&gt;

&lt;p&gt;When a question arrives, you turn it into an embedding using the same model, then pick the stored lines whose numbers are closest. "Carry over my unused holidays" lands near "unused annual leave rolled forward", because the model learned from huge amounts of text that these phrases are used the same way.&lt;/p&gt;
&lt;h3&gt;
  
  
  Generate: let the LLM write the answer
&lt;/h3&gt;

&lt;p&gt;The retrieved lines still aren't an answer; they're evidence. You pass them to an LLM with an instruction like "answer using only this text, and say you don't know if it isn't covered." The employee gets: &lt;em&gt;"Yes, up to 5 days of unused annual leave can roll into next year."&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  The code: before and after 🧑‍💻
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Before: plain SQL.&lt;/strong&gt; This runs as-is with Python's built-in &lt;code&gt;sqlite3&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="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sqlite3&lt;/span&gt;

&lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sqlite3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;":memory:"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"CREATE TABLE policy (id INTEGER, text TEXT)"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;executemany&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"INSERT INTO policy VALUES (?, ?)"&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="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Up to 5 days of unused annual leave may be rolled forward into the next calendar year."&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="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"The office is closed on public holidays listed in the yearly calendar."&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="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Sick leave requires a doctor's note after 3 consecutive days."&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="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Employees can work from home up to 2 days per week with manager approval."&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="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;word&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"carry over"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"holidays"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;rows&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"SELECT id, text FROM policy WHERE text LIKE ?"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"%{word}%"&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="nf"&gt;fetchall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"LIKE '%{word}%' -&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LIKE '%carry over%' -&amp;gt; []
LIKE '%holidays%' -&amp;gt; [(2, 'The office is closed on public holidays listed in the yearly calendar.')]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One search finds nothing. The other finds the wrong policy. The database did exactly what it was told.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;After: RAG.&lt;/strong&gt; It uses &lt;code&gt;sentence-transformers&lt;/code&gt; for free local embeddings and the Anthropic SDK for the LLM (you need an &lt;code&gt;ANTHROPIC_API_KEY&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="c1"&gt;# pip install sentence-transformers anthropic&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sentence_transformers&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;SentenceTransformer&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;anthropic&lt;/span&gt;

&lt;span class="n"&gt;policies&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s2"&gt;"Up to 5 days of unused annual leave may be rolled forward into the next calendar year."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"The office is closed on public holidays listed in the yearly calendar."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"Sick leave requires a doctor's note after 3 consecutive days."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"Employees can work from home up to 2 days per week with manager approval."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# 1. Store: turn every policy line into an embedding, once.&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;SentenceTransformer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"all-MiniLM-L6-v2"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# small, free, runs on a laptop&lt;/span&gt;
&lt;span class="n"&gt;policy_vectors&lt;/span&gt; &lt;span class="o"&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;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;policies&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# 2. Retrieve: embed the question and find the closest policies by meaning.&lt;/span&gt;
&lt;span class="n"&gt;question&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Can I carry over my unused holidays to next year?"&lt;/span&gt;
&lt;span class="n"&gt;question_vector&lt;/span&gt; &lt;span class="o"&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;encode&lt;/span&gt;&lt;span class="p"&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="n"&gt;scores&lt;/span&gt; &lt;span class="o"&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;similarity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;question_vector&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;policy_vectors&lt;/span&gt;&lt;span class="p"&gt;)&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="c1"&gt;# cosine similarity&lt;/span&gt;
&lt;span class="n"&gt;top&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;scores&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;argsort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;descending&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&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="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;context&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"\n"&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;policies&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&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;i&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;top&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;i&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{float(scores[i]):.2f}  {policies[i]}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# 3. Generate: the LLM answers from the found text only.&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;anthropic&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Anthropic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# reads ANTHROPIC_API_KEY from your environment&lt;/span&gt;
&lt;span class="n"&gt;reply&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="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&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="s2"&gt;"claude-haiku-5-5"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;200&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="s2"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Answer using only this policy text. If it isn't covered, say you don't know.\n\n"&lt;/span&gt;
                   &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Policy:\n{context}\n\nQuestion: {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="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;reply&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="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The two things to compare: the &lt;code&gt;WHERE text LIKE&lt;/code&gt; line became &lt;code&gt;model.similarity(...)&lt;/code&gt;, and a new step hands the result to an LLM. Your data didn't change. Only the way you search it and present it did.&lt;/p&gt;

&lt;h2&gt;
  
  
  When NOT to use RAG ⚠️
&lt;/h2&gt;

&lt;p&gt;Here's the honest part. "The database can't solve it, AI can" is true only for a specific kind of question.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Counts, sums and filters belong to SQL.&lt;/strong&gt; "How many people took sick leave in March?" needs &lt;code&gt;COUNT(*)&lt;/code&gt;, not a language model guessing from a few paragraphs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exact lookups belong to SQL.&lt;/strong&gt; Employee ID, order number, invoice date: an index answers in milliseconds and never gets it "nearly right".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Small documents may not need retrieval.&lt;/strong&gt; If all your policies fit in one prompt, just send them all to the LLM and skip the search step.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Similar isn't the same as correct.&lt;/strong&gt; Meaning-based search can return the 2023 policy and the 2025 update side by side. Keep dates or versions in your data and filter on them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The LLM can still invent things.&lt;/strong&gt; Tell it to answer only from the given text, show the source line to the user, and let it say "I don't know".&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A good rule: if the question has an exact answer in a column, use SQL. If the answer is buried in sentences and people will phrase it their own way, consider RAG.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recap 🎯
&lt;/h2&gt;

&lt;p&gt;Your database stores the answer; RAG helps someone &lt;em&gt;find and read&lt;/em&gt; it when they don't know your exact wording. It doesn't replace the database, it sits on top of it. Next step: run the "after" script, then ask it something your policies don't cover (like "Is there a pet insurance plan?") and check that it says it doesn't know.&lt;/p&gt;

&lt;p&gt;What's a question your users ask that your current search box can't handle? Tell me in the comments 👇&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2005.11401" rel="noopener noreferrer"&gt;Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (Lewis et al., 2020)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.openai.com/api/docs/guides/embeddings" rel="noopener noreferrer"&gt;OpenAI: Vector embeddings guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.postgresql.org/docs/current/textsearch-intro.html" rel="noopener noreferrer"&gt;PostgreSQL: Introduction to full text search&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://sbert.net/docs/quickstart.html" rel="noopener noreferrer"&gt;Sentence Transformers documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://platform.claude.com/docs/en/models/overview" rel="noopener noreferrer"&gt;Anthropic: Models overview&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;This post first appeared on TechEazy Consulting: &lt;a href="https://techeazyconsulting.com/why-rag-if-you-have-a-database" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/why-rag-if-you-have-a-database&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Keep going with the course chapter this post comes from: &lt;a href="https://techeazyconsulting.com/courses/agentic-ai-from-scratch-python/how-rag-works-retrieve-generate?source=devto-why-rag-if-you-have-a-database&amp;amp;utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=why-rag-if-you-already-have-a-database-explained-simply" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/courses/agentic-ai-from-scratch-python/how-rag-works-retrieve-generate?source=devto-why-rag-if-you-have-a-database&amp;amp;utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=why-rag-if-you-already-have-a-database-explained-simply&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Want mentor-led help with the next step? See the program: &lt;a href="https://techeazyconsulting.com/programs/cloud-ai-solutions-architect?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=why-rag-if-you-already-have-a-database-explained-simply" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/programs/cloud-ai-solutions-architect?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=why-rag-if-you-already-have-a-database-explained-simply&lt;/a&gt;&lt;/p&gt;

</description>
      <category>database</category>
      <category>llm</category>
      <category>python</category>
      <category>rag</category>
    </item>
    <item>
      <title>How to Make Your Existing App Agentic (Without the Hype or a Rewrite) 🤖</title>
      <dc:creator>TechEazy Consulting</dc:creator>
      <pubDate>Wed, 25 Nov 2026 07:56:30 +0000</pubDate>
      <link>https://dev.to/techeazy_consulting/how-to-make-your-existing-app-agentic-without-the-hype-or-a-rewrite-3nce</link>
      <guid>https://dev.to/techeazy_consulting/how-to-make-your-existing-app-agentic-without-the-hype-or-a-rewrite-3nce</guid>
      <description>&lt;p&gt;Your manager just asked, "Can we make the app agentic?" 😅 You have a working app with tested functions, a database and real users. You don't want to throw any of that away.&lt;/p&gt;

&lt;p&gt;Good news: you shouldn't. An agent is not a new app. It's a small loop that lets a language model choose which of your &lt;strong&gt;existing&lt;/strong&gt; functions to call. By the end of this post you'll know where that loop belongs in your app, where it doesn't, and you'll have about 40 lines of Python that do it safely.&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR ⚡
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Find the fuzzy step.&lt;/strong&gt; Look for the one place where users ask in free text and the path through your code can't be predicted. Everything else stays normal code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wrap existing functions as tools.&lt;/strong&gt; Give each one a name, a clear description and an input schema. Don't rewrite them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add the loop, with a brake.&lt;/strong&gt; The model picks a tool, your code runs it, the result goes back, and this repeats. Add a hard limit on turns.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gate anything that changes data.&lt;/strong&gt; Read-only tools run freely. Refunds, deletes and emails need a human "yes".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Log every step.&lt;/strong&gt; If you can't replay what the agent did, you can't debug it or trust it.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  🧠 First, the honest part: agent or workflow?
&lt;/h2&gt;

&lt;p&gt;Anthropic's engineering team splits "agentic systems" into two kinds. A &lt;strong&gt;workflow&lt;/strong&gt; runs LLM calls and tools along code paths &lt;em&gt;you&lt;/em&gt; define. An &lt;strong&gt;agent&lt;/strong&gt; lets the model decide its own steps and which tools to use. Their advice is to start with the simplest thing that works. Often one well-written LLM call with good context is enough. Reach for an agent only when the number of steps genuinely can't be predicted.&lt;/p&gt;

&lt;p&gt;That's the "beyond hype" filter. Ask this about each feature:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Question&lt;/th&gt;
&lt;th&gt;If yes →&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Is the input already structured (a form, a button)?&lt;/td&gt;
&lt;td&gt;Keep normal code. No LLM.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Is it one fixed transformation (summarise, classify, extract)?&lt;/td&gt;
&lt;td&gt;One LLM call.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Is it a known sequence of steps?&lt;/td&gt;
&lt;td&gt;A workflow: your code decides the order.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Does the next step depend on what the last step found?&lt;/td&gt;
&lt;td&gt;An agent.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Our running example is &lt;strong&gt;ShopDesk&lt;/strong&gt;, a small e-commerce support app. It already has three functions: &lt;code&gt;get_order()&lt;/code&gt;, &lt;code&gt;search_faq()&lt;/code&gt; and &lt;code&gt;refund_order()&lt;/code&gt;. The checkout, the order pages and the admin screens all stay exactly as they are. Only one step fits the last row of the table: the support chat box. A message like &lt;em&gt;"my order 1042 hasn't arrived and I want my money back"&lt;/em&gt; needs a lookup first, and what happens next depends on the result.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔁 The loop in one picture
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ftecheazyconsulting.com%2F_astro%2Fvisual-01.C6b_u7M__RaNmK.svg" 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%2Ftecheazyconsulting.com%2F_astro%2Fvisual-01.C6b_u7M__RaNmK.svg" alt="The model only chooses. Your code runs every function, decides what needs approval and decides when the loop must stop." width="100" height="22.9567128409622"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The model only chooses. Your code runs every function, decides what needs approval and decides when the loop must stop.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🛠️ Step by step
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Find the fuzzy step
&lt;/h3&gt;

&lt;p&gt;Look in your app for &lt;code&gt;if "refund" in message&lt;/code&gt; style keyword routing, or long chains of &lt;code&gt;elif&lt;/code&gt;. Those are signs that a human question is being forced into a fixed path. In ShopDesk, that's the &lt;code&gt;/support&lt;/code&gt; endpoint, and that one handler is all we convert.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Wrap your existing functions as tools
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;tool&lt;/strong&gt; is a description the model reads: a name, a sentence explaining what it does and when to use it, and a JSON Schema for its inputs. The function behind it doesn't change. Anthropic's guide says to put as much care into this "agent-computer interface" as you would into a UI. Vague descriptions are the most common reason an agent picks the wrong tool.&lt;/p&gt;

&lt;p&gt;Write descriptions for a new colleague: say what the tool returns and when &lt;em&gt;not&lt;/em&gt; to use it. For example: "Look up an order by its numeric ID. Use before answering any question about delivery or refunds."&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Add the loop, with a brake
&lt;/h3&gt;

&lt;p&gt;With Claude's Messages API, you send your tools along with the conversation. When the model wants a tool, the response comes back with &lt;code&gt;stop_reason == "tool_use"&lt;/code&gt; and a &lt;code&gt;tool_use&lt;/code&gt; block holding the tool name, an &lt;code&gt;id&lt;/code&gt; and the &lt;code&gt;input&lt;/code&gt;. You run the function and send back a &lt;code&gt;tool_result&lt;/code&gt; block carrying the same &lt;code&gt;id&lt;/code&gt;. You repeat while &lt;code&gt;stop_reason&lt;/code&gt; is &lt;code&gt;"tool_use"&lt;/code&gt;. When it becomes &lt;code&gt;"end_turn"&lt;/code&gt;, the model has its final answer.&lt;/p&gt;

&lt;p&gt;The brake is a &lt;code&gt;MAX_TURNS&lt;/code&gt; constant. Without it, a confused model can call &lt;code&gt;get_order()&lt;/code&gt; forever while you pay for every call.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Gate anything that changes data
&lt;/h3&gt;

&lt;p&gt;Split tools into &lt;strong&gt;read&lt;/strong&gt; tools (&lt;code&gt;get_order&lt;/code&gt;, &lt;code&gt;search_faq&lt;/code&gt;) and &lt;strong&gt;write&lt;/strong&gt; tools (&lt;code&gt;refund_order&lt;/code&gt;). Read tools run immediately. Write tools go through an approval function first. In production that's a button in your admin panel; in the demo below it's &lt;code&gt;input()&lt;/code&gt;. If the human says no, you tell the model so, and it can explain that to the customer.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Log every step
&lt;/h3&gt;

&lt;p&gt;Print or store each tool name, its input and its result. When a customer complains, this log is the only way to see whether the model misread the request, picked the wrong tool or got bad data from your own function.&lt;/p&gt;

&lt;h2&gt;
  
  
  💻 The code: before and after
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Before:&lt;/strong&gt; the keyword router most apps start with.&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="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;support_reply&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;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="s2"&gt;"refund"&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&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;return&lt;/span&gt; &lt;span class="s2"&gt;"Please email refunds@shopdesk.example with your order ID."&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="s2"&gt;"where"&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="s2"&gt;"arrive"&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&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;return&lt;/span&gt; &lt;span class="s2"&gt;"Track your order on the Orders page."&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"Sorry, I didn't understand. Try 'refund' or 'where is my order'."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It never looks anything up, so every real question ends in "email us".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;After:&lt;/strong&gt; the same app, with the existing functions exposed as tools. Install the SDK with &lt;code&gt;pip install anthropic&lt;/code&gt; and set &lt;code&gt;ANTHROPIC_API_KEY&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="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;anthropic&lt;/span&gt;

&lt;span class="c1"&gt;# --- Your existing app code, unchanged ---&lt;/span&gt;
&lt;span class="no"&gt;ORDERS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"1042"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"lost in transit"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"total"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;59.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"paid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;True&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;get_order&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="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="no"&gt;ORDERS&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;order_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"error"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"not found"&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;search_faq&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&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="s2"&gt;"Lost parcels are refunded in full after 10 days."&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;refund_order&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="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="s2"&gt;"refunded"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"order_id"&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="c1"&gt;# --- New: describe them as tools ---&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;desc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;props&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="s2"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;desc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"input_schema"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"object"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"properties"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;props&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                             &lt;span class="s2"&gt;"required"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;props&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="no"&gt;ID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"order_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"string"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Numeric order ID, e.g. '1042'"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="no"&gt;TOOLS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nf"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"get_order"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Look up an order's status and total. Use before any delivery or refund answer."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;ID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nf"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"search_faq"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Search the help-centre policies."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"query"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"string"&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="nf"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"refund_order"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Refund an order in full. Only after checking the order and policy."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;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="no"&gt;FUNCS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"get_order"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;get_order&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"search_faq"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;search_faq&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"refund_order"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;refund_order&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="no"&gt;WRITE_TOOLS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"refund_order"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;   &lt;span class="c1"&gt;# these need a human "yes"&lt;/span&gt;
&lt;span class="no"&gt;MAX_TURNS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;                    &lt;span class="c1"&gt;# the brake&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;approved&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;args&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="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Approve {name}({args})? [y/N] "&lt;/span&gt;&lt;span class="p"&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="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"y"&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;support_agent&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;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;str&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;anthropic&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Anthropic&lt;/span&gt;&lt;span class="p"&gt;(&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="s2"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"content"&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;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;MAX_TURNS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;resp&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="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&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="s2"&gt;"claude-sonnet-5-5"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1024&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                      &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;TOOLS&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="n"&gt;messages&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;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stop_reason&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s2"&gt;"tool_use"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&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;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;messages&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="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"assistant"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;resp&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="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;results&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="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;block&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;resp&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="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s2"&gt;"tool_use"&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;if&lt;/span&gt; &lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;WRITE_TOOLS&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nf"&gt;approved&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"error"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"A human declined this action."&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;FUNCS&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"[log] {block.name}({block.input}) -&amp;gt; {output}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;results&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="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"tool_result"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"tool_use_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                            &lt;span class="s2"&gt;"content"&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;output&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;messages&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="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;results&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="s2"&gt;"Sorry, I couldn't finish that. A human agent will follow up."&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;support_agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Order 1042 never arrived. Can I get my money back?"&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;Three details matter here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The assistant's whole &lt;code&gt;resp.content&lt;/code&gt; goes back into &lt;code&gt;messages&lt;/code&gt; before the tool results. The model needs to see its own &lt;code&gt;tool_use&lt;/code&gt; request next to the matching &lt;code&gt;tool_result&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Every &lt;code&gt;tool_result&lt;/code&gt; carries the &lt;code&gt;tool_use_id&lt;/code&gt; of the call it answers.&lt;/li&gt;
&lt;li&gt;The final &lt;code&gt;return&lt;/code&gt; after the loop is the graceful exit when the brake trips.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A typical run looks up order 1042, checks the FAQ policy, asks you to approve the refund and then replies to the customer. Your three original functions didn't change at all. 🎉&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚠️ Pitfalls (and when &lt;em&gt;not&lt;/em&gt; to do this)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Making the whole app an agent.&lt;/strong&gt; Checkout, login and anything with a fixed sequence should stay deterministic code. They're faster, cheaper and testable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vague tool descriptions.&lt;/strong&gt; "Gets data" leads to wrong calls. Say what the tool returns, what the inputs look like and when to use it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No turn limit.&lt;/strong&gt; Agents trade cost and latency for flexibility, and a loop without a brake gives you all the cost and none of the flexibility.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trusting tool output blindly.&lt;/strong&gt; Your function might return &lt;code&gt;{"error": "not found"}&lt;/code&gt;. Make errors explicit so the model reports them instead of inventing an order status.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Letting the model act on money or data alone.&lt;/strong&gt; Keep a human approval step on write tools until your logs show the agent is reliable.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🚀 Recap and next step
&lt;/h2&gt;

&lt;p&gt;You don't convert an app into an agent; you convert &lt;strong&gt;one fuzzy step&lt;/strong&gt; and leave the rest as code. Wrap the functions you already have as tools, run them in a loop with a brake, and put a human in front of anything that writes data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Try next:&lt;/strong&gt; take your own app's messiest &lt;code&gt;if/elif&lt;/code&gt; handler, expose two &lt;em&gt;read-only&lt;/em&gt; functions as tools, and run the loop above with &lt;code&gt;WRITE_TOOLS&lt;/code&gt; empty. Watch the &lt;code&gt;[log]&lt;/code&gt; lines to see what the model chooses.&lt;/p&gt;

&lt;p&gt;💬 Which part of your app would you make agentic first, and which part would you never hand to a model? Tell me in the comments 👇&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.anthropic.com/research/building-effective-agents" rel="noopener noreferrer"&gt;Building effective agents (Anthropic Engineering)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://platform.claude.com/docs/en/agents-and-tools/tool-use/how-tool-use-works" rel="noopener noreferrer"&gt;How tool use works (Claude Platform docs)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://platform.claude.com/docs/agents-and-tools/tool-use/build-a-tool-using-agent" rel="noopener noreferrer"&gt;Build a tool-using agent (Claude Platform docs)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons" rel="noopener noreferrer"&gt;Stop reasons and fallback (Claude Platform docs)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;This post first appeared on TechEazy Consulting: &lt;a href="https://techeazyconsulting.com/make-existing-app-agentic" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/make-existing-app-agentic&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Keep going with the course chapter this post comes from: &lt;a href="https://techeazyconsulting.com/courses/building-ai-agents/tool-use-function-calling?source=devto-make-existing-app-agentic&amp;amp;utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=how-to-make-your-existing-app-agentic-without-the-hype-or-a-rewrite" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/courses/building-ai-agents/tool-use-function-calling?source=devto-make-existing-app-agentic&amp;amp;utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=how-to-make-your-existing-app-agentic-without-the-hype-or-a-rewrite&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Want mentor-led help with the next step? See the program: &lt;a href="https://techeazyconsulting.com/programs/cloud-ai-solutions-architect?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=how-to-make-your-existing-app-agentic-without-the-hype-or-a-rewrite" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/programs/cloud-ai-solutions-architect?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=how-to-make-your-existing-app-agentic-without-the-hype-or-a-rewrite&lt;/a&gt;&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>architecture</category>
      <category>python</category>
    </item>
    <item>
      <title>Lost on YouTube? The Order to Learn AI Engineering</title>
      <dc:creator>TechEazy Consulting</dc:creator>
      <pubDate>Tue, 24 Nov 2026 17:24:45 +0000</pubDate>
      <link>https://dev.to/techeazy_consulting/lost-on-youtube-the-order-to-learn-ai-engineering-4emj</link>
      <guid>https://dev.to/techeazy_consulting/lost-on-youtube-the-order-to-learn-ai-engineering-4emj</guid>
      <description>&lt;p&gt;You finish one tutorial with a chatbot, another with an autonomous agent, and a third with a deployment pipeline. Each demo works alone. When you try to combine them, you cannot tell whether the failure belongs to your code, the model, the data, or the environment.&lt;/p&gt;

&lt;p&gt;That confusion is usually an ordering problem. In our mentor’s view, AI engineering is best learned in three layers: build dependable software first, add bounded AI behavior second, and learn to operate the complete system third. Each layer gives you a way to diagnose the next one instead of asking AI to repair a system you do not yet understand.&lt;/p&gt;

&lt;h2&gt;
  
  
  The right sequence makes failures easier to locate
&lt;/h2&gt;

&lt;p&gt;AI engineering is not a collection of prompts. It is software engineering with a component that can return variable, incomplete, or unsuitable answers.&lt;/p&gt;

&lt;p&gt;That changes how you build, but it does not remove the need for clear inputs, explicit rules, tests, interfaces, logs, and recovery paths. If those foundations are missing, every defect starts to look like “the AI got it wrong.”&lt;/p&gt;

&lt;p&gt;Think of the roadmap as constructing a workshop. First, you learn to use and inspect the tools. Second, you design a controlled workflow. Third, you make the workshop safe to run repeatedly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visual — kind: diagram; diagram: flow&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Caption: Each learning stage creates the control needed for the next stage.&lt;/em&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Alt: Software foundations lead to bounded AI workflows, which lead to reliable operation.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart LR
    A[Software foundations] --&amp;gt; B[Bounded AI workflows]
    B --&amp;gt; C[Reliable operation]
    A --&amp;gt; D[Inspect code and data]
    B --&amp;gt; E[Inspect decisions and tool use]
    C --&amp;gt; F[Inspect runtime behavior]&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;This order is less exciting than beginning with a multi-agent demo. It is also more useful when the demo stops behaving as expected.&lt;/p&gt;

&lt;h2&gt;
  
  
  First: software foundations give AI a dependable boundary
&lt;/h2&gt;

&lt;p&gt;Begin by learning to turn a requirement into ordinary working software. That includes breaking a problem into functions, choosing data structures, validating inputs, handling errors, writing tests, and reading a stack trace.&lt;/p&gt;

&lt;p&gt;The named tool for this stage is &lt;strong&gt;Python&lt;/strong&gt;. Use it to build small programs whose behavior you can explain without referring to a model.&lt;/p&gt;

&lt;p&gt;For example, create a document intake program. It receives a record, checks that required fields are present, normalizes dates, rejects unsupported file types, and saves a clean result. None of those rules needs an AI decision.&lt;/p&gt;

&lt;p&gt;Only after that path works should you let a model suggest a category or summary. The deterministic path—the part expected to produce the same result for the same input—should remain separate from the probabilistic path, where outputs may vary.&lt;/p&gt;

&lt;h3&gt;
  
  
  What not to hand to AI at this stage
&lt;/h3&gt;

&lt;p&gt;Do not ask AI to decide what the program is supposed to do.&lt;/p&gt;

&lt;p&gt;AI can help draft a function, propose edge cases, or explain an error. You still own the requirement, the accepted inputs, the expected outputs, and the test that proves the behavior.&lt;/p&gt;

&lt;p&gt;If you cannot describe why a generated function is correct, it is not yet part of your engineering knowledge. Copying it into a project only moves the uncertainty from the chat window into the codebase.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visual — kind: card&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Caption: The engineer owns the contract while AI may assist with implementation details.&lt;/em&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Alt: A responsibility card separates engineer-owned requirements and verification from AI-assisted drafts and explanations.&lt;/em&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Engineer owns&lt;/th&gt;
&lt;th&gt;AI may assist with&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Defining accepted input&lt;/td&gt;
&lt;td&gt;Drafting parsing code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Choosing expected output&lt;/td&gt;
&lt;td&gt;Suggesting edge cases&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Setting failure behavior&lt;/td&gt;
&lt;td&gt;Explaining an error&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Verifying the result&lt;/td&gt;
&lt;td&gt;Proposing a test draft&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This is the foundation reinforced by &lt;strong&gt;Full Stack with AI&lt;/strong&gt;. The important lesson is not merely how to connect a user interface to a service. It is how data, validation, application logic, storage, and AI-assisted behavior meet at explicit boundaries.&lt;/p&gt;

&lt;p&gt;A useful stage-one checkpoint is simple: when a result is wrong, you can identify the function, input, or rule responsible. If your only debugging method is to paste the entire program into an AI assistant, stay with this layer a little longer.&lt;/p&gt;
&lt;h2&gt;
  
  
  Second: bounded workflows turn model output into system behavior
&lt;/h2&gt;

&lt;p&gt;Once you can build a conventional application, learn how an AI component participates in a workflow without controlling the whole system.&lt;/p&gt;

&lt;p&gt;The named tool for this stage is &lt;strong&gt;FastAPI&lt;/strong&gt;. Use it to place a clear interface around an AI-assisted capability: defined input enters, a structured result leaves, and failures have visible handling.&lt;/p&gt;

&lt;p&gt;Suppose you are building an internal request router. A request arrives, the system validates its fields, and the model proposes a category. The application then checks that the category belongs to an allowed set before choosing the next step.&lt;/p&gt;

&lt;p&gt;The model may recommend. The application must constrain.&lt;/p&gt;

&lt;p&gt;This distinction prepares you for agentic systems. An agent is not simply a chatbot with more freedom; it is a model participating in a loop that can select actions, inspect results, and continue toward a goal. Every additional action expands the number of ways the workflow can fail.&lt;/p&gt;
&lt;h3&gt;
  
  
  What not to hand to AI at this stage
&lt;/h3&gt;

&lt;p&gt;Do not let the model silently invent permissions, business rules, or completion criteria.&lt;/p&gt;

&lt;p&gt;If an action changes data, contacts an external system, or cannot be easily reversed, the surrounding application should decide whether that action is allowed. The model should receive only the tools and context required for the current task.&lt;/p&gt;

&lt;p&gt;Also avoid treating a fluent answer as proof of completion. A workflow needs observable evidence: a valid record was created, an expected field changed, or a required check passed. Text that says “done” is not the same as a verified state.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visual — kind: diagram; diagram: sequence&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Caption: The application validates both the request and the model’s proposed action before execution.&lt;/em&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Alt: A request passes through input validation, model proposal, permission checks, execution, and result verification.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;sequenceDiagram
    participant U as Request
    participant A as Application
    participant M as Model
    participant T as Allowed action

    U-&amp;gt;&amp;gt;A: Submit structured input
    A-&amp;gt;&amp;gt;A: Validate input
    A-&amp;gt;&amp;gt;M: Ask for a proposed action
    M-&amp;gt;&amp;gt;A: Return proposal
    A-&amp;gt;&amp;gt;A: Check rules and permission
    A-&amp;gt;&amp;gt;T: Execute allowed action
    T-&amp;gt;&amp;gt;A: Return result
    A-&amp;gt;&amp;gt;A: Verify completion&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;This is where &lt;strong&gt;Agentic AI Engineering&lt;/strong&gt; fits in the sequence. The focus should be reasoning about state, tool boundaries, retries, approval points, and verification—not collecting agent patterns before you can inspect their behavior.&lt;/p&gt;

&lt;p&gt;A strong stage-two project has at least one refusal path, one recovery path, and one action that requires explicit approval. Those cases teach more than a smooth demonstration because they force you to define where model authority ends.&lt;/p&gt;

&lt;h2&gt;
  
  
  Third: operations make a working project trustworthy
&lt;/h2&gt;

&lt;p&gt;A project that runs on your machine is an experiment. The next layer is learning how to run it consistently, inspect it when it fails, and change it without losing control.&lt;/p&gt;

&lt;p&gt;The named tool for this stage is &lt;strong&gt;Docker&lt;/strong&gt;. Use it to package the application and its runtime requirements into a repeatable unit.&lt;/p&gt;

&lt;p&gt;Return to the request router. It now has application code, an AI-assisted classification step, validation rules, and a record of completed actions. The operational question is no longer just “Does it work?” It becomes “Can another environment run the same system, and can we understand what happened when one request fails?”&lt;/p&gt;

&lt;p&gt;That requires configuration management, health checks, logs, controlled releases, and recovery planning. AI can assist with drafts and diagnosis, but the operational contract remains yours.&lt;/p&gt;

&lt;h3&gt;
  
  
  What not to hand to AI at this stage
&lt;/h3&gt;

&lt;p&gt;Do not give AI unreviewed control over production changes, credentials, destructive commands, or rollback decisions.&lt;/p&gt;

&lt;p&gt;A generated deployment file may look plausible while carrying the wrong port, missing a health check, or assuming a resource that does not exist. Review it as infrastructure, not prose.&lt;/p&gt;

&lt;p&gt;The same rule applies during incidents. AI may summarize logs or suggest a cause. An engineer must verify the evidence, judge the impact, choose the response, and confirm recovery.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visual — kind: diagram; diagram: comparison&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Caption: Operational assistance remains inside engineer-controlled release and recovery decisions.&lt;/em&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Alt: AI can draft and analyze, while the engineer approves changes, protects access, and verifies recovery.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart TB
    A[Application change] --&amp;gt; B[AI-assisted draft]
    B --&amp;gt; C[Engineer review]
    C --&amp;gt; D[Controlled release]
    D --&amp;gt; E[Runtime evidence]
    E --&amp;gt; F[AI-assisted analysis]
    F --&amp;gt; G[Engineer decision]
    G --&amp;gt; H[Verified recovery]&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;&lt;strong&gt;DevOps with AI&lt;/strong&gt; belongs here because AI assistance becomes more valuable after you understand the system being operated. You can judge whether a suggestion matches the application, the environment, and the evidence in front of you.&lt;/p&gt;

&lt;p&gt;The professional skill is not accepting changes faster. It is reducing uncertainty without surrendering responsibility.&lt;/p&gt;

&lt;h2&gt;
  
  
  One project can carry you through all three stages
&lt;/h2&gt;

&lt;p&gt;You do not need a new project for every layer. A single project can grow with your understanding.&lt;/p&gt;

&lt;p&gt;Start with a deterministic request intake program. Add an AI-assisted classification step behind a validated interface. Then package the complete application, record meaningful runtime events, and rehearse how you would recover from a failed change.&lt;/p&gt;

&lt;p&gt;At each stage, keep an engineering journal with three questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What did I expect the system to do?&lt;/li&gt;
&lt;li&gt;What evidence shows what it actually did?&lt;/li&gt;
&lt;li&gt;Which decision still belongs to me?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This produces a more useful learning record than a folder of disconnected demos. It shows how your decisions changed as the system gained uncertainty, autonomy, and operational responsibility.&lt;/p&gt;

&lt;p&gt;The mentor-led sequence—&lt;strong&gt;Full Stack with AI&lt;/strong&gt;, &lt;strong&gt;Agentic AI Engineering&lt;/strong&gt;, then &lt;strong&gt;DevOps with AI&lt;/strong&gt;—mirrors that progression. The course names describe different areas, but the deeper connection is ownership: build the system, bound its decisions, and operate it responsibly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Learn ordinary software behavior before adding variable AI behavior.&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;Python&lt;/strong&gt; first to master logic, data, validation, errors, and tests.&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;FastAPI&lt;/strong&gt; second to place explicit boundaries around AI-assisted workflows.&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;Docker&lt;/strong&gt; third to make the complete system repeatable and inspectable.&lt;/li&gt;
&lt;li&gt;Let AI assist with drafts, explanations, and analysis; do not hand it requirements, permissions, irreversible actions, or final verification.&lt;/li&gt;
&lt;li&gt;Treat agentic behavior as controlled application behavior, not as a substitute for application design.&lt;/li&gt;
&lt;li&gt;Grow one project through the three layers so that each new capability rests on something you can already debug.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This roadmap settles the learning order, not the finish line. The systems you build will differ in data, risk, and operational needs, so each project still requires its own boundaries, evidence, and engineering judgment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build it live: the 12–13 December workshop
&lt;/h2&gt;

&lt;p&gt;Want to see this order in practice? Join our live, hands-on bootcamp workshop on Saturday 12 and Sunday 13 December, 11:00–13:00 IST each day. You start from a plain help-desk app, add an LLM, make it answer from your documents with sources, then give it tools and an agent loop, coding along in Colab.&lt;/p&gt;

&lt;p&gt;Register here: &lt;a href="https://techeazyconsulting.com/workshops/turn-your-app-agentic?source=devto-lost-on-youtube" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/workshops/turn-your-app-agentic?source=devto-lost-on-youtube&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;This post first appeared on TechEazy Consulting: &lt;a href="https://techeazyconsulting.com/lost-on-youtube-the-order-to-learn-ai-engineering" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/lost-on-youtube-the-order-to-learn-ai-engineering&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Keep going with the course chapter this post comes from: &lt;a href="https://techeazyconsulting.com/courses/agentic-ai-from-scratch-python/session-01" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/courses/agentic-ai-from-scratch-python/session-01&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Want mentor-led help with the next step? See the program: &lt;a href="https://techeazyconsulting.com/programs/forward-deployed-engineer" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/programs/forward-deployed-engineer&lt;/a&gt;&lt;/p&gt;

</description>
      <category>career</category>
      <category>beginners</category>
      <category>ai</category>
      <category>learning</category>
    </item>
    <item>
      <title>How to host a static page on S3 that calls your Lambda API, and tag it for later</title>
      <dc:creator>TechEazy Consulting</dc:creator>
      <pubDate>Mon, 23 Nov 2026 10:00:38 +0000</pubDate>
      <link>https://dev.to/techeazy_consulting/how-to-host-a-static-page-on-s3-that-calls-your-lambda-api-and-tag-it-for-later-4n10</link>
      <guid>https://dev.to/techeazy_consulting/how-to-host-a-static-page-on-s3-that-calls-your-lambda-api-and-tag-it-for-later-4n10</guid>
      <description>&lt;p&gt;You have a working notes API. A &lt;code&gt;curl&lt;/code&gt; command lists your notes, and a POST adds one. Now you want an ordinary web page that anyone can open, and you want to be able to find every piece of it again when you tear it down. The obvious route is to upload an HTML file and point it at the function. That route fails in three ways. The browser refuses to hand the API's answers to the page. A hostile note runs script in every visitor's browser. Later, a search for your resources misses half of what you made. This article claims that shipping the page takes four decisions, made in order. Split the app into two halves joined by one URL. Render every note as text. Allow exactly one origin through CORS. Tag at creation time while knowing what tags will miss. Get those four right and the page works on the first try and comes down cleanly.&lt;/p&gt;

&lt;h2&gt;
  
  
  The page and the API are two independent halves
&lt;/h2&gt;

&lt;p&gt;The finished application has two halves that never touch directly. S3, the storage service, holds one file, &lt;code&gt;index.html&lt;/code&gt;, and serves it from a &lt;em&gt;website endpoint&lt;/em&gt;. That is the address a bucket's static website is served from. In the Region &lt;code&gt;ap-south-1&lt;/code&gt; it takes the form &lt;code&gt;&amp;lt;bucket&amp;gt;.s3-website.ap-south-1.amazonaws.com&lt;/code&gt; with the &lt;code&gt;http&lt;/code&gt; scheme in front.&lt;/p&gt;

&lt;p&gt;The browser fetches that page once. From then on, the page's script talks straight to the Lambda &lt;em&gt;function URL&lt;/em&gt;, the HTTPS address that invokes your function. The function reads and writes the DynamoDB table &lt;code&gt;hoc-notes&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdm1jfwnz0r9z14k6k2qq.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%2Fdm1jfwnz0r9z14k6k2qq.png" alt="Browser loads index.html from S3, then calls the function URL, which reaches Lambda and the table" width="799" height="134"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The page loads once from S3, then the browser calls the function URL directly&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;S3 never sees a note, and the function never serves HTML. The two halves are joined in exactly two places: the function URL written into the page, and the page's origin written into the function's CORS setting.&lt;/p&gt;

&lt;p&gt;Think of it as a shop window and a stockroom with one hatch between them. You can rebuild either side as long as the hatch stays where both expect it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Confirm the API answers before you build anything
&lt;/h2&gt;

&lt;p&gt;Start from the API. You need the function &lt;code&gt;hoc-notes-api&lt;/code&gt; with its function URL, its role &lt;code&gt;hoc-notes-api-role&lt;/code&gt;, and the &lt;code&gt;hoc-notes&lt;/code&gt; table. If you are starting without them, rebuild the API first; nothing below works without it.&lt;/p&gt;

&lt;p&gt;If you "parked" the function earlier to stop traffic, undo the exact parking you used. Each kind is reversed only by its own reverse:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Parked with reserved concurrency set to &lt;code&gt;0&lt;/code&gt;:&lt;/strong&gt; remove that setting with &lt;code&gt;aws lambda delete-function-concurrency --function-name hoc-notes-api&lt;/code&gt;. Deleting the reserved concurrency configuration reactivates the URL. Changing the auth type does not.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parked by switching the URL's auth type to &lt;code&gt;AWS_IAM&lt;/code&gt;:&lt;/strong&gt; set it back to &lt;code&gt;NONE&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then check from a terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -s &lt;span class="s2"&gt;"$URL"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see your notes as JSON. If you don't, fix that before you go further. A page cannot succeed where &lt;code&gt;curl&lt;/code&gt; fails.&lt;/p&gt;

&lt;h2&gt;
  
  
  Write the page so a note can never become code
&lt;/h2&gt;

&lt;p&gt;The page is a form, a message line and a list. Its script carries two decisions worth understanding. Here is the heart of it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;maxlength&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"500"&lt;/span&gt; &lt;span class="na"&gt;required&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;FUNCTION_URL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;your function URL&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;loadNotes&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;FUNCTION_URL&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&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;json&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;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replaceChildren&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;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;note&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;notes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"li"&lt;/span&gt;&lt;span class="p"&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="n"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;note&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="n"&gt;note&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// never innerHTML&lt;/span&gt;
      &lt;span class="n"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;appendChild&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="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The submit handler sends a &lt;code&gt;POST&lt;/code&gt; with a &lt;code&gt;content-type: application/json&lt;/code&gt; header and a body of &lt;code&gt;{"text": ...}&lt;/code&gt;. It then shows either "Saved." or the error the API returned.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;maxlength="500"&lt;/code&gt; is a convenience, not a defence.&lt;/strong&gt; It stops someone typing in this page. It does nothing to a &lt;code&gt;curl&lt;/code&gt; request, which is why the function checks the length again. Every rule that matters is enforced on the server. The browser copy only saves a round trip.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;textContent&lt;/code&gt;, not &lt;code&gt;innerHTML&lt;/code&gt;.&lt;/strong&gt; Picture the loop written as &lt;code&gt;item.innerHTML = note.text&lt;/code&gt;, and someone posting this note with &lt;code&gt;curl&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="na"&gt;x&lt;/span&gt; &lt;span class="na"&gt;onerror&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"alert(document.cookie)"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The API stores it correctly, because to the API it is just text. But &lt;code&gt;innerHTML&lt;/code&gt; parses it as HTML. The broken image fails to load, and its &lt;code&gt;onerror&lt;/code&gt; handler runs in every visitor's browser. This is cross-site scripting: an attacker's script running inside your page. With &lt;code&gt;textContent&lt;/code&gt;, the browser shows those characters literally and runs nothing.&lt;/p&gt;

&lt;p&gt;Think of user data as a quotation: &lt;code&gt;textContent&lt;/code&gt; puts it in quotation marks.&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%2Fbzdxc06cgm2z9yzf2l7g.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%2Fbzdxc06cgm2z9yzf2l7g.png" alt="textContent shows a hostile note as text; innerHTML parses it and runs its script" width="799" height="229"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The same hostile note is harmless as text and runs as code when parsed as HTML&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Publish the bucket as a website, tagged from the start
&lt;/h2&gt;

&lt;p&gt;Create a new bucket named &lt;code&gt;hoc-site-&amp;lt;your-initials&amp;gt;-&amp;lt;random-digits&amp;gt;&lt;/code&gt; in the same Region as the function. While you create it, give it the tag key &lt;code&gt;project&lt;/code&gt; with the value &lt;code&gt;hands-on-cloud&lt;/code&gt;. Tag searches are case sensitive, so &lt;code&gt;Hands-On-Cloud&lt;/code&gt; would count as a different value. Pick one spelling and keep it.&lt;/p&gt;

&lt;p&gt;Then, in the S3 console:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Properties → Static website hosting → Edit → Enable.&lt;/strong&gt; Set &lt;strong&gt;Index document&lt;/strong&gt; to &lt;code&gt;index.html&lt;/code&gt; and choose &lt;strong&gt;Save changes&lt;/strong&gt;. Note the &lt;strong&gt;Bucket website endpoint&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Permissions → Block public access (bucket settings) → Edit.&lt;/strong&gt; Clear &lt;strong&gt;Block &lt;em&gt;all&lt;/em&gt; public access&lt;/strong&gt; and save. This makes the bucket readable by anyone, which is the intent for a public page. If your account-level setting also blocks public access, S3 applies the more restrictive of the two. Clear that one too.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Permissions → Bucket policy → Edit.&lt;/strong&gt; Allow &lt;code&gt;s3:GetObject&lt;/code&gt; on &lt;code&gt;arn:aws:s3:::&amp;lt;bucket&amp;gt;/*&lt;/code&gt; for the principal &lt;code&gt;*&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Put your real function URL into &lt;code&gt;FUNCTION_URL&lt;/code&gt; and upload &lt;code&gt;index.html&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&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%2Fla69zs80654f5c7s6n2z.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%2Fla69zs80654f5c7s6n2z.png" alt="Enable hosting, clear public access block, add the GetObject policy, then upload the page" width="800" height="63"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Four bucket steps take a private bucket to a public website serving index.html&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Sometimes an organization that manages your account forbids clearing the block. In that case, keep the bucket private and open the page through a &lt;em&gt;presigned URL&lt;/em&gt;. That is a link granting time-limited access to one object without changing the bucket policy. The page's origin is then &lt;code&gt;https&lt;/code&gt;, and that is the origin you must allow next.&lt;/p&gt;

&lt;h2&gt;
  
  
  Allow exactly one origin on the function URL
&lt;/h2&gt;

&lt;p&gt;An &lt;em&gt;origin&lt;/em&gt; is the scheme, host and port together. Your page's origin is the website endpoint, &lt;code&gt;http&lt;/code&gt; included. The function URL is a different origin.&lt;/p&gt;

&lt;p&gt;CORS (cross-origin resource sharing) is a set of response headers. With them, a server tells the browser which other origins may read its responses. If the response's &lt;code&gt;access-control-allow-origin&lt;/code&gt; header does not name your page's origin, the browser withholds the answer from the script. The details appear only in the console.&lt;/p&gt;

&lt;p&gt;On the function, go to &lt;strong&gt;Configuration → Function URL → Edit&lt;/strong&gt;, tick &lt;strong&gt;Configure cross-origin resource sharing (CORS)&lt;/strong&gt;, and set:&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%2Fjbw9egb5m9ao1oy7ghl0.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%2Fjbw9egb5m9ao1oy7ghl0.png" alt="Allow origin is the website endpoint with http and no slash; methods GET and POST; header content-type" width="800" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The function URL allows one origin, two methods and one header&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;content-type&lt;/code&gt; header matters because the page sends JSON. A &lt;code&gt;POST&lt;/code&gt; with that header triggers a &lt;em&gt;preflight&lt;/em&gt;: an &lt;code&gt;OPTIONS&lt;/code&gt; request the browser sends first to ask permission.&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%2Foifv6hyrzxk8466cux28.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%2Foifv6hyrzxk8466cux28.png" alt="Browser sends OPTIONS, gets the page origin allowed, sends POST, and passes the response to the script" width="800" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The browser asks permission with OPTIONS before each POST, then reads the allowed answer&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What you should see, and how to read a failure
&lt;/h2&gt;

&lt;p&gt;Open the website endpoint and add a note. You should see "Saved." and the note in the list. In the browser's developer tools, the &lt;strong&gt;Network&lt;/strong&gt; tab shows an &lt;code&gt;OPTIONS&lt;/code&gt; request before each &lt;code&gt;POST&lt;/code&gt;. The responses carry an &lt;code&gt;access-control-allow-origin&lt;/code&gt; header naming your page.&lt;/p&gt;

&lt;p&gt;The common failure is a page that loads, then shows &lt;em&gt;Could not load notes&lt;/em&gt; under an empty list, while &lt;code&gt;curl -s "$URL"&lt;/code&gt; in your terminal lists every note. The function answered. Its CORS setting did not allow the page's origin, so the browser kept the response from the script. &lt;code&gt;curl&lt;/code&gt; is not a page's script, so it never meets that check.&lt;/p&gt;

&lt;p&gt;Compare the origin in the &lt;strong&gt;Console&lt;/strong&gt; error with the one you allowed, character by character. The usual culprits are &lt;code&gt;https&lt;/code&gt; typed for &lt;code&gt;http&lt;/code&gt;, or a trailing &lt;code&gt;/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The page is served over HTTP because S3 website endpoints do not support HTTPS. The S3 documentation, retrieved 2026-10-02, points to a CDN or a managed hosting service in front of the bucket when you need HTTPS. In our view, HTTP is acceptable for a practice page showing notes you typed. It is not acceptable for anything with sign-in or personal data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tags find what you labelled, not what exists
&lt;/h2&gt;

&lt;p&gt;Tagging the bucket is what lets you find it later. Search Tag Editor for &lt;code&gt;project&lt;/code&gt; = &lt;code&gt;hands-on-cloud&lt;/code&gt; in your Region across all resource types, and the bucket appears with the function, table and topic you tagged.&lt;/p&gt;

&lt;p&gt;The search answers "what did I label?", not "what exists?" It misses three kinds of resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;resources without the tag, including ones with a different-case value;&lt;/li&gt;
&lt;li&gt;resources in Regions you did not select;&lt;/li&gt;
&lt;li&gt;resource types it does not support.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Lambda creates the log group &lt;code&gt;/aws/lambda/hoc-notes-api&lt;/code&gt; itself, untagged. IAM roles are not tied to any Region, so check &lt;code&gt;hoc-notes-api-role&lt;/code&gt; in the IAM &lt;strong&gt;Roles&lt;/strong&gt; list directly.&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%2Fgist.githubusercontent.com%2Ftecheazy-consulting%2Ffde7cc0b12df6e227150fce00af6cf7e%2Fraw%2F1d60555e8eaffacd2fac634c4053f20b684334b4%2Fvisual-06.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%2Fgist.githubusercontent.com%2Ftecheazy-consulting%2Ffde7cc0b12df6e227150fce00af6cf7e%2Fraw%2F1d60555e8eaffacd2fac634c4053f20b684334b4%2Fvisual-06.png" alt="Tag search covers tagged resources; log groups, other Regions and IAM roles must be checked by name" width="800" height="121"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A tag search finds labelled resources; untagged, other-Region and IAM items need a direct check&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To clean up this half, delete dependents first. Delete the objects in the bucket, then the bucket, because S3 deletes only an empty bucket. After that, the bucket name returns to a shared global pool, and another account can claim it. That is harmless for a practice bucket, but it is a reason never to delete a bucket name that real links still use.&lt;/p&gt;

&lt;p&gt;Delete the function before its role, table and log group. While the function exists, a request can recreate the log group or fail against a missing table.&lt;/p&gt;

&lt;p&gt;Prove each deletion with the service's own listing. Commands such as &lt;code&gt;aws lambda get-function&lt;/code&gt; should report &lt;em&gt;not found&lt;/em&gt;, or the console list should no longer show the item. Then check the billing pages as a cross-check, not as proof.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The page and the API are joined only by one URL in the page and one origin in the CORS setting; get both exactly right.&lt;/li&gt;
&lt;li&gt;Render every note with &lt;code&gt;textContent&lt;/code&gt;. A note is untrusted input, and &lt;code&gt;innerHTML&lt;/code&gt; turns it into code.&lt;/li&gt;
&lt;li&gt;Browser limits like &lt;code&gt;maxlength&lt;/code&gt; save a round trip. The server enforces the rules.&lt;/li&gt;
&lt;li&gt;Allow one origin: the website endpoint with its &lt;code&gt;http&lt;/code&gt; scheme and no trailing slash. When &lt;code&gt;curl&lt;/code&gt; works but the page is blank, read the Console.&lt;/li&gt;
&lt;li&gt;Tag at creation, in one consistent case, then check by name what tags miss: auto-created log groups, other Regions, IAM roles.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This article settles how to ship and tag the page. It does not settle serving it over HTTPS, nor how to set up and prove an alarm that tells you when the API breaks. Both need their own treatment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Full article: &lt;a href="https://techeazyconsulting.com/how-to-host-a-static-page-on-s3-that-calls-your-lambda-api-and-tag-it-for-later" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/how-to-host-a-static-page-on-s3-that-calls-your-lambda-api-and-tag-it-for-later&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Full chapter: &lt;a href="https://techeazyconsulting.com/courses/hands-on-cloud-for-freshers/session-08" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/courses/hands-on-cloud-for-freshers/session-08&lt;/a&gt;
&amp;lt;!-- cf-origin:end --&amp;gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>beginners</category>
      <category>career</category>
    </item>
    <item>
      <title>A free AWS project for your resume: build a GenAI helpdesk on Bedrock</title>
      <dc:creator>TechEazy Consulting</dc:creator>
      <pubDate>Mon, 23 Nov 2026 10:00:00 +0000</pubDate>
      <link>https://dev.to/techeazy_consulting/a-free-aws-project-for-your-resume-build-a-genai-helpdesk-on-bedrock-566e</link>
      <guid>https://dev.to/techeazy_consulting/a-free-aws-project-for-your-resume-build-a-genai-helpdesk-on-bedrock-566e</guid>
      <description>&lt;p&gt;You have learned a few AWS services, but your resume still says only “familiar with cloud computing.” That leaves an interviewer guessing what you can actually build. A finished GenAI helpdesk gives you something concrete to discuss: a chat page, an API, a hosted model on Amazon Bedrock, retrieval-augmented answers, ticket tools, safety controls, automated deployment, and one CloudFormation stack that you can tear down when you finish.&lt;/p&gt;

&lt;p&gt;The project can be taught through a free course, but running its AWS resources may still create charges. The sensible goal is not to claim that you built a production support platform. It is to build a small, complete system, understand each connection, control its cost, and explain your decisions honestly.&lt;/p&gt;

&lt;h2&gt;
  
  
  A complete request path turns separate AWS services into one project
&lt;/h2&gt;

&lt;p&gt;The application is an IT helpdesk assistant. A user opens a private static chat page and enters a question such as, “How do I connect to the office VPN?” The page sends that message to an HTTP endpoint, which invokes an AWS Lambda function.&lt;/p&gt;

&lt;p&gt;The Lambda function passes the conversation to a foundation model hosted through Amazon Bedrock. It uses the Bedrock Converse API, which provides a common message-based interface for supported models. The function then returns the model’s response to the chat page.&lt;/p&gt;

&lt;p&gt;Think of the application as a reception desk. The page receives the visitor, the API carries the request inside, Lambda coordinates the work, and the Bedrock model drafts the answer.&lt;/p&gt;

&lt;p&gt;This first working path already demonstrates several useful skills. You show that you can build a serverless function, call a managed AI service through an SDK, handle an HTTP request, return structured data, and connect a browser interface to a backend.&lt;/p&gt;

&lt;p&gt;You also encounter real engineering details. The function needs permission to invoke the selected Bedrock model. The API must handle malformed input and backend failures. The browser must receive a response it can safely display. These details distinguish a connected project from a collection of screenshots.&lt;/p&gt;

&lt;p&gt;The chat page is stored in a private Amazon S3 bucket and delivered through Amazon CloudFront. Keeping the bucket private means visitors retrieve the site through CloudFront instead of directly from S3. This gives the project a clearer hosting boundary and lets you discuss why public storage access is unnecessary.&lt;/p&gt;

&lt;p&gt;The page does not need to be a large frontend application. A focused interface with a message box, a send button, a conversation area, and visible error states is enough. For example, if the backend cannot answer, the page should show a useful failure message instead of appearing frozen.&lt;/p&gt;

&lt;h2&gt;
  
  
  Infrastructure as code makes the application reproducible
&lt;/h2&gt;

&lt;p&gt;Creating every resource manually can produce a working demonstration, but it is difficult to reproduce and easy to misconfigure. In this project, AWS CloudFormation describes the infrastructure as code: resources and their relationships are written in a template and deployed as a stack.&lt;/p&gt;

&lt;p&gt;The stack can define the Lambda function, its execution role, the HTTP endpoint, the private S3 bucket, the CloudFront distribution, and related permissions. Later stages can add the resources needed for retrieval, guardrails, and agent behaviour.&lt;/p&gt;

&lt;p&gt;Think of the template as the project’s assembly plan. A console-built resource shows that you found the right settings once. A reviewed template shows how the system is meant to be assembled again.&lt;/p&gt;

&lt;p&gt;This part demonstrates infrastructure-as-code skills, dependency management, identity and access management, and repeatable deployment. It also gives you useful design questions to discuss. Which resources need public access? Which permissions belong to the function? Which values should be parameters rather than fixed in the template?&lt;/p&gt;

&lt;p&gt;The template should grant only the access the project needs. For example, the Lambda role needs permission to call the chosen Bedrock capability, but that does not mean it needs broad control over every AWS service. Keeping permissions narrow is a practical security habit, even in a learning project.&lt;/p&gt;

&lt;p&gt;CloudFormation also makes teardown clearer. Instead of trying to remember every resource created during several lessons, you can delete the stack and let AWS remove the resources it manages. You should still check whether any retained data or separately created resources remain.&lt;/p&gt;

&lt;h2&gt;
  
  
  Retrieval and tools turn a chatbot into a helpdesk workflow
&lt;/h2&gt;

&lt;p&gt;A model can produce a fluent answer without having access to your organisation’s support material. Retrieval-augmented generation, usually shortened to RAG, addresses that gap by finding relevant content from a supplied knowledge base and making it available while an answer is generated.&lt;/p&gt;

&lt;p&gt;For this project, the knowledge base can contain small, fictional IT support documents written for the demonstration. Suitable examples include password-reset instructions, VPN setup steps, or an equipment-request policy. They should not contain real credentials, private company material, or personal information.&lt;/p&gt;

&lt;p&gt;RAG does not guarantee a correct answer. It gives the system relevant source material, while your application still needs to handle missing or weak matches. A sensible response may state that the available knowledge does not contain enough information instead of inventing a procedure.&lt;/p&gt;

&lt;p&gt;Think of RAG as giving the assistant an open handbook before it responds. The assistant still has to interpret the relevant page, but it no longer has to rely only on general model knowledge.&lt;/p&gt;

&lt;p&gt;Tool use adds a different capability. Instead of merely discussing a support ticket, the model can request a defined ticket operation. The application validates the request and invokes code that performs the allowed action.&lt;/p&gt;

&lt;p&gt;For a portfolio demonstration, the ticket tool can operate on controlled sample data. Its input might include a short issue summary, a category, and a priority selected from an allowed set. The important lesson is that the model proposes a tool call; trusted application code decides whether and how to execute it.&lt;/p&gt;

&lt;p&gt;A triage agent connects these paths. It examines the request and decides whether to answer from the knowledge base, request a ticket action, or report that it cannot safely complete the task. For example, “How do I reset my password?” may use retrieved instructions, while “The reset process failed and I am locked out” may need a ticket.&lt;/p&gt;

&lt;p&gt;This stage demonstrates semantic retrieval, prompt design, tool schemas, input validation, orchestration, and separation between model output and application authority. It also gives you a strong interview topic: a model-generated tool request should not be treated as automatically trustworthy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Guardrails and failure handling show responsible GenAI engineering
&lt;/h2&gt;

&lt;p&gt;A helpdesk can receive sensitive, abusive, irrelevant, or manipulative input. Amazon Bedrock Guardrails can be added to apply configured controls to model interactions. Guardrails are one layer of the design, not a replacement for authentication, authorization, validation, or careful handling of data.&lt;/p&gt;

&lt;p&gt;The application should also set boundaries in ordinary code. Reject an empty message. Limit the input accepted by the endpoint. Validate every ticket field. Avoid placing secrets in prompts or browser code. Return controlled errors rather than raw internal details.&lt;/p&gt;

&lt;p&gt;For example, a user might ask the assistant to ignore its helpdesk role and perform an unrelated task. The application should keep its scope narrow and avoid calling a ticket tool unless the request satisfies the tool’s expected structure and purpose.&lt;/p&gt;

&lt;p&gt;This part shows that you understand a central GenAI boundary: generated text is not trusted application logic. Your code remains responsible for permissions, input checks, tool execution, error handling, and the final response returned to the user.&lt;/p&gt;

&lt;p&gt;It is also worth testing failure cases, not only the happy path. Try a blank request, invalid JSON, an unavailable model call, a question absent from the knowledge base, and a malformed tool request. Record what the user sees and what the backend logs without exposing sensitive content.&lt;/p&gt;

&lt;h2&gt;
  
  
  Automated deployment proves the repository can rebuild the system
&lt;/h2&gt;

&lt;p&gt;Once local and manual deployments work, a GitHub Actions workflow can automate validation and deployment. The workflow can run when changes are pushed to the chosen branch, package the application, check the infrastructure template, and deploy the CloudFormation stack.&lt;/p&gt;

&lt;p&gt;The deployment workflow should use scoped credentials and avoid storing long-lived secrets in the repository. Treat deployment permissions with the same care as runtime permissions: grant the workflow what it needs to update the project, not unrestricted access by default.&lt;/p&gt;

&lt;p&gt;Think of continuous deployment as a repeatable checklist executed by a machine. It does not make a weak template safe, but it reduces the chance that a required packaging or deployment step exists only in your memory.&lt;/p&gt;

&lt;p&gt;A useful repository keeps the chat page, Lambda code, infrastructure template, workflow, sample knowledge documents, and setup instructions together. The documentation should explain the architecture, deployment process, test cases, expected costs, and teardown steps.&lt;/p&gt;

&lt;p&gt;This stage demonstrates version control, deployment automation, environment configuration, and operational documentation. A successful workflow run also provides evidence that the repository and infrastructure definition agree.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cost controls belong in the project from the first deployment
&lt;/h2&gt;

&lt;p&gt;“Free course” does not mean unlimited AWS usage is free. Bedrock model calls, Lambda execution, storage, content delivery, logging, retrieval resources, and other deployed components can have usage-based costs. Exact charges depend on the services, model, region, configuration, and traffic.&lt;/p&gt;

&lt;p&gt;Create an AWS budget alert before experimenting. An alert helps you notice estimated spending, but it is not the same as an automatic hard spending limit. You remain responsible for monitoring the account and removing resources you no longer need.&lt;/p&gt;

&lt;p&gt;Keep the demonstration small. Use short sample documents, avoid unnecessary traffic, do not run repeated model calls without a reason, and inspect the resources created by the stack. If a component is not needed for the current stage, do not leave it running merely because it may be useful later.&lt;/p&gt;

&lt;p&gt;When you finish, delete the CloudFormation stack and verify the result. Check for resources that may have been created separately, retained deliberately, or left with stored data. Also review the billing and cost-management views rather than assuming that closing the browser stopped the services.&lt;/p&gt;

&lt;p&gt;Cost awareness is itself an AWS skill. It shows that you understand cloud resources continue to matter after the feature works and that teardown is part of the application lifecycle.&lt;/p&gt;

&lt;h2&gt;
  
  
  An honest resume entry describes what you built and verified
&lt;/h2&gt;

&lt;p&gt;Your resume should describe the scope of the project without presenting a learning deployment as production experience. Use “built,” “implemented,” or “deployed” when those statements are true. Avoid claims about scale, uptime, users, savings, or business impact unless you have measured evidence.&lt;/p&gt;

&lt;p&gt;A defensible project entry could say:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Built and deployed a serverless GenAI IT helpdesk on AWS using a private S3 and CloudFront chat interface, an HTTP API, AWS Lambda, and Amazon Bedrock’s Converse API. Added retrieval-augmented answers from sample support documents, validated ticket tool use, triage logic, guardrail controls, CloudFormation infrastructure, and automated deployments with GitHub Actions. Documented test cases, cost monitoring, and stack teardown.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Adjust that wording to match what you actually completed. If your ticket tool writes only to a sample store, say so. If deployment still requires a manual approval, do not call it fully automatic. If you tested only with synthetic documents, describe them as sample data.&lt;/p&gt;

&lt;p&gt;In an interview, be ready to draw the request path and explain one decision from each layer. You might explain why the S3 bucket is private, how Lambda calls Bedrock, what RAG contributes, why tool input is validated, how the workflow deploys CloudFormation, and how you removed the resources afterward.&lt;/p&gt;

&lt;p&gt;The strongest demonstration is not a long list of AWS names. It is a coherent explanation of how a request moves through the system, where trust changes, what can fail, and how the deployment can be reproduced.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A finished portfolio project connects a chat page, HTTP endpoint, Lambda function, Bedrock model, and CloudFormation stack.&lt;/li&gt;
&lt;li&gt;RAG supplies relevant support material, while validated tool use lets the application perform a controlled ticket action.&lt;/li&gt;
&lt;li&gt;A triage agent, guardrails, narrow permissions, and application-level checks demonstrate responsible GenAI design.&lt;/li&gt;
&lt;li&gt;GitHub Actions and infrastructure as code make the project reproducible instead of dependent on undocumented console steps.&lt;/li&gt;
&lt;li&gt;A budget alert, small test data, cost monitoring, stack deletion, and resource verification help keep experimentation controlled.&lt;/li&gt;
&lt;li&gt;Resume wording should state exactly what you built and tested without implying production scale or business results.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This project can demonstrate a broad set of beginner AWS skills in one understandable system. It does not prove production readiness, security under every threat, reliable operation at scale, or professional experience; those require deeper testing, monitoring, governance, and real operating conditions.&lt;/p&gt;




&lt;p&gt;Build this project step by step in the free &lt;a href="https://dev.to/courses/aws-in-action-ai"&gt;AWS in Action: AI edition&lt;/a&gt; course. To go further with mentoring, see the &lt;a href="https://dev.to/programs/cloud-ai-solutions-architect"&gt;Cloud and AI Solutions Architect program&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;This post first appeared on TechEazy Consulting: &lt;a href="https://techeazyconsulting.com/a-free-aws-project-for-your-resume-genai-helpdesk-on-bedrock" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/a-free-aws-project-for-your-resume-genai-helpdesk-on-bedrock&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Browse the free, public courses: &lt;a href="https://techeazyconsulting.com/courses" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/courses&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Want mentor-led help with the next step? See the program: &lt;a href="https://techeazyconsulting.com/programs/cloud-ai-solutions-architect" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/programs/cloud-ai-solutions-architect&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>ai</category>
      <category>beginners</category>
    </item>
    <item>
      <title>What an AWS Lambda function is, and what its execution role decides</title>
      <dc:creator>TechEazy Consulting</dc:creator>
      <pubDate>Tue, 20 Oct 2026 02:26:51 +0000</pubDate>
      <link>https://dev.to/techeazy_consulting/what-an-aws-lambda-function-is-and-what-its-execution-role-decides-1g9b</link>
      <guid>https://dev.to/techeazy_consulting/what-an-aws-lambda-function-is-and-what-its-execution-role-decides-1g9b</guid>
      <description>&lt;p&gt;An interviewer leans back and asks, "So what is a Lambda function, really?" You know the slogan: code without servers. Then the follow-up comes: "Your function returns a 502 when it writes to the database. Why?" The slogan does not answer that. This article claims that a fresher can answer both questions with two ideas. First, a Lambda function is a small contract between your code and a runtime that starts, reuses and discards environments for you. Second, the &lt;strong&gt;execution role&lt;/strong&gt; decides everything that code may touch. Most first failures happen because the role and the code disagree, and the article works through the questions in the order an interviewer tends to ask them.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Lambda function is code plus configuration, run only on demand
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The question:&lt;/strong&gt; &lt;em&gt;"What is a Lambda function, in your own words?"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A Lambda function is your code plus a few settings that AWS runs only when it is invoked, meaning called. The settings are the runtime, the handler, the memory, the timeout and the role. You never see or patch a machine. AWS creates an environment to run the code in, scales it out when requests arrive together, and throws it away when things go quiet.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Think of it as a food stall that only lights its stove when an order arrives.&lt;/em&gt; You write the recipe and pin a few instructions to the wall: which cuisine to cook (the &lt;strong&gt;runtime&lt;/strong&gt;), which recipe card to start from (the &lt;strong&gt;handler&lt;/strong&gt;), and how long a dish may take before it is abandoned (the &lt;strong&gt;timeout&lt;/strong&gt;). The stall owner lights the stove, opens a second stove for a second order, and lets them go cold. You pay per order cooked, not for the stall standing there.&lt;/p&gt;

&lt;p&gt;A strong answer names what this changes. Without a server to keep running, "is the server up?" stops being the hard question. The hard questions become &lt;em&gt;who may call this code&lt;/em&gt;, &lt;em&gt;what may this code touch&lt;/em&gt; and &lt;em&gt;what happened on that one request&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl4t1xj2tbfpiwsqtxd48.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%2Fl4t1xj2tbfpiwsqtxd48.png" alt="A request either starts a new environment or reuses one, then the handler runs and returns the response" width="798" height="123"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Start-up code runs once per environment; the handler runs once per request&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The handler is a contract that is called once per request
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The question:&lt;/strong&gt; &lt;em&gt;"What does Lambda actually call, and what does it pass in?"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Lambda calls one function in your code, the &lt;strong&gt;handler&lt;/strong&gt;, once for each request. In Python, a file named &lt;code&gt;lambda_function.py&lt;/code&gt; that defines &lt;code&gt;lambda_handler(event, context)&lt;/code&gt; has the handler &lt;code&gt;lambda_function.lambda_handler&lt;/code&gt;. The &lt;strong&gt;event&lt;/strong&gt; is a document describing what triggered the call. For a web request it holds the method, path, headers and body. The &lt;strong&gt;context&lt;/strong&gt; describes the invocation itself, such as its request ID and its log group name.&lt;/p&gt;

&lt;p&gt;Whatever the handler returns becomes the response. If you return a dictionary with &lt;code&gt;statusCode&lt;/code&gt;, &lt;code&gt;headers&lt;/code&gt; and &lt;code&gt;body&lt;/code&gt;, Lambda turns it into the HTTP response. If you return plain JSON with no status code, Lambda assumes status 200 and content type &lt;code&gt;application/json&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Interviewers like the next detail because it shows you understand the lifecycle. Code &lt;em&gt;outside&lt;/em&gt; the handler, such as imports and creating an SDK client, runs once when an environment starts. Later invocations in that same environment reuse it. That is why the Lambda documentation advises creating SDK clients outside the handler: you pay the start-up cost once per environment, not once per request.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Think of it as the cook laying out knives before service rather than fetching them for every dish.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Two defaults are worth knowing, and so is how to choose a runtime. A runtime is named by an identifier such as &lt;code&gt;python3.14&lt;/code&gt;, and each identifier has a published deprecation date. When the runtimes page was checked on 2026-10-02, &lt;code&gt;python3.14&lt;/code&gt; was the newest generally available Python runtime. &lt;code&gt;python3.15&lt;/code&gt; was listed as a public preview, which the page says is not for production.&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%2F1eny3957oftzeygy435t.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%2F1eny3957oftzeygy435t.png" alt="Runtime, handler, timeout, memory and execution role, each with its default and purpose" width="799" height="381"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The settings a function carries, with their defaults and what each one governs&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The execution role is the only thing deciding what your code may touch
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The question:&lt;/strong&gt; &lt;em&gt;"Where does your function get permission to write to the database?"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;When Lambda runs your code, the code acts &lt;em&gt;as&lt;/em&gt; the execution role. A role is an identity in IAM, the AWS permissions service, and it has two halves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a &lt;strong&gt;trust policy&lt;/strong&gt; saying who may take it on, which for an execution role is the Lambda service, &lt;code&gt;lambda.amazonaws.com&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;permission policies&lt;/strong&gt; saying what it may do once it has been taken on.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Think of it as a staff badge.&lt;/em&gt; The badge opens the store room and the noticeboard and no other door. The cook did not choose the badge. Whoever hired them did, and the badge is checked at every door.&lt;/p&gt;

&lt;p&gt;The answer that impresses is this one: there are no keys in the code. The Python SDK finds temporary credentials for the role in the function's environment by itself. The Lambda documentation says you do not need to provide credentials to set up a client. If a candidate pastes an access key into a function, it shows they have not understood the role.&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%2Fmz1zzcgthselccjgp278.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%2Fmz1zzcgthselccjgp278.png" alt="Lambda assumes the execution role, which may write logs and use one table and nothing else" width="799" height="222"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The trust policy lets Lambda take on the role; permission policies decide which doors it opens&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The default role explains the classic 502
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The question:&lt;/strong&gt; &lt;em&gt;"You created a function with every default, and saving a record returns 502. What happened?"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is the failure a first attempt usually hits. You write a handler that saves a note to a DynamoDB table, which is a managed key-value database. You create the function in the console and accept the defaults. A request returns a bare 502. A status in the 5XX range is what a function URL, the function's public web address, returns when the function itself fails. The response gives no reason.&lt;/p&gt;

&lt;p&gt;The function's log has the reason:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[ERROR] ClientError: An error occurred (AccessDeniedException) when calling the PutItem operation:
User: arn:aws:sts::111122223333:assumed-role/hoc-notes-api-role-x1y2/hoc-notes-api is not
authorized to perform: dynamodb:PutItem on resource: arn:aws:dynamodb:ap-south-1:111122223333:table/hoc-notes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The code was fine. The console's default option creates a new role with the managed policy &lt;code&gt;AWSLambdaBasicExecutionRole&lt;/code&gt;. That policy grants exactly three actions: &lt;code&gt;logs:CreateLogGroup&lt;/code&gt;, &lt;code&gt;logs:CreateLogStream&lt;/code&gt; and &lt;code&gt;logs:PutLogEvents&lt;/code&gt;. So the function could log its own error, but it could not save the note.&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%2Fdmar4imk0wdut8y3uwlx.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%2Fdmar4imk0wdut8y3uwlx.png" alt="The table refuses PutItem, the error goes to the logs, and the caller receives a bare 502" width="799" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The role may write logs but not the table, so the caller sees only 502 while the log names the cause&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Read the error as a sentence. The subject is the role, the verb is the action, and the object is the table. Every permission problem inside a function reads that way, so the fix is always the same: add exactly that action, on exactly that resource, to the role. In the console, that means choosing &lt;strong&gt;Use another role&lt;/strong&gt; under Permissions and picking a role built for read and write on the one table, with basic logging added.&lt;/p&gt;

&lt;p&gt;An interviewer may push: "Why not just attach an administrator policy?" It would make the error go away. It would also mean that a bug in this one function could change anything in the account. In our view, saying that unprompted is one of the clearest signs a fresher has thought about permissions rather than just made them work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who may call the function is a separate decision
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The question:&lt;/strong&gt; &lt;em&gt;"So the role controls who can call it?"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;No, and this is the trap. The execution role decides what the function may &lt;em&gt;call&lt;/em&gt;. A different policy decides who may &lt;em&gt;invoke&lt;/em&gt; the function: the &lt;strong&gt;resource-based policy&lt;/strong&gt;, which is attached to the function itself.&lt;/p&gt;

&lt;p&gt;The two failures look alike but happen on opposite sides of the function. A 403 from the function URL, with no START line in the log, means the request was refused before your code ran. In that case the resource-based policy is the place to look. An &lt;code&gt;AccessDeniedException&lt;/code&gt; inside the log means the code ran and the role was refused. Being able to tell these apart in one sentence is worth more in an interview than any definition.&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%2F8c21gw7ibk3q4bjpmxv0.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%2F8c21gw7ibk3q4bjpmxv0.png" alt="A 403 points to the resource-based policy, AccessDenied to the role, a traceback to the code" width="800" height="312"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Two permission failures, on opposite sides of the function&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A small notes function shows each idea in a few lines
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The question:&lt;/strong&gt; &lt;em&gt;"Walk me through a function you wrote."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A useful one to describe is a notes API: a single Python handler that lists notes on GET and adds a note on POST. Each line choice answers one of the ideas above.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The client is created at module level.&lt;/strong&gt; &lt;code&gt;table = boto3.resource("dynamodb").Table(TABLE_NAME)&lt;/code&gt; sits outside the handler, so each environment pays for it once.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The table name comes from an environment variable&lt;/strong&gt;, &lt;code&gt;TABLE_NAME&lt;/code&gt;, with a fallback. The configuration stays out of the code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The method is read from the event&lt;/strong&gt;, at &lt;code&gt;event["requestContext"]["http"]["method"]&lt;/code&gt;. A function URL delivers requests in the same &lt;em&gt;payload format version 2.0&lt;/em&gt; shape that Amazon API Gateway uses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The body is decoded when &lt;code&gt;isBase64Encoded&lt;/code&gt; is true.&lt;/strong&gt; That flag means Lambda encoded a binary request body as text.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bad input returns 400, not an exception.&lt;/strong&gt; Empty text, invalid JSON or text over 500 characters each get a clear error. An exception reaches the caller only as the opaque 5XX described earlier.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;json.dumps(..., default=str)&lt;/code&gt;&lt;/strong&gt; handles DynamoDB numbers. The SDK returns them as Python &lt;code&gt;Decimal&lt;/code&gt; values, which &lt;code&gt;json.dumps&lt;/code&gt; refuses on its own.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;OPTIONS&lt;/code&gt; returns 204&lt;/strong&gt; because browsers send it before some cross-origin calls.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8sh3nc9iby2owuiwzqon.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%2F8sh3nc9iby2owuiwzqon.png" alt="GET returns 200, a valid POST 201, bad input 400, OPTIONS 204, other methods 405" width="799" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Each kind of request gets a deliberate status code instead of an unhandled failure&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;There is one honest weakness to mention before the interviewer finds it. The GET handler uses &lt;code&gt;table.scan()&lt;/code&gt;, which reads every item, up to 1 MB per call, and signals when more remains. That is fine for a small table. For a large one it is the wrong tool, and you would design a key you can query by instead. Naming the limit of your own code reads as experience, not weakness.&lt;/p&gt;

&lt;h2&gt;
  
  
  The log is the only witness to a single request
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The question:&lt;/strong&gt; &lt;em&gt;"How would you find out what happened on one failed request?"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A function has no screen, so its log is the only record of what one request did. Lambda sends output to CloudWatch Logs, the AWS logging service, as long as the role allows the three &lt;code&gt;logs:&lt;/code&gt; actions. By default the log group is &lt;code&gt;/aws/lambda/&amp;lt;function-name&amp;gt;&lt;/code&gt;, and each environment writes its own stream inside it.&lt;/p&gt;

&lt;p&gt;Every invocation writes START, END and REPORT lines, each carrying the request ID. The REPORT line gives Duration, Billed Duration, Memory Size and Max Memory Used. It also shows Init Duration, but only when a new environment had to start. Anything the code prints appears between START and END.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Think of it as the stall's order book: one entry per order, written whether the dish came out right or not.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What to practise before the interview
&lt;/h2&gt;

&lt;p&gt;Practise these until you can say each one aloud without notes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Explain the handler contract, including what runs once per environment and what runs once per request.&lt;/li&gt;
&lt;li&gt;Name the two halves of an execution role and what &lt;code&gt;AWSLambdaBasicExecutionRole&lt;/code&gt; allows.&lt;/li&gt;
&lt;li&gt;Read an &lt;code&gt;AccessDeniedException&lt;/code&gt; as subject, verb and object, then state the exact fix.&lt;/li&gt;
&lt;li&gt;Separate a 403 with no START line from an AccessDenied inside the log.&lt;/li&gt;
&lt;li&gt;Defend one design choice in your own function, and name one of its limits.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A Lambda function is code plus configuration that runs on demand. The handler is called once per request, and code outside it runs once per environment.&lt;/li&gt;
&lt;li&gt;The execution role decides what the code may touch. Its trust policy names &lt;code&gt;lambda.amazonaws.com&lt;/code&gt;, and the code holds no keys.&lt;/li&gt;
&lt;li&gt;The default role can only write logs. That is why a first database write often fails with a bare 5XX.&lt;/li&gt;
&lt;li&gt;Fix permission errors with exactly the missing action on exactly that resource, never with broad access.&lt;/li&gt;
&lt;li&gt;Who may &lt;em&gt;call&lt;/em&gt; the function is decided by a separate resource-based policy, and the log tells you which side refused.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This article does not settle how to authenticate callers properly, how to configure CORS (the headers that let a browser page read the function's responses), or what any of this costs at scale. Each of those is a decision in its own right.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Full article: &lt;a href="https://techeazyconsulting.com/what-an-aws-lambda-function-is-and-what-its-execution-role-decides" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/what-an-aws-lambda-function-is-and-what-its-execution-role-decides&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Full chapter: &lt;a href="https://techeazyconsulting.com/courses/hands-on-cloud-for-freshers/session-07" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/courses/hands-on-cloud-for-freshers/session-07&lt;/a&gt;
&amp;lt;!-- cf-origin:end --&amp;gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>beginners</category>
      <category>career</category>
    </item>
    <item>
      <title>Creating your first key-value table from the command line, and measuring what each read costs</title>
      <dc:creator>TechEazy Consulting</dc:creator>
      <pubDate>Mon, 19 Oct 2026 07:05:37 +0000</pubDate>
      <link>https://dev.to/techeazy_consulting/creating-your-first-key-value-table-from-the-command-line-and-measuring-what-each-read-costs-5b4n</link>
      <guid>https://dev.to/techeazy_consulting/creating-your-first-key-value-table-from-the-command-line-and-measuring-what-each-read-costs-5b4n</guid>
      <description>&lt;p&gt;You have a small notes app and nowhere permanent to keep the notes. Records stored on a server's own disk vanish when that server is replaced, so you want a managed table that outlives any one machine. You open a terminal and immediately hit two questions: what should the first command be, and how do you know whether a read is cheap or expensive?&lt;/p&gt;

&lt;p&gt;This lab answers both using Amazon DynamoDB, a managed table service you reach entirely through an API. The claim is simple. &lt;strong&gt;The partition key you choose when you create the table decides two things: which item every write touches, and how much work every read does.&lt;/strong&gt; Reading by key goes straight to one item. A Scan reads every item, and you can watch the difference in the response itself. You will create a table, fill it, read it three ways, compare the cost of each, and then delete it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The setup is small: one identity, one Region, one billing mode
&lt;/h2&gt;

&lt;p&gt;You need an account, an everyday administrator identity that is not the root user, and the AWS command-line interface (CLI), version 2, signed in as that identity. This lab uses the Asia Pacific (Mumbai) Region, &lt;code&gt;ap-south-1&lt;/code&gt;. If your CLI is not yet set to that Region, run:&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;span class="nb"&gt;set &lt;/span&gt;region ap-south-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To confirm who you are signed in as, run &lt;code&gt;aws sts get-caller-identity&lt;/code&gt;. The &lt;code&gt;Account&lt;/code&gt; field in the output is your 12-digit account ID. The CLI documentation notes that this command needs no permissions, so it works whatever identity you use.&lt;/p&gt;

&lt;p&gt;Now the money. The table uses &lt;strong&gt;on-demand capacity&lt;/strong&gt;, a mode in which you pay per read and write request and plan no capacity in advance. The service documentation calls it the default and recommended mode. It also states that if you are "driving zero traffic to your table, then with on-demand, you are not charged for any throughput." Storage is billed separately.&lt;/p&gt;

&lt;p&gt;As of 2026-10-02, the pricing page listed 25 GB of storage per Region in the Free Tier. It also listed 25 free read and 25 free write capacity units, but those apply to the &lt;em&gt;provisioned&lt;/em&gt; mode, not to on-demand requests. The few dozen requests in this lab are billed per request.&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%2Fqbajo9m5d9ouhp75q57i.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%2Fqbajo9m5d9ouhp75q57i.png" alt="Table listing which on-demand table costs are billed: requests and storage yes, idle throughput no" width="800" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;On-demand bills each request and stored data; an idle table has no throughput charge&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The partition key is the first decision, because it is the item's identity
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;table&lt;/strong&gt; is a collection of &lt;strong&gt;items&lt;/strong&gt;, much like rows. Each item is a group of &lt;strong&gt;attributes&lt;/strong&gt;, much like fields. Every item must have a &lt;strong&gt;primary key&lt;/strong&gt; that no other item shares. In the simplest case that key is one attribute, the &lt;strong&gt;partition key&lt;/strong&gt;. DynamoDB feeds the partition key's value into an internal hash function, and the result decides where the item is stored.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Think of it as a wall of numbered lockers.&lt;/em&gt; The table is the wall, and the partition key is the number on each door. To fetch something, you name the number and walk straight to that locker.&lt;/p&gt;

&lt;p&gt;This lab's table is &lt;code&gt;hoc-notes&lt;/code&gt;, with partition key &lt;code&gt;noteId&lt;/code&gt;, a string, and no sort key. Create it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws dynamodb create-table &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--table-name&lt;/span&gt; hoc-notes &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--attribute-definitions&lt;/span&gt; &lt;span class="nv"&gt;AttributeName&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;noteId,AttributeType&lt;span class="o"&gt;=&lt;/span&gt;S &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--key-schema&lt;/span&gt; &lt;span class="nv"&gt;AttributeName&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;noteId,KeyType&lt;span class="o"&gt;=&lt;/span&gt;HASH &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--billing-mode&lt;/span&gt; PAY_PER_REQUEST &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--tags&lt;/span&gt; &lt;span class="nv"&gt;Key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;project,Value&lt;span class="o"&gt;=&lt;/span&gt;hands-on-cloud
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three parts of that command do the teaching:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;--attribute-definitions&lt;/code&gt; lists &lt;strong&gt;only&lt;/strong&gt; the key. You never declare &lt;code&gt;title&lt;/code&gt; or &lt;code&gt;body&lt;/code&gt;. Apart from the key, the table is &lt;em&gt;schemaless&lt;/em&gt;, which means each item can carry different attributes.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;KeyType=HASH&lt;/code&gt; marks &lt;code&gt;noteId&lt;/code&gt; as the partition key. The older name for the partition key is "hash attribute", after the hash function. A sort key would be &lt;code&gt;RANGE&lt;/code&gt;. A key attribute must be a string, a number or binary.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PAY_PER_REQUEST&lt;/code&gt; selects on-demand capacity.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why choose &lt;code&gt;noteId&lt;/code&gt; and not &lt;code&gt;title&lt;/code&gt;? Because the app fetches a note by its id, from a link or an API path, and because the key must be unique. Titles repeat. As the next sections show, two notes that share a key do not coexist.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What you should see:&lt;/strong&gt; the command returns at once with &lt;code&gt;"TableStatus": "CREATING"&lt;/code&gt;. Check it until it changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws dynamodb describe-table &lt;span class="nt"&gt;--table-name&lt;/span&gt; hoc-notes &lt;span class="nt"&gt;--query&lt;/span&gt; &lt;span class="s2"&gt;"Table.TableStatus"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When it prints &lt;code&gt;"ACTIVE"&lt;/code&gt;, the table is ready for writes.&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%2F44r1ft3gp40jj9ugdoss.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%2F44r1ft3gp40jj9ugdoss.png" alt="Writing or reading by noteId passes the key through the hash function to one storage location" width="800" height="189"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The partition key's value goes through a hash function that decides where each item is stored&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Items are written in typed JSON, and a reused key replaces silently
&lt;/h2&gt;

&lt;p&gt;The CLI writes items in &lt;strong&gt;typed JSON&lt;/strong&gt;: every value is wrapped in its type. A string is &lt;code&gt;{"S": "Buy milk"}&lt;/code&gt;. The number 2 is &lt;code&gt;{"N": "2"}&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That number sits inside quotes. It looks wrong the first time, but it is correct. The &lt;code&gt;N&lt;/code&gt; says the value is a number, and the value itself travels as a string. Writing &lt;code&gt;{"N": 2}&lt;/code&gt; is the mistake to watch for.&lt;/p&gt;

&lt;p&gt;Add a few notes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws dynamodb put-item &lt;span class="nt"&gt;--table-name&lt;/span&gt; hoc-notes &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--item&lt;/span&gt; &lt;span class="s1"&gt;'{"noteId": {"S": "n-001"}, "title": {"S": "Buy milk"}, "body": {"S": "Two litres"}}'&lt;/span&gt;

aws dynamodb put-item &lt;span class="nt"&gt;--table-name&lt;/span&gt; hoc-notes &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--item&lt;/span&gt; &lt;span class="s1"&gt;'{"noteId": {"S": "n-002"}, "title": {"S": "Read chapter 3"}, "priority": {"N": "2"}}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add two or three more, each with its own id. Notice that &lt;code&gt;n-002&lt;/code&gt; has a &lt;code&gt;priority&lt;/code&gt; attribute and &lt;code&gt;n-001&lt;/code&gt; does not. That is schemaless storage at work.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Think of it as your phone's contacts list.&lt;/em&gt; Some contacts have a birthday, some have an email address, and only the ID is required.&lt;/p&gt;

&lt;p&gt;Now try the failure on purpose. Write &lt;code&gt;n-001&lt;/code&gt; again with different contents:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws dynamodb put-item &lt;span class="nt"&gt;--table-name&lt;/span&gt; hoc-notes &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--item&lt;/span&gt; &lt;span class="s1"&gt;'{"noteId": {"S": "n-001"}, "title": {"S": "Call home"}}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What you should see:&lt;/strong&gt; nothing. There is no error and no warning.&lt;/p&gt;

&lt;p&gt;Read the item back and it says &lt;code&gt;Call home&lt;/code&gt;, and it has no &lt;code&gt;body&lt;/code&gt; at all. The documentation describes a put precisely: it "creates a new item, or replaces an existing item with a new item." Two writes with the same key are two versions of &lt;strong&gt;one&lt;/strong&gt; item. The second replaces the first entirely, attributes and all. In the locker picture, you did not add a second locker. You emptied the existing one and refilled it.&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%2F6r32na8wgn6k0djkuhl6.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%2F6r32na8wgn6k0djkuhl6.png" alt="A second put with key n-001 succeeds silently and the later read returns only Call home" width="799" height="606"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Two puts with the same key leave one item: the second replaces the first entirely&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  GetItem reads one item, because it walks straight to the key
&lt;/h2&gt;

&lt;p&gt;The notes app has two different jobs. Opening a link to one note means the app knows the key. Showing the home page means it must list every note and knows no key. Each job calls for a different read, so measure both.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GetItem&lt;/strong&gt; takes the full primary key and returns that one item, or nothing. Ask it to report what it consumed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws dynamodb get-item &lt;span class="nt"&gt;--table-name&lt;/span&gt; hoc-notes &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--key&lt;/span&gt; &lt;span class="s1"&gt;'{"noteId": {"S": "n-002"}}'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--return-consumed-capacity&lt;/span&gt; TOTAL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What you should see:&lt;/strong&gt; the item, plus a &lt;code&gt;ConsumedCapacity&lt;/code&gt; block that shows the read capacity this one request used. Write that figure down, because it is your baseline.&lt;/p&gt;

&lt;p&gt;Reads are eventually consistent by default. Add &lt;code&gt;--consistent-read&lt;/code&gt; and you get a strongly consistent read instead. It reflects every write that completed before it, and it costs twice as much. Run the command once with the flag and compare the two &lt;code&gt;ConsumedCapacity&lt;/code&gt; figures.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scan reads every item, and a filter does not make it cheaper
&lt;/h2&gt;

&lt;p&gt;For the home page there is no key to walk to. You open every locker on the wall, one after another. That is a &lt;strong&gt;Scan&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws dynamodb scan &lt;span class="nt"&gt;--table-name&lt;/span&gt; hoc-notes &lt;span class="nt"&gt;--return-consumed-capacity&lt;/span&gt; TOTAL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What you should see:&lt;/strong&gt; all your notes, a &lt;code&gt;ConsumedCapacity&lt;/code&gt; block, and two counts. &lt;code&gt;ScannedCount&lt;/code&gt; is the number of items read. &lt;code&gt;Count&lt;/code&gt; is the number of items returned. On an unfiltered Scan the two are equal.&lt;/p&gt;

&lt;p&gt;Now ask for just one note through a filter. A &lt;strong&gt;filter expression&lt;/strong&gt; narrows the results that come back:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws dynamodb scan &lt;span class="nt"&gt;--table-name&lt;/span&gt; hoc-notes &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--filter-expression&lt;/span&gt; &lt;span class="s2"&gt;"title = :t"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--expression-attribute-values&lt;/span&gt; &lt;span class="s1"&gt;'{":t": {"S": "Call home"}}'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--return-consumed-capacity&lt;/span&gt; TOTAL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What you should see:&lt;/strong&gt; &lt;code&gt;Count&lt;/code&gt; drops to 1, but &lt;code&gt;ScannedCount&lt;/code&gt; still equals the full number of notes. The documentation spells out why: "a &lt;code&gt;Scan&lt;/code&gt; consumes the same amount of read capacity, regardless of whether a filter expression is present." The filter is applied &lt;em&gt;after&lt;/em&gt; the read. It shrinks the answer, not the work. It is like opening every locker and keeping only the red bags.&lt;/p&gt;

&lt;p&gt;Scans also run in pages. A Scan reads up to 1 MB per request, and the CLI keeps requesting pages until it has read the whole table.&lt;/p&gt;

&lt;p&gt;A large &lt;code&gt;ScannedCount&lt;/code&gt; beside a small &lt;code&gt;Count&lt;/code&gt; is the signature of an inefficient read. With five notes the waste is invisible. With a million notes, a Scan that finds one title reads a million items, while GetItem by key still reads one. On-demand capacity bills you for what is read, so this is a cost problem as well as a speed problem.&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%2F0xp7wdai4py3759rfmjb.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%2F0xp7wdai4py3759rfmjb.png" alt="GetItem goes from key to one read; a filtered Scan reads all items, then filters, then returns fewer" width="800" height="73"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;GetItem reads only the named item; a filtered Scan reads every item and returns fewer&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In my view, the working rule follows directly. Choose Scan when you truly need every item and the table is small, such as listing a practice app's notes. Choose GetItem whenever you can name the key.&lt;/p&gt;

&lt;h2&gt;
  
  
  Query matches GetItem here, and earns its place with a sort key
&lt;/h2&gt;

&lt;p&gt;There is a third read. &lt;strong&gt;Query&lt;/strong&gt; returns the items that share one partition key value. Its key condition must test the partition key for equality, with the value passed through a placeholder that starts with a colon:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws dynamodb query &lt;span class="nt"&gt;--table-name&lt;/span&gt; hoc-notes &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--key-condition-expression&lt;/span&gt; &lt;span class="s2"&gt;"noteId = :id"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--expression-attribute-values&lt;/span&gt; &lt;span class="s1"&gt;'{":id": {"S": "n-002"}}'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--return-consumed-capacity&lt;/span&gt; TOTAL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What you should see:&lt;/strong&gt; one item. In a table with only a partition key, no two items can share that value, so Query returns at most one item, the same one GetItem returns.&lt;/p&gt;

&lt;p&gt;Query earns its place when a table also has a &lt;strong&gt;sort key&lt;/strong&gt;, an optional second key attribute. Items that share a partition key are stored together, ordered by the sort key. Picture a music table keyed by artist and song title. Querying one artist is like pulling out the drawer with that artist's name: every song comes out in title order, and no other drawer is touched.&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%2Fdqzwqmn4336pjo8octou.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%2Fdqzwqmn4336pjo8octou.png" alt="Card comparing GetItem, Query and Scan by what you must know and how many items each reads" width="800" height="323"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The three reads differ in what you must know and how much they read&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Cleaning up leaves nothing to bill
&lt;/h2&gt;

&lt;p&gt;An idle on-demand table incurs no throughput charge, but its stored data is still billed. When you have finished experimenting, delete the table:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws dynamodb delete-table &lt;span class="nt"&gt;--table-name&lt;/span&gt; hoc-notes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What you should see:&lt;/strong&gt; a description of the table with its status changing to &lt;code&gt;DELETING&lt;/code&gt;. After that, &lt;code&gt;describe-table&lt;/code&gt; reports that the table cannot be found. The &lt;code&gt;project = hands-on-cloud&lt;/code&gt; tag you added at creation makes it easy to check that nothing from this lab is left behind.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Create the table with only its key declared. Everything else is schemaless and can differ from item to item.&lt;/li&gt;
&lt;li&gt;Choose the partition key from how the data is fetched and what makes it unique, such as an id and never a title. A put with an existing key silently replaces the whole item.&lt;/li&gt;
&lt;li&gt;Write values in typed JSON, and quote numbers: &lt;code&gt;{"N": "2"}&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;--return-consumed-capacity TOTAL&lt;/code&gt; to any read to see what it cost. Compare &lt;code&gt;ScannedCount&lt;/code&gt; with &lt;code&gt;Count&lt;/code&gt; on every Scan.&lt;/li&gt;
&lt;li&gt;GetItem reads one item. A Scan reads all of them, and a filter expression does not reduce what it reads.&lt;/li&gt;
&lt;li&gt;On on-demand capacity you pay for requests and stored data. Strongly consistent reads cost twice as much as the default.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This lab measured reads on a handful of items. It does not settle how to design keys for richer access patterns, how to prevent overwrites with a condition on the put, or how to limit an application's permissions to this one table. Each of those deserves its own treatment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Full article: &lt;a href="https://techeazyconsulting.com/creating-your-first-key-value-table-from-the-command-line-and-measuring-what-each-read-costs" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/creating-your-first-key-value-table-from-the-command-line-and-measuring-what-each-read-costs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Full chapter: &lt;a href="https://techeazyconsulting.com/courses/hands-on-cloud-for-freshers/session-06" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/courses/hands-on-cloud-for-freshers/session-06&lt;/a&gt;
&amp;lt;!-- cf-origin:end --&amp;gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>ai</category>
      <category>career</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Signing the AWS CLI in without access keys, then proving a policy in the simulator</title>
      <dc:creator>TechEazy Consulting</dc:creator>
      <pubDate>Fri, 16 Oct 2026 09:40:25 +0000</pubDate>
      <link>https://dev.to/techeazy_consulting/signing-the-aws-cli-in-without-access-keys-then-proving-a-policy-in-the-simulator-5ed7</link>
      <guid>https://dev.to/techeazy_consulting/signing-the-aws-cli-in-without-access-keys-then-proving-a-policy-in-the-simulator-5ed7</guid>
      <description>&lt;p&gt;You have just installed the AWS CLI, and the setup guide asks you to paste in an access key ID and secret. That leaves a long-lived secret sitting in a file on your laptop. Next you need a permissions policy, and you have no way to know whether it does what you meant until something breaks.&lt;/p&gt;

&lt;p&gt;This lab shows that neither step needs that risk. The &lt;code&gt;aws login&lt;/code&gt; command exchanges an ordinary console sign-in for temporary credentials that the CLI manages for you. The IAM policy simulator then tells you whether a policy would allow or deny an action, without sending a real request to any service. Together they let you work from the terminal with no stored keys, and check a policy before it can do any harm. The simulator is a rehearsal, not a guarantee, and this lab is explicit about where it stops.&lt;/p&gt;

&lt;h2&gt;
  
  
  The goal, and the three tasks that reach it
&lt;/h2&gt;

&lt;p&gt;The lab has three tasks, in this order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Sign the CLI in without an access key, and confirm who it is acting as.&lt;/li&gt;
&lt;li&gt;Write a policy and prove its behaviour in the simulator.&lt;/li&gt;
&lt;li&gt;Find where the session is stored, look at it, and delete it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The order matters. Every simulator command in task 2 is itself an AWS CLI call, so it needs the credentials from task 1. Task 3 tidies away what task 1 created.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4zzfkdkqm664716mfzjs.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%2F4zzfkdkqm664716mfzjs.png" alt="Four steps in order: sign in, simulate a policy, inspect the stored session, sign out" width="800" height="140"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Sign in first, simulate with that session, then delete it&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Version 2.32.0 is the floor for signing in without keys
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;aws login&lt;/code&gt; command needs AWS CLI version 2.32.0 or later. This lab is written against version 2.38.1, the current release, which is well past that floor. Confirm what you have installed with the global &lt;code&gt;--version&lt;/code&gt; option:&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="nv"&gt;$ &lt;/span&gt;aws &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You also need an identity that can sign in to the AWS Management Console. That can be the root user, an IAM user, or a federated identity from your identity provider. If your organisation uses IAM Identity Center, a separate configuration path applies instead.&lt;/p&gt;

&lt;p&gt;The identity also needs permission to use this sign-in method. Attach the &lt;code&gt;SignInLocalDevelopmentAccess&lt;/code&gt; managed policy to the IAM user, role or group. Root users need no extra permissions.&lt;/p&gt;

&lt;p&gt;On a shared account, signing in as root to complete a lab is a poor habit. A sensible default is an IAM user or a federated identity that carries the managed policy above.&lt;/p&gt;

&lt;h2&gt;
  
  
  aws login turns a console sign-in into temporary credentials
&lt;/h2&gt;

&lt;p&gt;Run the command in your terminal:&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="nv"&gt;$ &lt;/span&gt;aws login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To sign in to a named profile, or to create one, add &lt;code&gt;--profile&lt;/code&gt;:&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="nv"&gt;$ &lt;/span&gt;aws login &lt;span class="nt"&gt;--profile&lt;/span&gt; my-dev-profile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the profile is new, or no Region is set, the CLI asks for an AWS Region and offers &lt;code&gt;us-east-1&lt;/code&gt; as the default. You can change the Region later with &lt;code&gt;aws configure set region NEW_REGION&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The CLI then tries to open your default browser on the sign-in page. You can pick one of your active console sessions or sign in afresh. In the browser, choose the credentials to use, then return to the terminal.&lt;/p&gt;

&lt;p&gt;Suppose the profile already holds a different session. For example, it was set up as a read-only user and you have now signed in as an admin user. The CLI asks whether to overwrite the existing session, and it waits for a y or n. A final message confirms the completed profile configuration.&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%2F90b6n6u0xjqd601pxd3c.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%2F90b6n6u0xjqd601pxd3c.png" alt="You run aws login, sign in through the browser, and the CLI caches temporary credentials" width="800" height="576"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The browser proves who you are; the CLI keeps temporary credentials&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The command still works on a machine with no browser, such as a remote server. Use &lt;code&gt;aws login --remote&lt;/code&gt; and the CLI prints a URL to open on another device. After you sign in there, you copy the authorization code back into the CLI prompt.&lt;/p&gt;

&lt;p&gt;You can also control which of the two flows is allowed. The two flows have separate resource ARNs that you can use in IAM policies:&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%2Fxzdrkbf1l516e1j3lxub.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%2Fxzdrkbf1l516e1j3lxub.png" alt="aws login uses the localhost ARN; aws login --remote uses the remote ARN" width="799" height="181"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Same-device and cross-device sign-in each have their own ARN to allow or deny&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  get-caller-identity proves who the CLI now is
&lt;/h2&gt;

&lt;p&gt;Before you trust the session, ask AWS who you are:&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="nv"&gt;$ &lt;/span&gt;aws sts get-caller-identity
&lt;span class="nv"&gt;$ &lt;/span&gt;aws sts get-caller-identity &lt;span class="nt"&gt;--profile&lt;/span&gt; my-dev-profile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first command uses the default profile. The second uses a named one. You should see the identity you chose in the browser.&lt;/p&gt;

&lt;p&gt;The credentials then look after themselves. The CLI and SDKs refresh the cached credentials every 15 minutes as needed. The whole session lasts up to the IAM principal's set session duration, to a maximum of 12 hours, after which you run &lt;code&gt;aws login&lt;/code&gt; again.&lt;/p&gt;

&lt;p&gt;Think of it as a day pass that renews itself at the turnstile, rather than a key you cut and carry forever.&lt;/p&gt;

&lt;h2&gt;
  
  
  The simulator answers "allowed or denied" without touching anything
&lt;/h2&gt;

&lt;p&gt;The IAM policy simulator evaluates a request against the policies you give it. It never sends that request to any AWS service. For every action and resource you test, it returns one of two outcomes: allowed or denied. When the outcome is an allow or an explicit deny, it also names the policy statement that produced it.&lt;/p&gt;

&lt;p&gt;The simulator has two modes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Principal mode&lt;/strong&gt; tests the policies already attached to an existing user, role or group.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Custom mode&lt;/strong&gt; tests policies that you write or paste in. Nothing is saved to your account.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Custom mode is the one to use when checking a draft before you attach it. On the command line, custom mode is &lt;code&gt;aws iam simulate-custom-policy&lt;/code&gt;. Policies already attached to an identity use &lt;code&gt;simulate-principal-policy&lt;/code&gt; instead.&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%2Fzt6by7w7a3ngf3pwfibu.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%2Fzt6by7w7a3ngf3pwfibu.png" alt="Policies, actions, resources and context values go into the simulator, which returns one of three decisions" width="800" height="281"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The simulator weighs policies and inputs, then returns a decision and no service response&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A custom policy is proved with one command and a context value
&lt;/h2&gt;

&lt;p&gt;Here is the draft policy. It allows every DynamoDB action, but only after a set date and time. The command below simulates the &lt;code&gt;dynamodb:CreateBackup&lt;/code&gt; action and supplies a value for the &lt;code&gt;aws:CurrentTime&lt;/code&gt; key that the condition checks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws iam simulate-custom-policy &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--policy-input-list&lt;/span&gt; &lt;span class="s1"&gt;'{"Version":"2012-10-17","Statement":{"Effect":"Allow","Action":"dynamodb:*","Resource":"*","Condition":{"DateGreaterThan":{"aws:CurrentTime":"2018-08-16T12:00:00Z"}}}}'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--action-names&lt;/span&gt; dynamodb:CreateBackup &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--context-entries&lt;/span&gt; &lt;span class="s2"&gt;"ContextKeyName='aws:CurrentTime',ContextKeyValues='2019-04-25T11:00:00Z',ContextKeyType=date"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The supplied date is later than the condition's date. The result therefore shows &lt;code&gt;"EvalDecision": "allowed"&lt;/code&gt;, and its &lt;code&gt;MatchedStatements&lt;/code&gt; entry points to &lt;code&gt;PolicyInputList.1&lt;/code&gt;, the first policy you passed in.&lt;/p&gt;

&lt;p&gt;A passing test proves little on its own. Now prove that the condition actually bites by changing the context value to &lt;code&gt;2014-04-25T11:00:00Z&lt;/code&gt;, a date before the one the policy requires. The decision becomes &lt;code&gt;implicitDeny&lt;/code&gt;, and &lt;code&gt;MatchedStatements&lt;/code&gt; is empty.&lt;/p&gt;

&lt;p&gt;Two allowed actions on their own would not show that the condition works. A passing case alongside a failing one does. In practice, a sensible habit is to write one test that should pass and one that should fail for every condition you care about.&lt;/p&gt;

&lt;p&gt;A few rules for the inputs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Action names must include the service prefix, such as &lt;code&gt;iam:CreateUser&lt;/code&gt;, and wildcards are not allowed.&lt;/li&gt;
&lt;li&gt;If you leave out &lt;code&gt;--resource-arns&lt;/code&gt;, the resource defaults to &lt;code&gt;*&lt;/code&gt;, meaning all resources.&lt;/li&gt;
&lt;li&gt;The resources you name do not need to exist in your account.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Reading the result: the decision, the statement, the missing keys
&lt;/h2&gt;

&lt;p&gt;Each result carries an &lt;code&gt;EvalDecision&lt;/code&gt; with one of three values. When several statements apply, one explicit deny overrides any number of allows, and only the deny statement appears in the result.&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%2Fv6mi4l3fw02ve57tl2k8.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%2Fv6mi4l3fw02ve57tl2k8.png" alt="allowed and explicitDeny name a statement; implicitDeny matches none" width="800" height="264"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Two ways to be denied, and only one of them names a statement&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Also watch &lt;code&gt;MissingContextValues&lt;/code&gt;. It lists the context keys your policies need but that you did not supply. If a supplied value does not satisfy a condition, the action is denied.&lt;/p&gt;

&lt;p&gt;The simulator fills in some keys by itself. These are the principal keys, such as &lt;code&gt;aws:PrincipalAccount&lt;/code&gt; and &lt;code&gt;aws:UserName&lt;/code&gt;, and organisation keys such as &lt;code&gt;aws:PrincipalOrgID&lt;/code&gt;. You supply every other key yourself. To find out which keys a draft policy needs before you run it, the CLI reference points to &lt;code&gt;GetContextKeysForCustomPolicy&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Several resources now come back as one aggregate answer
&lt;/h2&gt;

&lt;p&gt;In version 2.38.1, the simulator returns a single evaluation result per action, however many resource ARNs you pass. Older behaviour returned one result per resource, each carrying the same overall decision.&lt;/p&gt;

&lt;p&gt;The top-level &lt;code&gt;EvalDecision&lt;/code&gt; is now the most restrictive decision across all resources. If any resource produces &lt;code&gt;explicitDeny&lt;/code&gt;, the top-level decision is &lt;code&gt;explicitDeny&lt;/code&gt;. To see the decision for each resource, read &lt;code&gt;ResourceSpecificResults&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This affects how you read the output. The top-level &lt;code&gt;EvalResourceName&lt;/code&gt; is now an ARN template for the resource type, not one of your ARNs. Any script that parsed per-resource answers from the top level needs to read &lt;code&gt;ResourceSpecificResults&lt;/code&gt; instead.&lt;/p&gt;

&lt;p&gt;Some features have limits worth knowing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can include only one resource-based policy per simulation.&lt;/li&gt;
&lt;li&gt;The simulator never fetches a resource's policy for you, so you must pass it in.&lt;/li&gt;
&lt;li&gt;Simulating resource-based policies is not supported for IAM roles.&lt;/li&gt;
&lt;li&gt;Service control policies can be passed in order, from the organisation root down to the account. Their matched statements are not shown in the results, for security reasons.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Cleaning up: where the session lives, how to look at it, how to delete it
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Where it is stored.&lt;/strong&gt; Signing in with the default profile writes a &lt;code&gt;login_session&lt;/code&gt; line to the &lt;code&gt;config&lt;/code&gt; file. That line holds your identity's ARN, next to the Region. The temporary credentials, and the details needed to refresh them, are cached in &lt;code&gt;~/.aws/login/cache&lt;/code&gt; on Linux and macOS, or &lt;code&gt;%USERPROFILE%\.aws\login\cache&lt;/code&gt; on Windows. The &lt;code&gt;AWS_LOGIN_CACHE_DIRECTORY&lt;/code&gt; environment variable moves that cache to another location.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Look at it.&lt;/strong&gt; Open the &lt;code&gt;config&lt;/code&gt; file and find the &lt;code&gt;login_session&lt;/code&gt; entry for your profile. List the cache directory too; its file names are based on the resolved profile.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Delete it.&lt;/strong&gt; You can let the credentials expire, or remove them now:&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="nv"&gt;$ &lt;/span&gt;aws &lt;span class="nb"&gt;logout&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;aws &lt;span class="nb"&gt;logout&lt;/span&gt; &lt;span class="nt"&gt;--profile&lt;/span&gt; my-dev-profile
&lt;span class="nv"&gt;$ &lt;/span&gt;aws &lt;span class="nb"&gt;logout&lt;/span&gt; &lt;span class="nt"&gt;--all&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With no profile on the command line or in &lt;code&gt;AWS_PROFILE&lt;/code&gt;, &lt;code&gt;aws logout&lt;/code&gt; signs out the default profile. The &lt;code&gt;--all&lt;/code&gt; option signs out every profile that uses login credentials.&lt;/p&gt;

&lt;p&gt;The policy work needs no cleanup. Custom-mode policies are never saved to your account, and editing a policy inside the simulator leaves the real one unchanged.&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%2Fqdapzbth2m68p8wivllw.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%2Fqdapzbth2m68p8wivllw.png" alt="aws login writes the config entry and the cache; you inspect both, then aws logout deletes the cached credentials" width="800" height="169"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A login session is written to two places and removed by one command&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;aws login&lt;/code&gt; needs CLI version 2.32.0 or later. It swaps a console sign-in for temporary credentials that refresh themselves for up to 12 hours, so no long-lived key is stored on disk.&lt;/li&gt;
&lt;li&gt;Confirm the session with &lt;code&gt;aws sts get-caller-identity&lt;/code&gt; before you rely on it.&lt;/li&gt;
&lt;li&gt;Prove a draft policy in custom mode with &lt;code&gt;simulate-custom-policy&lt;/code&gt;. Pair a case that should pass with one that should fail, and supply every context key the conditions check.&lt;/li&gt;
&lt;li&gt;In version 2.38.1, read per-resource decisions from &lt;code&gt;ResourceSpecificResults&lt;/code&gt;; the top-level decision is an aggregate of all resources.&lt;/li&gt;
&lt;li&gt;Clean up with &lt;code&gt;aws logout&lt;/code&gt;. Simulated policies leave nothing behind in your account.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The limit is the one the simulator states about itself: its results can differ from your live environment. It does not evaluate resource control policies. It can also diverge on VPC endpoint policies, role chaining, or resources that have several resource-based policies. A simulated "allowed" is strong evidence, not proof. This lab does not cover the final check: confirming the attached policy's behaviour against your live account.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Full article: &lt;a href="https://techeazyconsulting.com/signing-the-aws-cli-in-without-access-keys-then-proving-a-policy-in-the-simulator" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/signing-the-aws-cli-in-without-access-keys-then-proving-a-policy-in-the-simulator&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Full chapter: &lt;a href="https://techeazyconsulting.com/courses/hands-on-cloud-for-freshers/session-02" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/courses/hands-on-cloud-for-freshers/session-02&lt;/a&gt;
&amp;lt;!-- cf-origin:end --&amp;gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>ai</category>
      <category>career</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How to find the closed port that stops an EC2 web page loading, and lock down SSH</title>
      <dc:creator>TechEazy Consulting</dc:creator>
      <pubDate>Fri, 16 Oct 2026 03:24:08 +0000</pubDate>
      <link>https://dev.to/techeazy_consulting/how-to-find-the-closed-port-that-stops-an-ec2-web-page-loading-and-lock-down-ssh-mgk</link>
      <guid>https://dev.to/techeazy_consulting/how-to-find-the-closed-port-that-stops-an-ec2-web-page-loading-and-lock-down-ssh-mgk</guid>
      <description>&lt;p&gt;You launched an Amazon EC2 instance, installed a web server, and typed its public address into a browser. The tab spins and then times out. Nothing on the server looks broken, and the cause is outside the server. In almost every first attempt, the block is the instance's &lt;strong&gt;security group&lt;/strong&gt;, the virtual firewall that sits in front of it. This article argues that two changes fix the problem and make the instance safer. First, open only ports 80 and 443 to the world. Second, close SSH to everyone except you, and use EC2 Instance Connect so you stop handing out keys. The steps below cover where to look, what each rule should say, what you should see afterwards, and what to remove when you finish.&lt;/p&gt;

&lt;h2&gt;
  
  
  The page times out because no inbound rule admits web traffic
&lt;/h2&gt;

&lt;p&gt;A security group acts as a virtual firewall for your EC2 instances and controls incoming and outgoing traffic. Inbound rules control the traffic coming in to your instance, and outbound rules control the traffic going out. The only traffic that reaches the instance is the traffic the security group rules allow.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Think of it as a guest list at a door.&lt;/em&gt; Nobody gets in unless the list names them. A browser asking for your page is a guest the list does not yet name. The web server process may be running perfectly, but the request is turned away before it reaches the server.&lt;/p&gt;

&lt;p&gt;This also explains why the failure usually shows up as a timeout rather than an error page. In practice, a request the firewall drops never gets a reply, so the browser waits until it gives up. If you see a slow timeout instead of an immediate refusal, a missing rule is the first thing to check.&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%2Fsihh1nwwbh1ripru3wm7.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%2Fsihh1nwwbh1ripru3wm7.png" alt="A request passes the security group to the web server only when a matching inbound rule exists" width="799" height="274"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A browser request reaches the web server only if a security group rule allows it&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1 — Read every security group on the instance, not just one
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; find out which rules actually apply to your instance.&lt;/p&gt;

&lt;p&gt;You can associate an instance with several security groups, and you can associate one security group with several instances. When Amazon EC2 decides whether to let traffic reach an instance, it evaluates all the rules from all the security groups associated with that instance. If you did not specify a security group at launch, Amazon EC2 used the default security group for the VPC (your private network inside the cloud).&lt;/p&gt;

&lt;p&gt;That gives you a short investigation:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the instance's details in the EC2 console and list every security group attached to it.&lt;/li&gt;
&lt;li&gt;For each group, open the &lt;strong&gt;Inbound rules&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Look for a rule with protocol TCP, port 80 or 443, and a source that includes the address you are browsing from.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;What you should see:&lt;/strong&gt; if no group has such a rule, you have found the closed door. A common surprise is an instance running on the default group. In practice that group often has no rule for web traffic from the internet, because nobody added one.&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%2Fv0yt9u05f88824mo2m82.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%2Fv0yt9u05f88824mo2m82.png" alt="A table of four checks, where to find each, and what a missing web rule looks like" width="800" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Every attached group counts, so check each group's inbound rules for ports 80 and 443&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2 — Add the web server rules and watch the page load
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; let anyone on the internet reach your page, and nothing else.&lt;/p&gt;

&lt;p&gt;An instance set up as a web server needs security group rules that allow inbound HTTP and HTTPS access. The documented rules allow TCP port 80 (HTTP) and TCP port 443 (HTTPS) from 0.0.0.0/0, which means any IPv4 address. If your VPC is enabled for IPv6, you can add matching rules for port 80 and port 443 from ::/0, meaning any IPv6 address. TCP has protocol number 6. You may see that number in rule listings.&lt;/p&gt;

&lt;p&gt;Add these rules to one of the groups attached to the instance. Do not add them to an unrelated group.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm32ky0e2v229aqwbbelq.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%2Fm32ky0e2v229aqwbbelq.png" alt="A table pairing ports 80 and 443 with IPv4 and IPv6 sources that allow web access from anywhere" width="800" height="251"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Four inbound rules open HTTP and HTTPS to any IPv4 or IPv6 address&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You do not need to restart anything. You can change a security group's rules at any time, and new or modified rules are applied automatically to every instance associated with the group.&lt;/p&gt;

&lt;p&gt;You also do not need a matching outbound rule for the replies. Security groups are &lt;strong&gt;stateful&lt;/strong&gt;: responses to allowed inbound traffic may flow out regardless of the outbound rules. The reverse also holds. If your instance sends a request, the response may flow back in regardless of the inbound rules.&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%2Fi3y42151nc64yvswt4k4.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%2Fi3y42151nc64yvswt4k4.png" alt="A request passes an inbound rule and its response returns without needing an outbound rule" width="800" height="356"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Statefulness lets the reply leave without an outbound rule once the request is allowed in&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What you should see:&lt;/strong&gt; reload the browser tab and the page should appear. If it still times out, a sensible next check is whether the web server is listening on the port you opened. A rule for 443 does nothing if the server only serves on 80.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3 — Narrow SSH to your own address
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; keep your administrative access and close it to everyone else.&lt;/p&gt;

&lt;p&gt;To connect to a Linux instance, the security group must have an inbound rule allowing SSH, which is TCP port 22. Windows instances use RDP on port 3389 instead. The documented source for that rule is not "anywhere". It is the public IPv4 address of your computer, or a range of addresses in your local network. If your VPC is enabled for IPv6 and your instance has an IPv6 address, you can enter an IPv6 address or range instead. Ranges are written in CIDR notation: an address followed by a slash and a prefix length, such as /32 for exactly one IPv4 address.&lt;/p&gt;

&lt;p&gt;The difference between the web rules and the SSH rule is the point of this step. Your page is meant for everyone. Your shell is meant for you. A sensible default is to treat any port 22 rule with source 0.0.0.0/0 as a mistake to correct, even when it was added "just to get in".&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the group's inbound rules, find the SSH rule on port 22.&lt;/li&gt;
&lt;li&gt;Change its source from 0.0.0.0/0 to your computer's public address with /32, or to your local network's range.&lt;/li&gt;
&lt;li&gt;Save. The change applies automatically to every instance associated with the group.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;What you should see:&lt;/strong&gt; SSH from your own machine still works, and SSH from any other network no longer reaches the instance. Keep in mind that your public address can change when you move between networks. In practice, if you suddenly cannot connect from a new location, the source in this rule is the first thing to update.&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%2Fv7urf9xdnq32ykkoe143.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%2Fv7urf9xdnq32ykkoe143.png" alt="Web rules allow any address, while the SSH rule allows only your computer's address or local range" width="797" height="97"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Web ports face the whole internet while SSH faces only your own address&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4 — Stop sharing keys by connecting through EC2 Instance Connect
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; control who may SSH in through permissions rather than by passing private key files around.&lt;/p&gt;

&lt;p&gt;Narrowing the source address limits &lt;em&gt;where&lt;/em&gt; SSH can come from. It does not decide &lt;em&gt;who&lt;/em&gt; holds the key. EC2 Instance Connect addresses that second question. It provides a secure way to connect to Linux instances over SSH. It uses identity and access management policies and principals to control SSH access, which removes the need to share and manage SSH keys. Every connection request made with EC2 Instance Connect is logged, so you can audit connection requests.&lt;/p&gt;

&lt;p&gt;Here is how a connection works. The EC2 Instance Connect API pushes an SSH public key to the instance metadata, where the key remains for 60 seconds. An access policy attached to your user is what authorises you to push that key. On the instance, the SSH daemon uses two settings, &lt;code&gt;AuthorizedKeysCommand&lt;/code&gt; and &lt;code&gt;AuthorizedKeysCommandUser&lt;/code&gt;, which are configured when EC2 Instance Connect is installed, to look up the public key in the instance metadata and authenticate you.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Think of it as a visitor badge printed at reception:&lt;/em&gt; it is issued to a named person, it works only briefly, and the desk keeps a record. A long-lived key file is more like a house key that can be copied and lent without anyone knowing.&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%2F4u0nvzc04fnzxeztm7ja.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%2F4u0nvzc04fnzxeztm7ja.png" alt="A policy-authorised user pushes a key to metadata, and the SSH daemon reads it there to authenticate the session" width="800" height="277"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Instance Connect pushes a short-lived key that the SSH daemon looks up to authenticate you&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You can connect with EC2 Instance Connect from the Amazon EC2 console or from the SSH client of your choice. It costs nothing extra. As of 2026-10-14, it is available in all AWS Regions except the European Sovereign Cloud (Germany), and it is not supported in Local Zones.&lt;/p&gt;

&lt;p&gt;One point is easy to miss. Instance Connect still connects over SSH, so the port 22 rule from Step 3 still matters. Instance Connect decides who is allowed, and the security group decides from which address. In practice you want both controls in place.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What you should see:&lt;/strong&gt; a shell session opens without you having copied a private key onto your machine. Each attempt is recorded in the audit log.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5 — Clean up what you opened
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; leave nothing exposed that you no longer need.&lt;/p&gt;

&lt;p&gt;Security is a shared responsibility. Security groups are one tool, and you have to configure them to meet your own needs. That responsibility includes removing things as well as adding them. Rules can be modified at any time, you can change an instance's security groups after launch, and you can delete a security group.&lt;/p&gt;

&lt;p&gt;A sensible teardown order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Remove any temporary rule you added while debugging, especially an SSH rule open to 0.0.0.0/0.&lt;/li&gt;
&lt;li&gt;If you are finished with the instance, remove it before deleting groups, so no group is still associated with something running.&lt;/li&gt;
&lt;li&gt;Delete any security group you created only for this exercise.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Security groups carry no additional charge. Cost is therefore no reason to delete them. The reason is exposure: a forgotten wide-open group can later be attached to a new instance by mistake.&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%2Fj0l6rmhr7tj7ucpq4k46.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%2Fj0l6rmhr7tj7ucpq4k46.png" alt="Three cleanup steps in order: remove the open SSH rule, remove the instance, delete the exercise groups" width="800" height="84"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Teardown removes risky rules first, then the instance, then the groups made for the exercise&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  When the security group is not the whole story
&lt;/h2&gt;

&lt;p&gt;Security groups are not the only possible filter. If your requirements go beyond what security groups provide, you can run your own firewall on the instance as well. If you or a setup script has done that, a correct security group can still sit in front of a host firewall that blocks port 80. Also, if the instance sits behind a load balancer, the load balancer's own security group must allow communication with the instances. In that design, the browser's traffic meets the load balancer's rules first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A page that times out on a fresh instance is most often a missing inbound rule. Check every security group attached to the instance, because all of their rules are evaluated together.&lt;/li&gt;
&lt;li&gt;Web traffic needs inbound TCP 80 and 443 from 0.0.0.0/0, plus ::/0 when the VPC uses IPv6. Rule changes apply at once, and statefulness lets replies out without an outbound rule.&lt;/li&gt;
&lt;li&gt;SSH on port 22 should come from your own public address or local range, never from everywhere.&lt;/li&gt;
&lt;li&gt;EC2 Instance Connect replaces shared keys with policy-controlled, short-lived keys and logged connection requests, but it still needs the port 22 rule.&lt;/li&gt;
&lt;li&gt;Clean up deliberately: remove temporary open rules first, then delete groups made only for the exercise.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This article does not settle everything a stuck page can involve. It does not cover a web server that is not listening, a firewall on the instance itself, or what happens to the instance's public address when you stop and start it, which the source pages used here do not describe. It also explains each change in terms of the rules to set, not the exact command-line syntax, which those pages do not give.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Full article: &lt;a href="https://techeazyconsulting.com/how-to-find-the-closed-port-that-stops-an-ec2-web-page-loading-and-lock-down-ssh" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/how-to-find-the-closed-port-that-stops-an-ec2-web-page-loading-and-lock-down-ssh&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Full chapter: &lt;a href="https://techeazyconsulting.com/courses/hands-on-cloud-for-freshers/session-04" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/courses/hands-on-cloud-for-freshers/session-04&lt;/a&gt;
&amp;lt;!-- cf-origin:end --&amp;gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>infrastructure</category>
      <category>networking</category>
      <category>security</category>
    </item>
    <item>
      <title>🔐 Use the AWS CLI Without Access Keys, and Prove a Policy Before You Attach It (Hands-on)</title>
      <dc:creator>TechEazy Consulting</dc:creator>
      <pubDate>Sun, 11 Oct 2026 05:13:28 +0000</pubDate>
      <link>https://dev.to/techeazy_consulting/use-the-aws-cli-without-access-keys-and-prove-a-policy-before-you-attach-it-hands-on-4ek3</link>
      <guid>https://dev.to/techeazy_consulting/use-the-aws-cli-without-access-keys-and-prove-a-policy-before-you-attach-it-hands-on-4ek3</guid>
      <description>&lt;h2&gt;
  
  
  🎤 The interview question
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;"How do you use the AWS CLI without an access key, and how do you know a policy works before you attach it?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The strong answer is two things you have &lt;strong&gt;actually run&lt;/strong&gt;: sign the CLI in with &lt;code&gt;aws login&lt;/code&gt;, and prove the policy in the &lt;strong&gt;IAM policy simulator&lt;/strong&gt; first. 20 minutes. 👇&lt;/p&gt;

&lt;p&gt;👉 Flow: &lt;strong&gt;Sign in without a key → Write the policy → Prove it in the simulator → Store it, look, delete&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🧰 Before you start
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;💻 &lt;strong&gt;AWS CLI v2, version 2.32.0 or later&lt;/strong&gt; (&lt;code&gt;aws login&lt;/code&gt; needs it). Check with &lt;code&gt;aws --version&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;👤 &lt;strong&gt;Signed in to the console&lt;/strong&gt; as your everyday admin IAM user (not root). It needs the &lt;code&gt;SignInLocalDevelopmentAccess&lt;/code&gt; managed policy or broader, e.g. &lt;code&gt;AdministratorAccess&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;🔑 Permissions used: &lt;code&gt;iam:SimulateCustomPolicy&lt;/code&gt;, &lt;code&gt;iam:CreatePolicy&lt;/code&gt;, &lt;code&gt;iam:GetPolicyVersion&lt;/code&gt;, &lt;code&gt;iam:DeletePolicy&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;🌍 &lt;strong&gt;Region:&lt;/strong&gt; &lt;code&gt;ap-south-1&lt;/code&gt;, or your usual one.&lt;/li&gt;
&lt;li&gt;💵 &lt;strong&gt;Cost: $0.&lt;/strong&gt; IAM and STS are free, and the simulator sends no real request to any service. No Free plan credits used.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔐 Step 1: Sign the CLI in without a key
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; an access key works until someone deletes it; one pushed to GitHub is a stolen account. &lt;code&gt;aws login&lt;/code&gt; reuses your console sign-in and gives the CLI &lt;strong&gt;temporary&lt;/strong&gt; credentials (refreshed every 15 minutes, 12 hours max).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws &lt;span class="nt"&gt;--version&lt;/span&gt;
aws login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At &lt;code&gt;AWS Region [us-east-1]:&lt;/code&gt; type &lt;code&gt;ap-south-1&lt;/code&gt;. In the browser, pick your user, then return.&lt;/p&gt;

&lt;p&gt;✅ Expected: &lt;code&gt;aws-cli/2.32.0&lt;/code&gt; or newer, then &lt;code&gt;Updated profile default to use arn:aws:...&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now ask "who am I?" (it needs no permissions, so run it first whenever something is denied):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws sts get-caller-identity
aws configure list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Expected: an &lt;code&gt;Arn&lt;/code&gt; ending in your user name, and &lt;code&gt;login&lt;/code&gt; in the TYPE column.&lt;/p&gt;

&lt;p&gt;⚠️ &lt;strong&gt;If&lt;/strong&gt; &lt;code&gt;aws login&lt;/code&gt; is rejected as an unknown command → your CLI is older than 2.32.0. Update: &lt;code&gt;curl -fsSL https://awscli.amazonaws.com/v2/install.sh | bash&lt;/code&gt;. &lt;strong&gt;If&lt;/strong&gt; you see an old user or &lt;code&gt;ExpiredToken&lt;/code&gt; → an access key in &lt;code&gt;~/.aws/credentials&lt;/code&gt; wins. Delete it and log in again.&lt;/p&gt;




&lt;h2&gt;
  
  
  📝 Step 2: Write a read-only policy
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; interviewers listen for "least privilege": &lt;strong&gt;list one bucket, read its objects, nothing else&lt;/strong&gt;. The bucket needn't exist yet.&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="nv"&gt;BUCKET&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;hoc-site-ar-4821
&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; ~/hoc-unit2 &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; ~/hoc-unit2
&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; hoc-read-policy.json &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt;
{
  "Version": "2012-10-17",
  "Statement": [
    {"Sid": "ListTheBucket", "Effect": "Allow", "Action": "s3:ListBucket", "Resource": "arn:aws:s3:::&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;BUCKET&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"},
    {"Sid": "ReadItsObjects", "Effect": "Allow", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;BUCKET&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;/*"}
  ]
}
&lt;/span&gt;&lt;span class="no"&gt;EOF
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👀 Note the two ARNs: &lt;code&gt;ListBucket&lt;/code&gt; acts on the &lt;strong&gt;bucket&lt;/strong&gt;, &lt;code&gt;GetObject&lt;/code&gt; on the &lt;strong&gt;objects&lt;/strong&gt; (&lt;code&gt;/*&lt;/code&gt;).&lt;/p&gt;




&lt;h2&gt;
  
  
  🧪 Step 3: Prove it in the simulator
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; the simulator answers "would this be allowed?" without touching anything or saving the policy. A helper makes each test one line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sim&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; aws iam simulate-custom-policy &lt;span class="nt"&gt;--policy-input-list&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--action-names&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$2&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;--resource-arns&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$3&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--query&lt;/span&gt; &lt;span class="s1"&gt;'EvaluationResults[0].EvalDecision'&lt;/span&gt; &lt;span class="nt"&gt;--output&lt;/span&gt; text&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;

sim hoc-read-policy.json s3:ListBucket arn:aws:s3:::&lt;span class="nv"&gt;$BUCKET&lt;/span&gt;
sim hoc-read-policy.json s3:GetObject  arn:aws:s3:::&lt;span class="nv"&gt;$BUCKET&lt;/span&gt;/index.html
sim hoc-read-policy.json s3:PutObject  arn:aws:s3:::&lt;span class="nv"&gt;$BUCKET&lt;/span&gt;/index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Expected: &lt;code&gt;allowed&lt;/code&gt;, &lt;code&gt;allowed&lt;/code&gt;, &lt;code&gt;implicitDeny&lt;/code&gt; (the only other answer is &lt;code&gt;explicitDeny&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;📚 Why &lt;code&gt;implicitDeny&lt;/code&gt;? The &lt;a href="https://techeazyconsulting.com/courses/hands-on-cloud-for-freshers/session-02" rel="noopener noreferrer"&gt;full chapter explains how AWS decides&lt;/a&gt;, with an eight-request test list for this policy.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧨 Break it on purpose
&lt;/h2&gt;

&lt;p&gt;Put &lt;code&gt;ListBucket&lt;/code&gt; on the &lt;strong&gt;object&lt;/strong&gt; ARN, a classic beginner bug:&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;sed&lt;/span&gt; &lt;span class="s2"&gt;"s#&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;arn:aws:s3:::&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;BUCKET&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;}#&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;arn:aws:s3:::&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;BUCKET&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/*&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;}#"&lt;/span&gt; hoc-read-policy.json &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; broken.json
sim broken.json s3:ListBucket arn:aws:s3:::&lt;span class="nv"&gt;$BUCKET&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Expected: &lt;code&gt;implicitDeny&lt;/code&gt;. Wrong resource ARN, so listing fails, and you caught it &lt;strong&gt;before&lt;/strong&gt; a real user did.&lt;/p&gt;




&lt;h2&gt;
  
  
  📦 Step 4: Store it, look at it, delete it
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; the clean-up habit. Created, never attached, deleted.&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="nv"&gt;POLICY_ARN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;aws iam create-policy &lt;span class="nt"&gt;--policy-name&lt;/span&gt; hoc-read-site-bucket &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--policy-document&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;hoc-read-policy.json&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--tags&lt;/span&gt; &lt;span class="nv"&gt;Key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;project,Value&lt;span class="o"&gt;=&lt;/span&gt;hands-on-cloud &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--query&lt;/span&gt; Policy.Arn &lt;span class="nt"&gt;--output&lt;/span&gt; text&lt;span class="si"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$POLICY_ARN&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
aws iam get-policy-version &lt;span class="nt"&gt;--policy-arn&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$POLICY_ARN&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;--version-id&lt;/span&gt; v1 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--query&lt;/span&gt; &lt;span class="s1"&gt;'PolicyVersion.Document.Statement[].Sid'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Expected: &lt;code&gt;arn:aws:iam::&amp;lt;your account ID&amp;gt;:policy/hoc-read-site-bucket&lt;/code&gt;, then &lt;code&gt;["ListTheBucket", "ReadItsObjects"]&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧹 Cleanup
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws iam delete-policy &lt;span class="nt"&gt;--policy-arn&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$POLICY_ARN&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; ~/hoc-unit2/broken.json
aws &lt;span class="nb"&gt;logout&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ &lt;code&gt;delete-policy&lt;/code&gt; prints nothing. After &lt;code&gt;aws logout&lt;/code&gt;, &lt;code&gt;get-caller-identity&lt;/code&gt; fails: no credentials left. 🎉&lt;/p&gt;




&lt;h2&gt;
  
  
  💬 Say it in the interview
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;"I never create access keys for my own CLI: &lt;code&gt;aws login&lt;/code&gt; gives it temporary credentials that expire on their own. Before a policy goes anywhere, I run the requests that must be allowed and must be denied through the IAM policy simulator, and fix it until they match."&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🎯 What you can now say
&lt;/h2&gt;

&lt;p&gt;✅ "My CLI signs in with &lt;code&gt;aws login&lt;/code&gt;, not a key"&lt;br&gt;
✅ "First command when denied: &lt;code&gt;aws sts get-caller-identity&lt;/code&gt;"&lt;br&gt;
✅ "&lt;code&gt;ListBucket&lt;/code&gt; needs the bucket ARN, &lt;code&gt;GetObject&lt;/code&gt; the object ARN"&lt;br&gt;
✅ "I prove a policy in the simulator before I attach it"&lt;/p&gt;




&lt;h2&gt;
  
  
  📚 Go deeper
&lt;/h2&gt;

&lt;p&gt;This is the hands-on cut of &lt;strong&gt;Session 2&lt;/strong&gt; of our free &lt;em&gt;Hands-on Cloud for Freshers&lt;/em&gt; course: the three rules AWS decides by, and the model answer.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://techeazyconsulting.com/courses/hands-on-cloud-for-freshers/session-02" rel="noopener noreferrer"&gt;Read the full chapter on TechEazy Consulting&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🚀 Real projects and a real internship certificate get you hired. Start at &lt;a href="https://www.techeazyconsulting.com" rel="noopener noreferrer"&gt;TechEazy Consulting&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>beginners</category>
      <category>security</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>🛡️ New AWS Account? Stop Surprise Bills in 10 Minutes (Hands-on)</title>
      <dc:creator>TechEazy Consulting</dc:creator>
      <pubDate>Sun, 11 Oct 2026 04:28:20 +0000</pubDate>
      <link>https://dev.to/techeazy_consulting/new-aws-account-stop-surprise-bills-in-10-minutes-hands-on-2loc</link>
      <guid>https://dev.to/techeazy_consulting/new-aws-account-stop-surprise-bills-in-10-minutes-hands-on-2loc</guid>
      <description>&lt;h2&gt;
  
  
  🎤 The interview question
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;"You just opened a new AWS account. How do you make sure a mistake can't quietly cost you money?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Freshers get asked this a lot. A good answer is three things you have &lt;strong&gt;actually done&lt;/strong&gt;: know your plan, set an alert, and keep everything in one Region with one tag. Let's do all three in about 10 minutes. 👇&lt;/p&gt;

&lt;p&gt;👉 Flow: &lt;strong&gt;Check plan → Budget alert → Free Tier usage → One Region + one tag&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🧾 Step 1: Know which plan you're on
&lt;/h2&gt;

&lt;p&gt;Since July 2025, a new AWS account picks a &lt;strong&gt;Free plan&lt;/strong&gt; or a &lt;strong&gt;Paid plan&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;💵 Both get &lt;strong&gt;USD $100&lt;/strong&gt; in credits at sign-up, and up to &lt;strong&gt;$100 more&lt;/strong&gt; for completing activities&lt;/li&gt;
&lt;li&gt;⏳ The Free plan ends after &lt;strong&gt;6 months&lt;/strong&gt; or when credits run out, whichever is first&lt;/li&gt;
&lt;li&gt;🔒 When it ends, the account &lt;strong&gt;closes&lt;/strong&gt;. You have 90 days to upgrade before your data is deleted&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Check yours: &lt;strong&gt;AWS Console → Billing and Cost Management → Home&lt;/strong&gt; (credit balance and plan are shown there).&lt;/p&gt;

&lt;p&gt;✅ Interview line: &lt;em&gt;"I know which plan I'm on and when it ends."&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🔔 Step 2: Create a budget that emails you
&lt;/h2&gt;

&lt;p&gt;Set your account ID once:&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="nv"&gt;ACCOUNT_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;aws sts get-caller-identity &lt;span class="nt"&gt;--query&lt;/span&gt; Account &lt;span class="nt"&gt;--output&lt;/span&gt; text&lt;span class="si"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a &lt;strong&gt;$1 monthly budget&lt;/strong&gt; that emails you at 80%:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws budgets create-budget &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--account-id&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$ACCOUNT_ID&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--budget&lt;/span&gt; &lt;span class="s1"&gt;'{"BudgetName":"freshers-1-usd","BudgetLimit":{"Amount":"1","Unit":"USD"},"TimeUnit":"MONTHLY","BudgetType":"COST"}'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--notifications-with-subscribers&lt;/span&gt; &lt;span class="s1"&gt;'[{"Notification":{"NotificationType":"ACTUAL","ComparisonOperator":"GREATER_THAN","Threshold":80,"ThresholdType":"PERCENTAGE"},"Subscribers":[{"SubscriptionType":"EMAIL","Address":"you@example.com"}]}]'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Confirm it exists:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws budgets describe-budgets &lt;span class="nt"&gt;--account-id&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$ACCOUNT_ID&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;--query&lt;/span&gt; &lt;span class="s1"&gt;'Budgets[].BudgetName'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Expected: &lt;code&gt;["freshers-1-usd"]&lt;/code&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  📊 Step 3: See your Free Tier usage
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws freetier get-free-tier-usage &lt;span class="nt"&gt;--region&lt;/span&gt; us-east-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each item shows the service, the limit and how much you've used. 👀 Run it after every lab.&lt;/p&gt;

&lt;p&gt;💡 Also turn on &lt;strong&gt;Billing preferences → Receive AWS Free Tier alerts&lt;/strong&gt; in the console. That's your &lt;strong&gt;second&lt;/strong&gt; way to hear about spending.&lt;/p&gt;




&lt;h2&gt;
  
  
  🌍 Step 4: One Region, one tag
&lt;/h2&gt;

&lt;p&gt;Pick one Region and stick to it, so nothing hides in a Region you never open:&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;span class="nb"&gt;set &lt;/span&gt;region ap-south-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tag everything you create in a lab:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws ec2 create-tags &lt;span class="nt"&gt;--resources&lt;/span&gt; &amp;lt;instance-id&amp;gt; &lt;span class="nt"&gt;--tags&lt;/span&gt; &lt;span class="nv"&gt;Key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;project,Value&lt;span class="o"&gt;=&lt;/span&gt;freshers-lab
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Find everything with that tag before you log off:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws resourcegroupstaggingapi get-resources &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--tag-filters&lt;/span&gt; &lt;span class="nv"&gt;Key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;project,Values&lt;span class="o"&gt;=&lt;/span&gt;freshers-lab &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--query&lt;/span&gt; &lt;span class="s1"&gt;'ResourceTagMappingList[].ResourceARN'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ An empty list &lt;code&gt;[]&lt;/code&gt; = nothing left running. 🎉&lt;/p&gt;




&lt;h2&gt;
  
  
  🧨 Break it on purpose
&lt;/h2&gt;

&lt;p&gt;Set the budget to &lt;strong&gt;$0.01&lt;/strong&gt;, launch a &lt;code&gt;t2.micro&lt;/code&gt; for an hour, and watch for the email. Then stop the instance. Now you &lt;em&gt;know&lt;/em&gt; your alert works.&lt;/p&gt;




&lt;h2&gt;
  
  
  🎯 What you can now say in the interview
&lt;/h2&gt;

&lt;p&gt;✅ "I know my plan and when it ends"&lt;br&gt;
✅ "A budget emails me before I spend real money"&lt;br&gt;
✅ "I check Free Tier usage after every lab"&lt;br&gt;
✅ "I work in one Region and tag everything, so cleanup takes one command"&lt;/p&gt;




&lt;h2&gt;
  
  
  📚 Go deeper
&lt;/h2&gt;

&lt;p&gt;This is the hands-on cut of &lt;strong&gt;Session 1&lt;/strong&gt; of our free &lt;em&gt;Hands-on Cloud for Freshers&lt;/em&gt; course: the full chapter explains &lt;em&gt;why&lt;/em&gt; each step matters and what interviewers listen for.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://techeazyconsulting.com/courses/hands-on-cloud-for-freshers/session-01" rel="noopener noreferrer"&gt;Read the full chapter on TechEazy Consulting&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🚀 Real projects and a real internship certificate get you hired. Start at &lt;a href="https://www.techeazyconsulting.com" rel="noopener noreferrer"&gt;TechEazy Consulting&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>beginners</category>
      <category>cloud</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to explain protecting the AWS root user and everyday admin access in an interview</title>
      <dc:creator>TechEazy Consulting</dc:creator>
      <pubDate>Sun, 11 Oct 2026 03:18:47 +0000</pubDate>
      <link>https://dev.to/techeazy_consulting/how-to-explain-protecting-the-aws-root-user-and-everyday-admin-access-in-an-interview-3pkh</link>
      <guid>https://dev.to/techeazy_consulting/how-to-explain-protecting-the-aws-root-user-and-everyday-admin-access-in-an-interview-3pkh</guid>
      <description>&lt;p&gt;The interviewer leans back and asks: "You've just created a new AWS account. What's the first thing you do about security?" Many freshers answer "enable MFA" and stop there. That answer is correct, but it is incomplete. A complete answer has two halves. First, lock the root user: give it a strong password and multi-factor authentication, create no access keys for it, and control who can recover it. Second, put it away: do everyday work through a separate administrative identity that uses temporary credentials. The rest of this article works through the questions you are likely to hear, answers each from current AWS IAM guidance (as of 2026-10-08), and ends with what to practise before you sit down.&lt;/p&gt;

&lt;h2&gt;
  
  
  The root user is the identity with complete access, so it is not for daily work
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;"What is the AWS account root user?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you first create an AWS account, it comes with a default set of credentials that have complete access to all AWS resources in the account, and this identity is called the AWS account root user. AWS strongly recommends that you don't use the root user unless you have a task that actually requires root user credentials. Instead, you create an administrative user for everyday tasks.&lt;/p&gt;

&lt;p&gt;Think of it as the master key to a building. You don't carry it on your keyring for opening your office each morning. You lock it in a safe and use a key cut for the doors you need.&lt;/p&gt;

&lt;p&gt;A good interview answer names both halves of the idea. The root user is powerful, so you protect it. It is also rarely needed, so you stop using it. Interviewers often listen for whether you mention the second half.&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%2Frifxxigti3pqvrsjq3u8.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%2Frifxxigti3pqvrsjq3u8.png" alt="A new account's root user is locked and kept for root-only tasks, while an administrative user handles everyday tasks" width="800" height="141"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Lock the root user, then route everyday work through an administrative identity&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Locking the root user means a strong password, MFA, and no access keys
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;"How would you secure the root user's credentials?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Start with the password. AWS recommends a password that is strong and unique, and a password manager with strong generation can help. AWS also enforces minimum rules. The password must be 8 to 128 characters long and include at least three of these types: uppercase letters, lowercase letters, numbers and symbols. It also must not match the account name or email address.&lt;/p&gt;

&lt;p&gt;Next, add multi-factor authentication (MFA), meaning a second proof of identity on top of the email address and password. All account types (standalone, management and member accounts) require MFA to be configured for their root user. If MFA is not already enabled, it must be registered within a grace period that begins at the first sign-in attempt to the console. You can register up to eight MFA devices of any mix of supported types, and AWS strongly recommends registering more than one for resilience.&lt;/p&gt;

&lt;p&gt;Supported types include FIDO-certified hardware security keys, hardware tokens that show a six-digit time-based one-time password (TOTP), and virtual authenticator apps on a phone. Setting up a virtual device is done while signed in as the root user. You scan a QR code, then enter two consecutive codes from the app. That setup step also explains why spare devices matter. If you lose the only phone holding the virtual device and have no other device or recovery path, you cannot sign in, and you have to contact customer service to remove MFA from the account.&lt;/p&gt;

&lt;p&gt;Then comes the point many freshers miss: &lt;strong&gt;don't create access keys for the root user&lt;/strong&gt;. Access keys let you run commands in the command line interface or call the API from a software development kit (SDK). Root access keys would carry full access to every service and resource, including billing information. Root-only tasks are rare, so AWS recommends doing them by signing in to the console. If programmatic access is genuinely needed, the &lt;code&gt;aws login&lt;/code&gt; command with root credentials provides temporary, automatically rotated credentials instead of long-term keys.&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%2Fh0j99tv9iuvk9domfb5t.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%2Fh0j99tv9iuvk9domfb5t.png" alt="Table pairing four root user controls with the risk each one prevents" width="800" height="323"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Each root user control and the risk it closes&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Putting it away means everyday work runs through temporary credentials
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;"If not the root user, then what do you use day to day?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You create an administrative user, and from it you create other identities for the people who need access. AWS strongly recommends that users authenticate with temporary credentials. The right tool depends on how the accounts are set up.&lt;/p&gt;

&lt;p&gt;For a single, standalone account, AWS points to IAM roles. A role has no standard long-term credential such as a password or access key. When you assume a role, you receive temporary security credentials for that session. For several accounts managed together through AWS Organizations, AWS points to IAM Identity Center workforce users. These let you manage users and their permissions centrally across accounts, either in Identity Center itself or through an external identity provider.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"So what's wrong with IAM users?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;IAM users have long-term credentials such as passwords and access keys. Current guidance is that human users should use federation (signing in through an identity provider) to get temporary credentials. IAM users should be kept for specific cases that federated users cannot handle. Two such cases are emergency access and workloads that cannot use IAM roles.&lt;/p&gt;

&lt;p&gt;If you do create an IAM user, the guidance still applies. Create only the credentials the user needs, so a console-only user gets no access keys. Manage permissions through groups rather than attaching them one user at a time. You can also set a permissions boundary, which caps the maximum permissions a user can have without granting any.&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%2Fh9yk8zftsk0msgxi6beb.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%2Fh9yk8zftsk0msgxi6beb.png" alt="Comparison of IAM roles, Identity Center users and IAM users by credential type and when to use each" width="800" height="264"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Roles and Identity Center hand out temporary credentials; IAM users carry long-term ones&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A useful rule for interviews, offered here as judgment rather than as AWS wording: choose a role or a federated identity by default, and choose an IAM user only when you can name the specific reason a temporary credential won't work.&lt;/p&gt;

&lt;h2&gt;
  
  
  No single person should hold every key to the root user
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;"Who should have access to the root user's credentials?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Only people with a strict business need. Don't share the root password, MFA, access keys or signing certificates with anyone else. AWS goes further and suggests multi-person approval. One group of administrators holds the password, another group holds the MFA, and one member from each group must come together to sign in as root.&lt;/p&gt;

&lt;p&gt;Think of it as a bank vault that needs two keyholders to open. Neither can open it alone, so a single compromised or careless person is not enough.&lt;/p&gt;

&lt;p&gt;Storage needs the same care. Don't store the root password in a tool that runs on AWS services inside the same account that password protects. If you lose the password, you also lose access to the tool holding it. Access to the password or to wherever it is stored should be logged and monitored.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"What email address should the root user have?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use a business-managed email address that forwards messages to a group of people. That way, if AWS needs to reach the owner, a reply doesn't wait on one person who is away, ill or has left. That address should not be used for anything else.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recovery channels need the same protection as the password
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;"How would someone recover root access, and how do you protect that path?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is a strong follow-up, because recovery is a back door. You need access to the root email inbox to reset a lost password. If one MFA device fails, you can sign in with another device registered to the root user. If you have lost every MFA device, recovery requires both the email address and the phone number used to register the account, and both must be current and reachable.&lt;/p&gt;

&lt;p&gt;The email inbox and the phone number are both verification channels for recovering the root password. For that reason, no one person should control both. AWS recommends two groups: one with access to the primary email address and another with access to the primary phone number.&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%2F6j7v5ttcteajrzho19xb.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%2F6j7v5ttcteajrzho19xb.png" alt="Group one holds the root email inbox, group two holds the phone number, and recovery needs both" width="800" height="201"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Splitting recovery channels between two groups means no one person can recover root alone&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  With many accounts, member root credentials can be removed altogether
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;"How does this change when a company runs many AWS accounts?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With AWS Organizations, every account has its own root user to secure. The account that creates the organization is the management account, and its root user must have MFA registered. The other accounts are member accounts.&lt;/p&gt;

&lt;p&gt;For member accounts there are two strategies. The first is to centralize root access. You remove the member account's root password, access keys and signing certificates, and deactivate and delete its MFA, so the member account can no longer sign in as root or recover its root password. The second is to keep those root credentials and secure them with MFA. AWS recommends removing root credentials from member accounts. Where member root credentials stay enabled, a service control policy (an organization-wide permission guardrail) can deny all root actions except certain root-only ones.&lt;/p&gt;

&lt;p&gt;Compliance tools can give a misleading signal here. MFA-related checks report "noncompliant" when root credentials have been removed, because there is no MFA left to find. After removal, those member accounts are evaluated as "not applicable". Mentioning this nuance tends to show real understanding rather than memorised rules.&lt;/p&gt;

&lt;h2&gt;
  
  
  Root sign-in should raise an alert that someone knows how to answer
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;"How would you know if someone used the root user?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AWS recommends monitoring, alerting and reporting on root user sign-in and usage, including alerts that announce a root sign-in. The account's logging service records root sign-ins and privileged root sessions as separate events. Event rules can detect root credential use and notify a security administrator. Configuration and posture-checking services can flag a root user without MFA or with access keys.&lt;/p&gt;

&lt;p&gt;An alert is only useful if someone acts on it. AWS says to have procedures so that whoever receives a root alert knows how to confirm the access was expected. They should also know how to escalate if they suspect an incident.&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%2Ff8oj2bcee7mi82v4v3df.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%2Ff8oj2bcee7mi82v4v3df.png" alt="Root sign-in triggers a logged event and a notification, which the administrator validates or escalates" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A root sign-in becomes an alert, then a check against expected work, then escalation if unexpected&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What to practise before the interview
&lt;/h2&gt;

&lt;p&gt;Answers stick when you have done the steps yourself. In a practice account, the following exercises are a sensible preparation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set a strong root password, then register two MFA devices, so you can explain why a single device is a risk.&lt;/li&gt;
&lt;li&gt;Check that the root user has no access keys, and be ready to say why there should be none.&lt;/li&gt;
&lt;li&gt;Create an administrative identity and sign in through it for everything else. In a standalone account, try assuming a role and notice that the session credentials are temporary.&lt;/li&gt;
&lt;li&gt;Say aloud, in one breath, who holds the root password, who holds its MFA, who holds the recovery email and who holds the recovery phone.&lt;/li&gt;
&lt;li&gt;Sketch the alert path for a root sign-in, ending with what the person who receives the alert should do.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The root user has complete access to every resource in the account, so you lock it with a strong password and MFA on more than one device, and you never create root access keys.&lt;/li&gt;
&lt;li&gt;After locking it, you put it away: everyday work goes through an administrative identity, and people sign in with temporary credentials from roles or IAM Identity Center rather than long-term IAM user credentials.&lt;/li&gt;
&lt;li&gt;No single person should hold both the root password and its MFA, or both recovery channels (the email inbox and the phone number).&lt;/li&gt;
&lt;li&gt;In an organization, removing member accounts' root credentials is the recommended approach, and root sign-ins everywhere should trigger alerts backed by a response procedure.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This article settles what to say about root-user protection and the shape of everyday administrative access. It does not cover how to design the permission policies that the everyday administrator and other users receive, and it does not list the specific tasks that still require root credentials. Those are the natural next questions an interviewer may ask.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Full article: &lt;a href="https://techeazyconsulting.com/how-to-explain-protecting-the-aws-root-user-and-everyday-admin-access-in-an-interview" rel="noopener noreferrer"&gt;https://techeazyconsulting.com/how-to-explain-protecting-the-aws-root-user-and-everyday-admin-access-in-an-interview&lt;/a&gt;
&amp;lt;!-- cf-origin:end --&amp;gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>career</category>
      <category>interview</category>
      <category>security</category>
    </item>
  </channel>
</rss>
