<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Success Ekhosuehi on Medium]]></title>
        <description><![CDATA[Stories by Success Ekhosuehi on Medium]]></description>
        <link>https://medium.com/@successekhosuehi?source=rss-b11e513143e8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*yo5xLGxfRX4kpkNu</url>
            <title>Stories by Success Ekhosuehi on Medium</title>
            <link>https://medium.com/@successekhosuehi?source=rss-b11e513143e8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 07:42:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@successekhosuehi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Handling NULLs in Pipelines COALESCE,NULLIF and IS_DISTINCT_FROM]]></title>
            <link>https://medium.com/towards-data-engineering/handling-nulls-in-pipelines-coalesce-nullif-and-is-distinct-from-1d42771c391f?source=rss-b11e513143e8------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d42771c391f</guid>
            <category><![CDATA[data-quality]]></category>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[sql]]></category>
            <dc:creator><![CDATA[Success Ekhosuehi]]></dc:creator>
            <pubDate>Thu, 19 Nov 2026 23:57:34 GMT</pubDate>
            <atom:updated>2026-11-21T11:09:05.750Z</atom:updated>
            <content:encoded><![CDATA[<p><em>The importance of data quality checks to a business cannot be overestimated. One bad value, landing in the wrong place, can quietly cost thousands. Sometimes that value is literally the word NULL.</em></p><h3>A plate called NULL</h3><p>In 2016, security researcher Joseph Tartaro registered a vanity licence plate in California that read <strong>NULL</strong>. A perfectly valid plate.</p><p>The trouble was elsewhere. When a parking officer couldn’t read a car’s plate, the ticket was probably stored under the same text: ‘ NULL ‘ . Not necessarily typed by the officer. More often it’s software: a blank field filled with a placeholder, or a real NULL written out as the four letters N-U-L-L when data moves from one system to another.</p><p>For years those tickets sat unmatched. Then, in 2018, Tartaro paid a single $35 ticket. That payment created a record: plate NULL belongs to Tartaro, at this address.</p><p>From that moment, the matching step did exactly what it was built to do. Every ticket where plate equals ‘NULL’ went to him. At one point he faced $12,049 in fines for cars he’d never owned.</p><p><a href="https://www.grahamcluley.com/null-vanity-plate-hack-to-dodge-parking-tickets-backfires-to-the-tune-of-12000">&quot;NULL&quot; vanity plate hack to dodge parking tickets backfires to the tune of $12,000</a></p><p>The system couldn’t tell “this plate is unknown” from “this plate says NULL” .</p><p>Every part of that story comes down to how NULL was handled. So let’s use it to learn the three Snowflake tools that handle NULL properly, starting with the one you’ll write most: COALESCE.</p><h3>What NULL actually means</h3><pre>NULL   = &#39;NULL&#39;   -- not TRUE: no match, no ticket for Tartaro<br>&#39;NULL&#39; = &#39;NULL&#39;   -- TRUE: match, ticket sent to Tartaro</pre><p>If missing plates had stayed real NULLs, they would have matched no one. The bug began the moment “unknown” was stored as a value.</p><h3>COALESCE: use this if it exists, otherwise use that</h3><p>The simplest way to say it: <strong>if a exists, use a. If not, use b.</strong> “Exists” here means <em>is not NULL</em>.</p><pre>COALESCE(plate, &#39;Unreadable&#39;)</pre><p>It also takes more than two values. Snowflake walks them left to right and returns the first that isn’t NULL, like a priority list:</p><pre>COALESCE(mobile_phone, work_phone, home_phone, &#39;no contact&#39;)</pre><h3>Three things to know before you write one</h3><ol><li>A blank isn’t NULL, so COALESCE keeps it.</li></ol><pre>COALESCE(&#39;&#39;, &#39;Unreadable&#39;)     -- returns &#39;&#39;<br>COALESCE(&#39;NULL&#39;, &#39;Unreadable&#39;) -- returns &#39;NULL&#39;</pre><p>That second line is Tartaro’s problem in one row. COALESCE can’t fix a placeholder that’s already text. We’ll fix that with NULLIF next.</p><p>2. Types must agree. In Snowflake, COALESCE(amount, ‘none’) fails when amount is a NUMBER, because ‘none’ can’t become a number. Use COALESCE(amount, 0), or cast first:</p><pre>COALESCE(amount::VARCHAR, &#39;none&#39;)</pre><p>3. It can silently change your answers. Take three exam scores: 10, 20, and one student who hasn’t sat the test.</p><pre>AVG(score)              -- (10 + 20) / 2 = 15<br>AVG(COALESCE(score, 0)) -- (10 + 20 + 0) / 3 = 10</pre><p>AVG skips NULLs. COALESCE invents a zero, and the question changes without anyone noticing.</p><h3>How one COALESCE line could send strangers’ tickets to Tartaro</h3><p>We don’t know exactly how it happened in his case, but this is one easy way to create the bug. Someone tidies the plate column, perhaps just to stop blanks showing in a report:</p><pre>COALESCE(plate, &#39;NULL&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZxCghwvyi7rQjWgu" /></figure><p>Every real NULL, meaning “we don’t know this plate”, becomes the text ‘ NULL ‘ , character for character the same as his plate. Real NULLs were harmless, because NULL never equals anything. COALESCE turned them into a value, and that value happened to be his plate.</p><p><strong>The rule: keep NULLs while calculating and matching. Use COALESCE only at the end, in the report people read.</strong></p><h3>Three questions before you write any COALESCE</h3><ol><li><strong>Is this column used in a join or a calculation?</strong> If yes, leave the NULLs alone. COALESCE belongs in the final output.</li><li><strong>Does my fallback match the column’s type?</strong> A number needs a number; text needs text, or cast first.</li><li><strong>Could the value already be a placeholder, not a real NULL?</strong> If blanks or the text ‘NULL’ might be in there, COALESCE won’t catch them. That’s NULLIF’s job.</li></ol><h3>A business scenario: the sales call list</h3><p>The sales team wants one phone number per customer for a call list. Customers might have a mobile, a work number, a home number, or none at all. They want the mobile first, then work, then home, and “No contact” if there’s nothing.</p><p>Run it through the three questions:</p><ol><li><strong>Join or calculation</strong>? No, it’s a list people read. COALESCE is safe here.</li><li><strong>Types match?</strong> All the numbers are text, so the fallback ‘No contact’ is text too.</li><li>Placeholders? Some records hold blanks instead of NULL, so clean those first with NULLIF.</li></ol><pre>SELECT<br>    customer_name,<br>    COALESCE(<br>        NULLIF(TRIM(mobile_phone), &#39;&#39;),<br>        NULLIF(TRIM(work_phone), &#39;&#39;),<br>        NULLIF(TRIM(home_phone), &#39;&#39;),<br>        &#39;No contact&#39;<br>    ) AS call_number<br>FROM customers;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*E-M4U2Jmn67vhihj" /></figure><p>Ben’s blank mobile would have won without NULLIF, leaving the sales team with an empty number to call. With it, Snowflake skips the blank and finds his work number.</p><p>What’s happening inside the COALESCE? Read each line from the inside out:</p><pre>NULLIF(TRIM(mobile_phone), &#39;&#39;)</pre><ol><li>TRIM removes spaces from the start and end. Spaces in the middle stay.</li><li><strong>NULLIF</strong> then asks: is what’s left an empty string? If yes, return NULL. If not, return the number.</li><li>COALESCE only ever sees a real number or a real NULL, so it skips the NULL and moves on.</li></ol><p>Why TRIM first? Because some “blanks” are really spaces, and ‘ ‘ is not the same as ‘’ . Without TRIM, NULLIF wouldn’t recognise it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OnOAh7J5Hw7U2XK1" /></figure><h3>NULLIF: if these match, treat it as unknown</h3><p>COALESCE removes NULLs. NULLIF does the opposite: it <em>creates</em> them, on purpose.</p><p>The simplest way to say it: <strong>if a equals b, return NULL. If not, return a untouched.</strong></p><pre>NULLIF(0, 0)        -- NULL<br>NULLIF(5, 0)        -- 5<br>NULLIF(&#39;NULL&#39;, &#39;NULL&#39;) -- NULL</pre><p>Why would anyone want more NULLs? Because some values <em>look</em> real but are actually junk. NULLIF lets you mark them honestly, so Snowflake treats them as unknown.</p><h3>Scenarios where you’ll reach for NULLIF</h3><ol><li>The text “NULL” (Tartaro’s case). Missing plates stored as the word NULL become real NULLs again, and stop matching his plate.</li></ol><pre>NULLIF(UPPER(TRIM(plate)), &#39;NULL&#39;) AS plate</pre><p>2. Blanks pretending to be values. Source systems often send “when” when they mean nothing. Trim first, so spaces-only counts too.</p><pre>NULLIF(TRIM(email), &#39;&#39;) AS email</pre><p>3. <strong>Sentinel values.</strong> Legacy systems use -1 or 9999 to mean unknown. Left in, they drag every average.</p><pre>NULLIF(age, -1) AS age</pre><p>4. Divide by zero. No orders means revenue per order doesn’t exist. NULL is the honest answer, and the query doesn’t fail at 3am.</p><pre>revenue / NULLIF(orders, 0) AS revenue_per_order</pre><h3>Three things to know before you write one</h3><ol><li><strong>It checks one value only. For a list of placeholders, use CASE:</strong></li></ol><pre>CASE WHEN UPPER(TRIM(plate)) IN (&#39;&#39;, &#39;NULL&#39;, &#39;NONE&#39;, &#39;UNKNOWN&#39;, &#39;N/A&#39;) THEN NULL<br>     ELSE UPPER(TRIM(plate)) END AS plate</pre><p>2. <strong>It’s an exact match.</strong> ‘ null ‘ isn’t ‘NULL’, so tidy with TRIM and UPPER first.</p><p>3. <strong>NULLIF(x, NULL) does nothing.</strong> x = NULL is never TRUE, so you always get x back.</p><p>Where it belongs: in a Snowflake staging view or dbt staging model, before anything joins on the column.</p><p>A fair objection: nobody writes NULLIF for a case they never imagined. True. But the text “NULL” is one of the most common placeholders in data, because so many tools export missing values that way. Cleaning a standard list is routine hygiene, not prediction.</p><h3>Writing them together</h3><p>Here’s the line that ties it all up:</p><pre>COALESCE(NULLIF(UPPER(TRIM(plate)), &#39;NULL&#39;), &#39;Unreadable&#39;)</pre><p>Start with the question, not the syntax: show a plate for every ticket, and say “Unreadable” whenever there isn’t a real one. Then build it inside out:</p><ol><li><strong>TRIM and UPPER</strong> tidy the value, so ‘ null ‘ becomes ‘NULL’.</li><li><strong>NULLIF</strong> marks the placeholder as honestly unknown.</li><li><strong>COALESCE</strong> makes it readable for the report.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2MifuE90gL9R9Y_Q" /></figure><p>Without NULLIF in the middle, the text ‘NULL’ slips straight past COALESCE, because it isn’t NULL. Use the NULLIF part in staging and joins; add the COALESCE only where people read the result.</p><h3>IS DISTINCT FROM: did this really change?</h3><pre>&#39;a@x.com&#39; &lt;&gt; NULL                  -- NULL, so treated as no change<br>&#39;a@x.com&#39; IS DISTINCT FROM NULL    -- TRUE<br>NULL      IS DISTINCT FROM NULL    -- FALSE</pre><h3>Scenario: the moment Tartaro became the owner</h3><p>Picture the registration history table, tracking changes over time (<strong>SCD2</strong>). Before 2018, plate NULL had no owner. Then his payment set the owner to Tartaro.</p><h3>Written the natural way, the change check misses it:</h3><pre>WHERE old.owner_id &lt;&gt; new.owner_id   -- NULL &lt;&gt; &#39;TARTARO&#39; is NULL, row dropped</pre><p>No error, no new history row. The record of <em>when</em> tickets started routing to him silently never exists. The null-safe version catches it:</p><pre>WHERE old.owner_id IS DISTINCT FROM new.owner_id   -- TRUE, change recorded</pre><p>The same applies to any change detection in Snowflake: streams, MERGE statements, incremental dbt models. A value going from NULL to something, or back, must count as a change.</p><h3>Three things to know before you write one</h3><ol><li><strong>Use it for comparing versions of the same row</strong>. Did this customer, plate or price change?</li><li><strong>Don’t use null-safe comparison for matching identities</strong>. Snowflake’s EQUAL_NULL(a, b) is the null-safe = , and joining on it would link every unknown plate to every other unknown plate. That’s Tartaro’s bug, rebuilt. Match with plain = , on more than one field:</li></ol><pre>JOIN registrations d<br>  ON  c.plate        = d.plate<br>  AND c.vehicle_make = d.vehicle_make</pre><p><strong>3. Inside hashes, COALESCE first.</strong> If you compare rows by hashing columns, one NULL makes the whole hash NULL. Wrap each column: MD5(COALESCE(plate, ‘’) || ‘|’ || COALESCE(owner_id, ‘’)).</p><h3>Checks that catch what nobody imagined</h3><p>Nobody had to predict a plate called NULL. They needed rules about what good data always looks like, run automatically on every load:</p><pre>-- One plate should belong to one kind of car<br>SELECT plate<br>FROM stg_citations<br>WHERE plate IS NOT NULL<br>GROUP BY plate<br>HAVING COUNT(DISTINCT vehicle_make) &gt; 1;   -- expect 0 rows</pre><p>Two more that need no knowledge of Tartaro at all:</p><pre>-- A ticket can&#39;t be issued before the plate was registered<br>SELECT c.ticket_id<br>FROM stg_citations c<br>JOIN registrations r ON c.plate = r.plate<br>WHERE c.issued_date &lt; r.registered_date;   -- expect 0 rows<br><br>-- No single value should dominate a key column<br>SELECT plate, COUNT(*) AS tickets<br>FROM stg_citations<br>GROUP BY plate<br>HAVING COUNT(*) &gt; 100   -- tune to what&#39;s normal for one car<br>ORDER BY tickets DESC;</pre><p>The second check is the quiet hero. A placeholder like ‘NULL’ , ‘UNKNOWN’ or ‘0000’ always shows up as one value used far too often. It finds placeholders you never thought to list.</p><p>Schedule it as a Snowflake task or a dbt test, so it runs on every load without anyone remembering to.</p><p>Manual checks catch the problems you thought of. Invariant checks catch the ones you didn’t.</p><h3>Three habits that would have protected Tartaro</h3><ol><li><strong>Missing stays a real NULL.</strong> Clean placeholders in staging, and NULL = ‘NULL’ never matches anyone.</li><li><strong>Match with plain = on more than one field; COALESCE only for reporting.</strong> Never fill in a column you join on.</li><li><strong>Test what should always be true</strong>, not what you expect to break. Those rules fail on the strange cases nobody imagined.</li></ol><h3>At its root, a governance problem</h3><p>The code bug was storing missing as text. The real cause was that nobody owned the rule for what “missing” means.</p><ol><li><strong>A standard</strong>: unknown values are stored as NULL, never as text.</li><li><strong>A contract between systems</strong>: the registry reserves words like NULL; the ticketing side rejects them.</li><li><strong>An owner</strong>: someone accountable for the matching data, so the wrongly billed person isn’t left to chase it alone.</li></ol><p>In Snowflake, these rules can live right beside the data: staging views to enforce the standard, scheduled tests to check it, and object tags to record who owns each table.</p><p><strong>Governance decides the rule. The pipeline enforces it</strong>. NULLIF cleans the known mess, COALESCE stays at the edges, and invariant checks raise the alarm, every hour, whether anyone is watching or not.</p><p>What’s the NULL bug that caught you out?</p><p><strong>Reference</strong></p><p><a href="https://www.wired.com/story/null-license-plate-landed-one-hacker-ticket-hell/">https://www.wired.com/story/null-license-plate-landed-one-hacker-ticket-hell/</a></p><p>GitHub: github.com/007ekho</p><p><strong>LinkedIn: </strong><a href="http://linkedin.com/in/suehi"><strong>linkedin.com/in/suehi</strong></a></p><p><em>Originally published at </em><a href="https://docs.google.com/document/d/e/2PACX-1vSi9L_yKTzd1OR6De8fQsghfE8EQKZkS-mALENq9dfXgegXeLNPLrQnWVeLLUUbioTSHdhN1fZGcXJZ/pub"><em>http://docs.google.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d42771c391f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/towards-data-engineering/handling-nulls-in-pipelines-coalesce-nullif-and-is-distinct-from-1d42771c391f">Handling NULLs in Pipelines COALESCE,NULLIF and IS_DISTINCT_FROM</a> was originally published in <a href="https://medium.com/towards-data-engineering">Towards Data Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terraform Variable Validation Guide]]></title>
            <link>https://medium.com/codetodeploy/terraform-variable-validation-guide-8c8f21c409e0?source=rss-b11e513143e8------2</link>
            <guid isPermaLink="false">https://medium.com/p/8c8f21c409e0</guid>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[devsecops]]></category>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Success Ekhosuehi]]></dc:creator>
            <pubDate>Tue, 17 Nov 2026 01:47:25 GMT</pubDate>
            <atom:updated>2026-11-17T13:56:05.721Z</atom:updated>
            <content:encoded><![CDATA[<p><em>by Success Ekhosuehi</em></p><p>Declaring variables is a normal step that almost everyone takes. Most people stop at a name, a type and a description. Add validation, and the variable becomes a data contract: a clear promise about which values it will accept, checked before Terraform builds anything.</p><blockquote><em>💥 </em><strong><em>Master Coding, AI, AWS &amp; Data Science</em></strong><em><br>🚀 Build In-Demand Skills &amp; Crack Tech Interviews<br>🔥 Get Up to 6</em><strong><em>0% OFF</em></strong><em> — Limited-Time Offer</em></blockquote><blockquote><a href="https://www.educative.io/unlimited?aff=xkRD"><em>👉 </em><strong><em>Build Job-Ready Skills Today</em></strong></a></blockquote><p>For example, this variable accepts any string:</p><pre>variable &quot;environment&quot; {<br>  type = string<br>}</pre><p>&quot;prod&quot; works, but so do &quot;Prod&quot;, &quot;production&quot; and &quot;prd&quot;. Terraform accepts them all and quietly builds resources with the wrong names, such as a PRODUCTION_RAW database next to your real PROD_RAW.</p><p>Add one validation block, and the variable now says exactly what it accepts:</p><pre>variable &quot;environment&quot; {<br>  type = string<br><br>  validation {<br>    condition     = contains([&quot;dev&quot;, &quot;test&quot;, &quot;prod&quot;], var.environment)<br>    error_message = &quot;environment must be dev, test or prod.&quot;<br>  }<br>}</pre><p>Now a wrong value stops the run at the very start, with a message that says how to fix it, before anything in your account changes. The rest of this guide shows how that contract works and how to write your own.</p><h3>What validation is</h3><p>A validation block is a rule attached to a variable. Terraform checks it before any plan or apply, and stops with your message if the value breaks the rule.</p><p>Think of it as a bouncer at the door: the variable is the guest, condition is the dress code, and error_message is what the bouncer says when he turns you away.</p><pre>variable &quot;warehouse_size&quot; {<br> type = string<br> description = &quot;Snowflake warehouse size&quot;<br><br> validation {<br> condition = contains([&quot;XSMALL&quot;, &quot;SMALL&quot;, &quot;MEDIUM&quot;, &quot;LARGE&quot;], var.warehouse_size)<br> error_message = &quot;warehouse_size must be one of XSMALL, SMALL, MEDIUM, LARGE.&quot;<br> }<br><br>}</pre><ul><li><strong>condition</strong> : any expression that returns true or false . True passes; false fails the run.</li><li><strong>error_message</strong> : shown to the person who ran the command. Write a full sentence saying what a valid value looks like.</li></ul><h3>Order of checks</h3><p>Terraform checks the type first, then every validation block, and only then builds the plan.</p><ol><li>Type check. If type = number and someone passes “abc” , it fails here, before your rule runs.</li><li>Validation blocks. Every block is checked, and all failures are reported together.</li><li>Plan. Resources only ever see values that passed.</li></ol><p>Because the type has already been checked, your condition can trust it.</p><h3>Several rules on one variable</h3><p>Stack validation blocks, one check each, so the error says exactly which rule failed:</p><pre>variable &quot;database_name&quot; {<br> type = string<br> validation {<br> condition = can(regex(&quot;^[A-Z][A-Z0–9_]*$&quot;, var.database_name))<br> error_message = &quot;database_name must be uppercase, start with a letter, and use only A-Z, 0–9 and _.&quot;<br> }<br><br> validation {<br> condition = length(var.database_name) &lt;= 255<br> error_message = &quot;database_name must be 255 characters or fewer.&quot;<br> }<br><br>}</pre><h3>Condition templates</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SKG3cuSHaqmbxymH" /></figure><p>Figure 1: Five condition patterns</p><p><strong>can() </strong>is the trick worth remembering. <strong>regex()</strong> throws an error when there’s no match, which would crash the run. <strong>can()</strong> catches that error and gives back false , so it becomes a clean validation failure.</p><p><strong>Nulls</strong>: if a variable can be null , check for null first. || stops evaluating once the left side is true, so length() never runs on a null.</p><h3>HCL vs Python</h3><p>Conditions are written in HCL, Terraform’s own expression language, not Python. The for expression feels like a Python list comprehension, but the syntax is different.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fT5vQJj5e7jfUawb" /></figure><p>Figure 2: HCL vs Python</p><h3>What you can’t do</h3><p>A condition is one expression, evaluated once. There are no if blocks, no loops with side effects, no local variables and no def. If a rule gets too long for one line, split it into several validation blocks instead of cramming it into one.</p><h3>Beyond single-variable checks</h3><p>From Terraform 1.9, a condition can refer to other variables, locals and data sources. Before 1.9 it could only see its own variable.</p><pre>variable &quot;min_cluster_count&quot; { type = number }<br>variable &quot;max_cluster_count&quot; {<br> type = number<br><br> validation {<br> condition = var.max_cluster_count &gt;= var.min_cluster_count<br> error_message = &quot;max_cluster_count must be &gt;= min_cluster_count.&quot;<br> }<br><br>}</pre><p>Variable validation only checks inputs. Use these for other kinds of check:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GUo2tc_0IhFGfR85" /></figure><p>Figure 3: When each check runs</p><h3>Testing your rules</h3><p>Try a condition in terraform console before you put it in a validation block. It’s the quickest way to check one:</p><pre>$ terraform console<br>&gt; contains([&quot;XSMALL&quot;,&quot;SMALL&quot;], &quot;HUGE&quot;)<br>false<br>&gt; can(regex(&quot;^[A-Z_]+$&quot;, &quot;my_db&quot;))<br>false</pre><p>Then pass a bad value and confirm the run fails with your error_message :</p><pre>terraform plan -var=&#39;warehouse_size=HUGE&#39;</pre><p>In CI, terraform test (1.6+) can assert that bad inputs fail. Put expect_failures = [var.warehouse_size] in a test run. That stops a rule from quietly breaking when someone edits it.</p><p>Every function you can use in a condition (contains, regex, length, startswith, alltrue and so on) is listed in the Terraform docs under <strong>Functions</strong>.</p><p>LinkedIn: <a href="https://www.linkedin.com/in/suehi/">https://www.linkedin.com/in/suehi/</a></p><p><strong>GitHub: </strong><a href="https://github.com/007ekho">github.com/007ekho</a></p><p>Official Terraform docs</p><p><strong>variable block reference</strong>:<a href="https://developer.hashicorp.com/terraform/language/block/variable">https://developer.hashicorp.com/terraform/language/block/variable</a></p><p><strong>Validate your configuration (custom conditions)</strong>:<a href="https://developer.hashicorp.com/terraform/language/expressions/custom-conditions">https://developer.hashicorp.com/terraform/language/expressions/custom-conditions</a></p><p><em>Originally published at </em><a href="https://docs.google.com/document/d/e/2PACX-1vSAUFb9_-j74LjzAlcMuAgWWb-bfay9oL6zEHHmm7TbEhHykQxDgfDP2ngc2uApd2qMo-FrfC3elRRq/pub"><em>http://docs.google.com</em></a><em>.</em></p><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d9QTaaaxboQP_gKSLedW_w.png" /></figure><p>👉 Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></p><p>👉 Follow us: <a href="https://medium.com/codetodeploy"><strong>Medium</strong></a></p><p><strong>Disclosure:</strong> This post includes affiliate and partnership links.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c8f21c409e0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codetodeploy/terraform-variable-validation-guide-8c8f21c409e0">Terraform Variable Validation Guide</a> was originally published in <a href="https://medium.com/codetodeploy">CodeToDeploy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[YAML explained from the ground up]]></title>
            <link>https://medium.com/codetodeploy/yaml-explained-from-the-ground-up-7faad39c5022?source=rss-b11e513143e8------2</link>
            <guid isPermaLink="false">https://medium.com/p/7faad39c5022</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[yaml]]></category>
            <category><![CDATA[gitlab]]></category>
            <dc:creator><![CDATA[Success Ekhosuehi]]></dc:creator>
            <pubDate>Sat, 07 Nov 2026 02:07:55 GMT</pubDate>
            <atom:updated>2026-11-16T18:00:51.987Z</atom:updated>
            <content:encoded><![CDATA[<p><em>What configuration files are, why they matter, and how to read your first pipeline By Success Ekhosuehi</em></p><p>I could open with the textbook definition of YAML, the same one you’ll find in every other article. Instead, I’ll put it plainly: YAML is a configuration file that has quietly made life easier for anyone working in DevOps and software engineering.</p><blockquote><em>💥 </em><strong><em>Master Coding, AI, AWS &amp; Data Science</em></strong><em><br>🚀 Build In-Demand Skills &amp; Crack Tech Interviews<br>🔥 Get Up to 6</em><strong><em>0% OFF</em></strong><em> — Limited-Time Offer</em></blockquote><blockquote><a href="https://www.educative.io/unlimited?aff=xkRD"><em>👉 </em><strong><em>Build Job-Ready Skills Today</em></strong></a></blockquote><p>That definition only makes sense if you know what a configuration file is, so let’s start there.</p><h3>What a configuration file actually does</h3><p>Every piece of software has two parts. One part is the logic, the code that does the work. The other part is the details that code needs to run: which database to connect to, which server to send files to, how many times to retry when something fails, what to call the output. These details change far more often than the logic does.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*g50RmLOsYZ6emrUI" /></figure><p><em>Figure 1. The program holds the logic; the settings hold the details it works with.</em></p><p>You could write those details straight into the code. Many early programs did exactly that. But then every small change, such as a new server address or a different environment, meant editing the program, rebuilding it and releasing it again. It’s like having to rewire your oven every time you want to bake at a different temperature.</p><p>A configuration file pulls those details out into a separate, plain-text file. The code reads the file and follows what it says. Want a different setting? Edit one line. The program itself stays untouched.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Gjd-ONoGRqApmTGY" /></figure><p><em>Figure 2. The same change: five steps when settings live in the code, one line when they live in a file.</em></p><p><strong>Why this matters more than it first appears</strong></p><p>Here’s a situation many teams have lived through. A deployment works perfectly on Monday. On Friday, someone else repeats it and it fails. Nobody changed the code. What changed was a step done slightly differently, a setting typed by hand, or something one person knew and never wrote down.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*whyR6f4w0okqpz_1" /></figure><p><em>Figure 3. Done by hand, steps drift. Done from a file, they run the same way every time.</em></p><p>Configuration files exist to remove that kind of guesswork. Once the steps and settings are written in a file, three things become possible:</p><ul><li>The same input gives the same result. The computer doesn’t forget a step or improvise. It follows the file exactly, every time.</li><li>Every change leaves a trail. Configuration files are stored in Git alongside the code, so you can see what changed, who changed it, when, and why, and you can undo it if it causes trouble.</li><li>Tools can take over the work. Once the instructions are written down, tools like GitLab CI, Docker Compose and Kubernetes can read them and carry them out automatically, with no clicking and no copy-and-paste.</li></ul><p>This is what the industry calls “everything as code.” Pipelines, servers, permissions and entire cloud environments are described in files instead of being set up by hand. The file becomes the single source of truth, which is why configuration files now sit behind almost everything you’ll build.</p><p><strong>YAML wasn’t the first</strong></p><p>Before YAML, engineers relied on:</p><ul><li>Hard-coded settings , written directly into the program</li><li>XML , structured but heavy with opening and closing tags</li><li>Shell scripts and Makefiles , where configuration became code</li><li>Web UI setup , settings clicked into forms on a server</li><li>JSON , clean and structured, but no comments and lots of brackets</li></ul><p>Each one solved some problems and created new ones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1CGs70yIvhUYf3zC" /></figure><p>Figure 4. Each format fixed one problem and left another behind.</p><p><strong>Why YAML won people over</strong></p><ul><li><strong>Easy to read.</strong> It looks like a clean, indented list.</li><li><strong>No clutter.</strong> It gives you XML’s structure without all the tags.</li><li><strong>Comments allowed.</strong> You can add notes with #.</li><li><strong>Used everywhere.</strong> GitLab CI, Docker Compose, Kubernetes and more all use it.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zXK5G0AfzaXBmvo-" /></figure><p><em>Figure 5. Four building blocks are enough to read most YAML files.</em></p><ul><li><strong>Indentation matters</strong>. One wrong space can break the file. Use spaces, not tabs.</li><li><strong>It can misread values</strong>. no might become false. Use quotes when unsure.</li><li><strong>Large files get messy</strong>. Split them up.</li><li>Errors can hide. Validate before you trust it.</li></ul><h3><strong>The shape of a pipeline</strong></h3><p>Before looking at any real example, it helps to understand the basic shape every pipeline configuration file follows. Whether you’re deploying to Snowflake, AWS or anything else, the building blocks stay the same. Only what you put inside them changes.</p><p>Think of a configuration file as a recipe card for a computer. It answers five simple questions:</p><ol><li><strong>In what order should things happen?</strong> These are the <strong>stages</strong>. They group work into steps, such as checking the code first and deploying it afterwards. One stage finishes before the next begins.</li><li><strong>What tools are needed?</strong> This is the <strong>image</strong>, a ready-made container with the software a job needs already installed. It’s like choosing the right toolbox before starting a job.</li><li><strong>What information do the jobs need?</strong> These are the <strong>variables</strong>, named values such as an environment name or an app name. You write them once and reuse them anywhere in the file.</li><li><strong>What actually gets done?</strong> These are the jobs , and inside each job, the script . A job is a single task, and the script is the list of commands it runs, line by line, just as you would type them yourself.</li><li><strong>What rules control the flow? </strong>needs tells a job to wait for another job to finish first, and when: manual pauses the pipeline until a person clicks to approve. These two give you control over what runs and when.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rJR7XjEAjlvApvIN" /></figure><p><em>Figure 6. Each of the five questions is answered by one block of YAML.</em></p><p>Keep these five questions in mind as you read the template below. Each block of YAML answers one of them.</p><pre># 1. The order the pipeline runs in<br>stages:<br>  - stage_one<br>  - stage_two<br> <br># 2. The toolbox every job uses<br>default:<br>  image: &lt;toolbox-image&gt;<br> <br># 3. Values every job can use<br>variables:<br>  SHARED_VALUE: &lt;value&gt;<br> <br># 4. A job and the commands it runs<br>job_name:<br>  stage: stage_one<br>  variables:<br>    JOB_VALUE: &lt;value&gt;<br>  script:<br>    - &lt;command one&gt;<br>    - &lt;command two&gt;<br> <br># 5. A job that waits for another and needs approval<br>another_job:<br>  stage: stage_two<br>  needs:<br>    - job_name<br>  script:<br>    - &lt;command&gt;<br>  when: manual</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YJhJJ0RPVB_Ofd7Z" /></figure><p><em>Figure 7. GitLab reads the file, runs each stage in order, and waits for approval where you asked it to.</em></p><h3>Where we go from here</h3><p><strong>what you no know</strong></p><p>By now, a YAML file should feel less like a wall of code and more like what it really is: a set of instructions written in plain, structured text. You know why configuration files exist, what came before YAML, how to read its four building blocks, and the five questions every pipeline configuration file answers.</p><p>But templates only take you so far. The real understanding comes when you watch a configuration file do actual work.</p><h3>What comes next</h3><p>In the next article, I’ll build on everything here with a <strong>live example</strong>: a GitLab pipeline that uses Terraform and SQL to load files from Amazon S3 into Snowflake automatically. We’ll start from an empty repository, write the configuration file one block at a time, and follow each stage from the first push to the first rows landing in Snowflake.</p><p>Keep the template from this article close. You’ll see every placeholder in it replaced with something real. [Link to the next article]</p><p><strong>About the author</strong></p><p>Success Ekhosuehi is a Data Engineer who builds data platforms with Snowflake, Terraform, dbt and AWS, and writes about making DevOps and data engineering simple to understand. If this helped, or you have questions about YAML, pipelines or Snowflake, I’d be glad to hear from you.</p><p><strong>LinkedIn: </strong><a href="https://www.linkedin.com/in/suehi/">linkedin.com/in/suehi</a></p><p><strong>GitHub: </strong><a href="https://github.com/007ekho">github.com/007ekho</a></p><p><em>Originally published at </em><a href="https://docs.google.com/document/d/e/2PACX-1vTqNQK4c9pSLoZ4cBGnGSkQFUzh0125TiNgjqxwP-bBlFUark3Ayl3aQuOl0OdUJ_jV0CD6baP6gwSr/pub"><em>http://docs.google.com</em></a><em>.</em></p><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d9QTaaaxboQP_gKSLedW_w.png" /></figure><p>👉 Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></p><p>👉 Follow us: <a href="https://medium.com/codetodeploy"><strong>Medium</strong></a></p><p><strong>Disclosure:</strong> This post includes affiliate and partnership links.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7faad39c5022" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codetodeploy/yaml-explained-from-the-ground-up-7faad39c5022">YAML explained from the ground up</a> was originally published in <a href="https://medium.com/codetodeploy">CodeToDeploy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Three-Tool Pattern Every Snowflake Platform Team Will Eventually Adopt]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://aws.plainenglish.io/the-three-tool-pattern-every-snowflake-platform-team-will-eventually-adopt-302567bd076d?source=rss-b11e513143e8------2"><img src="https://cdn-images-1.medium.com/max/1536/1*kvrapM3j9KXsSNbTuF8CwQ.png" width="1536"></a></p><p class="medium-feed-snippet">Why I Stopped Treating Snowflake Like Any Other Cloud Resource And What I Do Instead</p><p class="medium-feed-link"><a href="https://aws.plainenglish.io/the-three-tool-pattern-every-snowflake-platform-team-will-eventually-adopt-302567bd076d?source=rss-b11e513143e8------2">Continue reading on AWS in Plain English »</a></p></div>]]></description>
            <link>https://aws.plainenglish.io/the-three-tool-pattern-every-snowflake-platform-team-will-eventually-adopt-302567bd076d?source=rss-b11e513143e8------2</link>
            <guid isPermaLink="false">https://medium.com/p/302567bd076d</guid>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[platform-engineering]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[snowflake-dcm]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Success Ekhosuehi]]></dc:creator>
            <pubDate>Tue, 05 May 2026 14:10:54 GMT</pubDate>
            <atom:updated>2026-05-05T14:10:54.911Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Building a Real-Time Financial Data Pipeline with Kafka and Python]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://aws.plainenglish.io/building-a-real-time-financial-data-pipeline-with-kafka-and-python-72c5973f5edf?source=rss-b11e513143e8------2"><img src="https://cdn-images-1.medium.com/max/2600/0*nsOyBQJaIZmp5FGd" width="5472"></a></p><p class="medium-feed-snippet">How senior data engineers design streaming infrastructure that holds up at market-open scale and why most pipelines fail before they get&#x2026;</p><p class="medium-feed-link"><a href="https://aws.plainenglish.io/building-a-real-time-financial-data-pipeline-with-kafka-and-python-72c5973f5edf?source=rss-b11e513143e8------2">Continue reading on AWS in Plain English »</a></p></div>]]></description>
            <link>https://aws.plainenglish.io/building-a-real-time-financial-data-pipeline-with-kafka-and-python-72c5973f5edf?source=rss-b11e513143e8------2</link>
            <guid isPermaLink="false">https://medium.com/p/72c5973f5edf</guid>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Success Ekhosuehi]]></dc:creator>
            <pubDate>Mon, 30 Mar 2026 01:08:16 GMT</pubDate>
            <atom:updated>2026-03-30T13:54:35.736Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Real-Time Data Streaming into Snowflake from S3 with Snowpipe (Step-by-Step Guide)]]></title>
            <link>https://successekhosuehi.medium.com/real-time-data-streaming-into-snowflake-from-s3-with-snowpipe-step-by-step-guide-2a9438ee6555?source=rss-b11e513143e8------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a9438ee6555</guid>
            <dc:creator><![CDATA[Success Ekhosuehi]]></dc:creator>
            <pubDate>Sun, 30 Nov 2025 05:33:49 GMT</pubDate>
            <atom:updated>2026-03-30T13:55:55.684Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cX2lANxs9gJ_dtWMIgWwOg.png" /><figcaption>FIG1: S3 streaming to snowflake database</figcaption></figure><p><strong>Business Scenario:</strong> <em>The company has started storing data in an </em><strong><em>AWS S3 bucket</em></strong><em>, where the Data Engineer already has IAM access. With the adoption of </em><strong><em>Snowflake</em></strong><em> as our new data cloud platform, we now require the Data Engineer to migrate data from S3 into Snowflake. This migration will centralize information, improve accessibility, and enable analysts and data scientists to leverage Snowflake’s scalability and advanced analytics for faster, data-driven decision-making.</em></p><h4><strong>What is Snowflake to begin?</strong></h4><p>I think it is important to build a concept around what Snowflake is and draw a distinction between it and other cloud platforms. First and foremost, Snowflake is <strong>SaaS</strong>. SaaS refers to a cloud-based software model that gives users access to applications over the internet. While many applications can be accessed online, what makes SaaS unique is that the <strong>cloud provider fully manages the infrastructure, security, performance, and updates</strong>, so the user only focuses on using the software.</p><p>Snowflake, therefore, is a <strong>cloud-native SaaS data platform</strong>. It allows organizations to store a wide variety of data types, manage them, and run analytics, all while being entirely managed by Snowflake itself.</p><p>If you already have a Snowflake account you can skip this step</p><p><strong>Step 1 : Create a Snowflake account</strong></p><p>To get started with Snowflake, you’ll first need to create an account. Use the following link:<a href="https://signup.snowflake.com/">snowflake free sign up</a>. Remember to pick aws as your cloud provider and click get started to complete your account setup.</p><p><strong>IMAGE 1</strong></p><p>In the Worksheets page, click the plus (+) icon in the top-right corner to create a new worksheet, as shown in the figures below.</p><p>IMAGE 2</p><p><strong>Step 2 : Create a storage integration between snowflake and s3</strong></p><p>From the previous article, the company already has an existing <strong>AWS S3 bucket</strong> where all business data is stored.<br> To bring this data into the <strong>Snowflake Data Platform</strong>, we need to establish a secure connection between <strong>S3</strong> and <strong>Snowflake</strong>. This is done by creating a <strong>Storage Integration</strong> in Snowflake.</p><p>For this step, you will need two key pieces of information:</p><ol><li>The <strong>ARN</strong> of the ehi_role we previously created in AWS.</li><li>The <strong>bucket path</strong> of the S3 location where the business data is stored.</li></ol><p>Once you have these details, fill them into the code snippet below and paste it into your newly created worksheet in Snowflake and click on the play icon to tope right corner to run the code:</p><pre>CREATE OR REPLACE STORAGE INTEGRATION ehi_role_integration<br>  TYPE = EXTERNAL_STAGE<br>  STORAGE_PROVIDER = S3<br>  ENABLED = TRUE<br>  STORAGE_AWS_ROLE_ARN = &quot;arn:aws:iam::&lt;role_account_id&gt;:role/ehi_role&quot;<br>  STORAGE_ALLOWED_LOCATIONS = (&quot;s3://&lt;bucket&gt;/&lt;path&gt;/&quot;);</pre><p><strong><em>MUST READ</em></strong><em>: When we create a </em><strong><em>storage integration</em></strong><em> in Snowflake using our </em><strong><em>AWS Role ARN</em></strong><em> and </em><strong><em>S3 bucket location</em></strong><em>, Snowflake automatically generates a </em><strong><em>Storage IAM User</em></strong><em>.This IAM user acts as the identity Snowflake uses to access your S3 bucket. To complete the setup, you must update the </em><strong><em>trust policy</em></strong><em> of your AWS IAM role (ehi_role) to allow this Snowflake IAM user to assume the role.</em></p><p><strong>Step 3 : Update the role trust policy</strong></p><p>As stated in the previous article, in order for a user to assume a role, the user must be added to the trusted policy of that role. We previously attached the ehi_access policy to the role ehi_role. As such, when this Snowflake-assigned <strong><em>Storage IAM User</em></strong> ass umes the role, it should be able to perform GetObject, GetObjectVersion, and ListAllMyBuckets actions.</p><p>Copy and paste the following code into your Snowflake worksheet to retrieve the storage_aws_iam_user and storage_aws_external_id.</p><pre>desc integration S3_role_integration</pre><ol><li>Log into your aws root user and find the role ehi_role because the current role does not have permissions to IAM center</li><li>Click on it and access the trust relationship. Click on edit as follows</li></ol><pre>{<br>  &quot;Version&quot;: &quot;2012-10-17&quot;,<br>  &quot;Statement&quot;: [<br>    {<br>      &quot;Effect&quot;: &quot;Allow&quot;,<br>      &quot;Principal&quot;: {<br>        &quot;AWS&quot;: &quot;&lt;STORAGE_AWS_IAM_USER_ARN&gt;&quot;<br>      },<br>      &quot;Action&quot;: &quot;sts:AssumeRole&quot;,<br>      &quot;Condition&quot;: {<br>        &quot;StringEquals&quot;: {<br>          &quot;sts:ExternalId&quot;: &quot;&lt;STORAGE_AWS_EXTERNAL_ID&gt;&quot;<br>        }<br>      }<br>    }<br>  ]<br>}</pre><p>3. Click on update policy</p><p><strong>Step 4 : create a database,schema,table and role</strong></p><p>In Snowflake’s hierarchy, a database contains schemas, and a schema contains tables and other objects. A role does not belong to a database; it is used, similar to AWS, to control what a user can access. A database and its objects can be assigned to a role, and, just like an AWS role, a user who assumes this role will have access to all the objects in the database they have been assigned.</p><ol><li>Create a database, schema and table using the code snippet below</li></ol><pre>create or replace database ehi_db;<br>create or replace schema ehi_schema<br><br>create or replace table ehi_table(<br>c1 number,<br>c2 varchar,<br>c3 varchar<br>)</pre><p>2. After establishing a connection between your Snowflake account and the AWS S3 bucket using<strong> storage integration</strong> in step 2, you can create a Snowflake external stage to reference the data stored in the S3 bucket. Keep in mind that while the stage object can be dropped, the data in S3 remains unaffected.</p><pre>create or replace stage ehi_stage<br>  url = (&quot;s3://ehi-first-bucket/ehi-source-folder/&quot;)<br>  storage_integration = ehi_role_integration;</pre><p><strong>Step 5 : create a snowpipe to start ingestion</strong></p><p>As you explore loading data into Snowflake, you will find several methods from bulk loading using the COPY command via the CLI to streaming data using Snowpipe. We are using Snowpipe because we want to load data into our ehi_table as soon as it becomes available in our S3 bucket folder.</p><p>use the code below to create your first pipe</p><pre>create or replace pipe ehi_s3_pipe auto_ingest=true as<br>  copy into ehi_db.ehi_schema.ehi_table<br>  from @ehi_db.ehi_schema.ehi_stage;</pre><p><strong><em>Must read:</em></strong><em> AUTO_INGEST = TRUE enables Snowpipe to automatically detect new files in the S3 bucket and load them into the target table. The COPY INTO statement specifies the target table (ehi_table) and the stage (ehi_stage) where the data resides. There is no need to specify an integration in the Snowpipe because it was already configured duri</em>ng stage creation. <em>This setup ensures near real-time ingestion of data from S3 into Snowflake.</em></p><p><strong>Step 6 : create a role</strong></p><p>From the previous article, we developed a solid understanding of how roles function. In essence, a role defines the permissions and level of access a user has within a platform. This model, commonly known as Role-Based Access Control (RBAC), is widely used across cloud-based systems to ensure that users only have access to the resources and actions necessary for their responsibilities, thereby strengthening overall system security.</p><p>Run the following code in your worksheet in a step wise manner</p><pre>create or replace role S3_role;<br><br>-- Grant Object Access and Insert Permission<br>grant usage on database S3_db to role S3_role;<br>grant usage on schema S3_db.public to role S3_role;<br>grant insert, select on S3_db.public.S3_table to role S3_role;<br>grant usage on stage S3_db.public.S3_stage to role S3_role;<br>-- Bestow S3_pipe Ownership<br>grant ownership on pipe S3_db.public.S3_pipe to role S3_role;<br><br>-- Grant S3_role and Set as Default<br>grant role S3_role to user &lt;username&gt;;<br>alter user &lt;username&gt; set default_role = S3_role;</pre><p><strong>Step 7 : create a event notification</strong></p><p>After setting up the integration between <strong>Snowflake</strong> and <strong>AWS</strong>, and creating a <strong>Snowpipe</strong> to move data from the external stage into tables, the next step is to configure <strong>event notifications</strong>. Snowpipe needs a way to detect when new data has landed in the stage so it knows when to automatically trigger the loading process into the target table.</p><p>AWS provides several core services that can be used for event notifications, including <strong>Amazon SQS</strong>, <strong>Amazon SNS</strong>, and <strong>Amazon EventBridge</strong>. We’ll dive deeper into how each of these services works in upcoming articles. For this article we will be using AWS SQS.</p><ol><li>In Snowflake, run the code below to show you the pipes in your account, on your recently created pipe copy the <strong>NOTIFICATION_CHANNEL</strong> value.</li></ol><pre>show pipes </pre><p>2. In AWS Console, open <strong>ehi_aws-bucket → Properties</strong>.</p><p>3. Scroll to <strong>Event Notifications → Create Notification</strong>.</p><p>Enter details:</p><ul><li><strong>Name:</strong> ehi-auto-ingest</li><li><strong>Event type:</strong> All object create events</li><li><strong>Destination:</strong> SQS</li></ul><p>Under <strong>Lambda function</strong>, select <strong>Enter ARN</strong> and paste the copied <strong>NOTIFICATION_CHANNEL</strong> value. Don’t worry, we will discuss lambda functions subsequently.</p><p><strong>Step 8: Upload Data to Trigger Snowpipe</strong></p><ol><li>In AWS Console, search for <strong>S3</strong> and open the <strong>ehi-aws-bucket → ehi-source</strong> folder.</li><li>Upload your <strong>CSV file</strong>.</li><li>If steps <strong>1–7</strong> were configured correctly, the Snowflake table will populate automatically.</li></ol><p><strong><em>Must read</em></strong><em>: Ensure the target table schema (columns and data types) matches the source file. Otherwise, you’ll get an error and the pipe will fail.</em></p><h3>Conclusion</h3><p>By integrating AWS S3 with Snowflake, the company now has a centralized, scalable, and secure data platform. Data flows automatically from S3 into Snowflake, reducing delays and enabling real-time insights. This empowers business teams, analysts, and data scientists to make faster, data-driven decisions while ensuring the platform is ready to scale with future growth.</p><p>please refer to the link below to set up your aws account</p><p><a href="https://successekhosuehi.medium.com/aws-for-beginners-create-an-iam-user-that-can-assume-a-role-b4f49df19c2e">AWS for Beginners: Create an IAM User That Can Assume a Role</a></p><p>If you’d like to connect or discuss real-time data pipelines, feel free to reach out on LinkedIn:<a href="https://www.linkedin.com/in/suehi/](https://www.linkedin.com/in/suehi/)">https://www.linkedin.com/in/suehi/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a9438ee6555" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS for Beginners: Create an IAM User That Can Assume a Role]]></title>
            <link>https://successekhosuehi.medium.com/aws-for-beginners-create-an-iam-user-that-can-assume-a-role-b4f49df19c2e?source=rss-b11e513143e8------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4f49df19c2e</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[iam-roles]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[data-warehouse]]></category>
            <dc:creator><![CDATA[Success Ekhosuehi]]></dc:creator>
            <pubDate>Mon, 18 Aug 2025 23:01:34 GMT</pubDate>
            <atom:updated>2026-03-30T13:55:18.263Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Business Scenario:</strong> <em>Your cloud-based company stores all its data in AWS S3 buckets. You need to give a new data engineer access to a specific bucket so they can analyze the data, without granting permissions to other resources</em></p><p>Among the cloud providers, AWS, Azure, and Google Cloud Platform (GCP) dominate the landscape. For anyone looking to stay competitive, learning at least one of these platforms is a smart move. Regardless of your role data engineer, data scientist, data analyst, or cybersecurity expert cloud knowledge is becoming a necessary skill.</p><p>In this article, we’ll focus on Amazon Web Services (AWS). Together, we’ll create our first AWS account, set up an IAM user, and assign a custom role to this user following best practices. Don’t worry if this sounds intimidating. I felt the same way at first! You’ll have clear, step-by-step guidance, and you can always ask questions via any of my social media handle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6i79HIZ1iybY_XUqGKAU_A.png" /></figure><h3><strong>Step 1: Create an AWS account</strong></h3><p>If you don’t already have an AWS account, you can <a href="https://portal.aws.amazon.com/gp/aws/developer/registration/index.html?refid=em_127222&amp;p=free&amp;c=hp2&amp;z=1&amp;target=_blank">sign up</a> here to get started with the AWS Free Tier.</p><p>When you first create an AWS account, you’re granted access to the<strong> root user</strong>. It’s just a super admin of your AWS environment. The root user has unrestricted access to all AWS resources and services. Because of the power it holds, you should protect this account at all costs and avoid using it for daily operations hence why we need to create other user accounts with less permissions and access privileges.</p><h3><strong>Step 2: Create an AWS IAM User</strong></h3><ul><li>After creating the root user, go to the search bar at the top and type “IAM”. A pop-up like the one below will appear, click on it to access the IAM portal.</li><li>On the left side of the screen, click on “Users” to create a new user. Fill in any username of your choice, but for this project, we’re going with ehi_iam.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X98y5QKFSZbMFlwRcs3hDw.png" /><figcaption><strong>Fig 1:</strong> Steps to create a new AWS IAM user</figcaption></figure><ul><li>Click Next, and on the Set permissions page, scroll down and click Next again, we’ll be adding permissions to the IAM user shortly.</li><li>Create your own password then proceed to create the iam user.</li></ul><p><strong>P.S</strong>. We’ll continue working on the <strong>root user</strong> for now, but feel free to log in with your new IAM user just to make sure everything is working as expected.</p><p><strong><em>MUST READ</em></strong><em>: Once our IAM user is ready, the next task is to set up a Cloud storage resource. We’ll use Amazon S3 buckets, which is reliable, easy to scale, and considered the industry standard for cloud storage. S3 buckets also offers “eleven nines” of durability, meaning your data is extremely safe, and it can handle multiple data formats, making it versatile for almost any use case.</em></p><h3><strong>Step 3: Create an AWS S3 Bucket</strong></h3><p>In line with the <strong>principle of least privilege</strong>, we’ll create one central S3 bucket and give our IAM user access only to a specific folder within that bucket. This way, they can only work with what they need no unnecessary access to other files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tuUwbJx1mO3F1l4dSZWlfQ.png" /><figcaption><strong>Fig 2</strong>: Step-by-step process of creating an Amazon S3 bucket</figcaption></figure><h3>How to create the bucket:</h3><ul><li>Open the S3 service by typing <strong>“S3”</strong> in the AWS console search bar and selecting it.</li><li>On the S3 dashboard, click <strong>Create bucket</strong>.</li><li>Enter a globally unique name, like “<strong>ehi-first-bucket</strong>”.</li><li>Leave the rest of the settings as default and click <strong>Create bucket</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BH2ZqcWWCJuSiggWKknmZg.png" /><figcaption><strong>Fig 3</strong>: Creating a folder for S3 bucket</figcaption></figure><h3>Create a folder inside the bucket:</h3><ul><li>Open the newly created bucket.</li><li>Click <strong>Create folder</strong> (usually on the right side).</li><li>Name the folder something like “<strong>ehi-source-files”</strong>.</li><li>Click <strong>Create folder</strong>.</li></ul><p><strong><em>MUST READ</em></strong><em>: Now that our S3 bucket is ready, it’s time to control who can access it and what they can do. this is where IAM policies come in. Think of a policy as a rulebook: it tells AWS, “This user or role can access these parts of this bucket and nothing else.” In our scenario, the iam user is our new data engineer, ehi_iam, and we want them to have read-only access to a specific folder in the bucket.</em></p><h3>Step 4: Creating the policy</h3><ul><li>Go to the IAM console → <strong>Policies</strong> → <strong>Create policy</strong>.</li><li>Choose the <strong>JSON</strong> tab, delete any existing code, and paste:</li></ul><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;s3:GetObject&quot;,<br>                &quot;s3:GetObjectVersion&quot;<br>            ],<br>            &quot;Resource&quot;: &quot;arn:aws:s3:::&lt;bucket&gt;/&lt;prefix&gt;/*&quot;<br>        },<br>        {<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: &quot;s3:ListBucket&quot;,<br>            &quot;Resource&quot;: &quot;arn:aws:s3:::&lt;bucket&gt;&quot;,<br>            &quot;Condition&quot;: {<br>                &quot;StringLike&quot;: {<br>                    &quot;s3:prefix&quot;: [<br>                        &quot;*&quot;<br>                    ]<br>                }<br>            }<br>        }<br>    ]<br>}</pre><ul><li>Replace the placeholders:</li></ul><pre>Replace<br>&lt;bucket&gt; → your bucket name (e.g., ehi-first-bucket)<br><br><br>&lt;prefix&gt; → your folder name (e.g., ehi-source-files)<br><br><br>For example:<br>&quot;Resource&quot;: &quot;arn:aws:s3:::ehi-first-bucket/ehi-source-files/*&quot;</pre><ul><li>Click <strong>Next</strong>, name your policy (e.g., ehi-access), add a description if you want, and click <strong>Create policy</strong>.</li></ul><p><strong><em>MUST READ</em></strong><em>: Policies by themselves don’t do anything. They only take effect when attached to a user, group, or role. In our scenario, we’ll attach the policy to a role so that our data engineer, </em><strong><em>ehi_iam</em></strong><em>, gets the permissions defined in the policy whenever they assume that role.allowing them to interact with our S3 resources exactly as we’ve specified — no more, no less.</em></p><h3><strong>Step 5: Attach the Policy to a Role</strong></h3><h3>To create the role:</h3><ul><li>In IAM, go to <strong>Roles</strong> → <strong>Create role</strong>.</li><li>Choose <strong>AWS account</strong> as the trusted entity.</li><li>Tick <strong>Require external ID</strong> and enter 0000 (you can update this later).</li><li>Click <strong>Next</strong>.</li><li>Search for your policy (ehi-access), check it, and click <strong>Next</strong>.</li><li>Give your role a name, like ehi_role.</li><li>Click <strong>Create role</strong>.</li></ul><p><strong><em>MUST READ: </em></strong><em>It’s important to understand that creating a role and attaching a policy isn’t the final step. An IAM user still needs permission to assume the role. To make this work, the role must trust the user or account that will access it. This is done through a </em><strong><em>trust policy</em></strong><em>, which explicitly specifies which IAM user or entity is allowed to assume the role.</em></p><h3>Step 6: Configure the Role’s Trust Relationship</h3><ul><li>Go to the <strong>IAM</strong> service in the AWS console.</li><li>Select <strong>Roles</strong> from the sidebar and click on the role you created.</li><li>Navigate to the <strong>Trust relationships</strong> tab.</li><li>Click <strong>Edit trust policy</strong>.</li><li>Add your IAM user (ehi_iam) or account in the policy to allow them to assume the role.Save the changes.</li></ul><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Principal&quot;: {<br>                &quot;AWS&quot;: &quot;arn:aws:iam::&lt;your_account_id&gt;:user/ehi_iam&quot;<br>            },<br>            &quot;Action&quot;: &quot;sts:AssumeRole&quot;<br>        }<br>    ]<br>}</pre><p><strong><em>MUST READ: </em></strong><em>After creating the trust relationship, there’s one more step in AWS that strengthens security. In addition to the role’s trust policy, the IAM user must also have a policy granting permission to assume the role. Think of it as a handshake: the user’s policy names the role, and the role’s trust policy names the user. Both must be in place for the assumption to succeed.</em></p><h3>Step 7: Creating the “Right to Assume Role” Policy for the IAM User</h3><p>This policy will be attached directly to the IAM user, giving them explicit permission to assume the role we created earlier.</p><p><strong>a Open the IAM User Settings</strong></p><ul><li>Go to <strong>IAM</strong> in the AWS console.</li><li>Click on your IAM user (e.g., ehi_iam).</li></ul><p><strong>b Add a New Inline Policy</strong></p><ul><li>In the <strong>Permissions</strong> tab, click <strong>Add permissions</strong>.</li><li>Select <strong>Create inline policy</strong> (this will attach the policy directly to the user).</li></ul><p><strong>c Switch to JSON Editor</strong></p><ul><li>Click on the <strong>JSON</strong> tab in the policy editor.</li><li>Delete everything in the editor.</li><li>Paste the following code:</li></ul><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: &quot;sts:AssumeRole&quot;,<br>            &quot;Resource&quot;: &quot;arn:aws:iam::&lt;your_account_id&gt;:role/&lt;your_role&quot;<br>        }<br>    ]<br>}</pre><ul><li>Replace &lt;<strong>your_account_id</strong>&gt; with your AWS account ID.</li><li>Replace &lt;<strong>your_role</strong>&gt; with the exact name of the role you created (e.g., ehi_role).</li></ul><p><strong>d Name the Policy</strong></p><ul><li>Click <strong>Next</strong>.</li><li>Give your policy a descriptive name (e.g., Assume ehi_Role).</li><li>Click <strong>Create policy</strong>.</li></ul><p><strong><em>MUST READ</em></strong>: <em>With the inline policy in place, your IAM user now has explicit permission to assume the specified role, completing the ‘handshake’ between the user’s policy and the role’s trust policy. However, it’s important to note that the IAM user does not automatically inherit the role’s permissions. Instead, the user must manually switch to the role each time they want to access its privileges.</em></p><h3><strong>Step 8 Assuming the Role as the IAM User</strong></h3><p><strong>a Log in as the IAM User</strong></p><ul><li>Use the IAM user credentials to sign in to the AWS console.</li></ul><p><strong>b Access the Switch Role Option</strong></p><ul><li>In the top-right corner of the console, click on the IAM user’s name or account ID.</li><li>Select <strong>Switch role</strong> from the dropdown menu.</li></ul><p><strong>c Enter Role Details</strong></p><ul><li><strong>Account ID:</strong> Enter your AWS account ID.</li><li><strong>Role name:</strong> Enter the name of the role you created (e.g., ehi_role).</li><li>If applicable, enter the <strong>External ID</strong> you configured earlier (e.g., 0000).</li></ul><p><strong>d Confirm and Switch</strong></p><ul><li>Click <strong>Switch role</strong> to activate the session under that role’s permissions.</li></ul><p><strong>e Verify Access</strong></p><ul><li>Navigate to the <strong>S3</strong> section of the AWS console.</li></ul><p>By walking through these steps, you’ve successfully set up an IAM user, created a secure S3 bucket, and established the right permissions for role assumption using IAM policies and trust relationships. This approach follows the <strong>principle of least privilege</strong>, ensuring your new data engineer can only access the resources they need — nothing more.</p><p>In the next article will will create a snowflake account,intergrate our s3 bucket into our snowflake environment and using snowpipe we will stream and transform data in real time. see you there!</p><p>If you’d like to connect or discuss real-time data pipelines, feel free to reach out on LinkedIn:<a href="https://www.linkedin.com/in/suehi/](https://www.linkedin.com/in/suehi/)">https://www.linkedin.com/in/suehi/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4f49df19c2e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>