<?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 Chinomso Destiny Daniel on Medium]]></title>
        <description><![CDATA[Stories by Chinomso Destiny Daniel on Medium]]></description>
        <link>https://medium.com/@chinomsogeorge123?source=rss-b3fff4d36664------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*sSYrQhafn5GKB2jt6cP1sg.jpeg</url>
            <title>Stories by Chinomso Destiny Daniel on Medium</title>
            <link>https://medium.com/@chinomsogeorge123?source=rss-b3fff4d36664------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 11:27:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chinomsogeorge123/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[SwiftDeploy — A Declarative Container Deployment CLI]]></title>
            <link>https://medium.com/@chinomsogeorge123/swiftdeploy-a-declarative-container-deployment-cli-567f63e4e5f1?source=rss-b3fff4d36664------2</link>
            <guid isPermaLink="false">https://medium.com/p/567f63e4e5f1</guid>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Chinomso Destiny Daniel]]></dc:creator>
            <pubDate>Wed, 06 May 2026 20:30:16 GMT</pubDate>
            <atom:updated>2026-05-06T20:30:16.078Z</atom:updated>
            <content:encoded><![CDATA[<p>Modern deployments shouldn’t feel like duct-taping infrastructure together.</p><p><strong>SwiftDeploy</strong> is a declarative CLI that lets you define your entire container deployment once — and handles the rest.</p><p>Write a single manifest.yaml, and SwiftDeploy will:</p><ul><li>Generate all required configs</li><li>Manage your container lifecycle</li><li>Keep your application running reliably</li></ul><pre>manifest.yaml  →  swiftdeploy init  →  nginx.conf<br>                                      docker-compose.yml<br>                                      docker compose up</pre><h3>Why SwiftDeploy?</h3><p>In many teams, deployments become a mix of:</p><ul><li>handwritten configs</li><li>inconsistent environments</li><li>fragile rollout processes</li></ul><p>SwiftDeploy introduces a <strong>single source of truth</strong> approach — simple, predictable, and repeatable.</p><h3>Architecture Overview</h3><pre>manifest.yaml (single source of truth)<br>        │<br>        ▼<br>swiftdeploy init<br>        │<br>        ├── nginx.conf<br>        └── docker-compose.yml<br>                │<br>                ▼<br>        docker compose up<br>                │<br>        ┌───────────────┬───────────────┐<br>        ▼                               ▼<br>   nginx:latest                swift-deploy-1-node<br>   port 8080                  port 3000 (internal)<br>   reverse proxy              stable / canary</pre><h3>Prerequisites</h3><ul><li>Docker ≥ 24 (with Compose v2)</li><li>Python 3.8+</li><li>PyYAML</li></ul><p>Install PyYAML:</p><pre>pip install pyyaml</pre><h3>Quick Start</h3><p>Clone the repository:</p><pre>git clone https://github.com/desgee/Swift-deploy.git<br>cd swiftdeploy</pre><p>Build the API image:</p><pre>docker build -t swift-deploy-1-node:latest .</pre><p>Deploy:</p><pre>./swiftdeploy deploy</pre><p>Test:</p><pre>curl http://localhost:8080/<br>curl http://localhost:8080/healthz</pre><h3>Core Commands</h3><h3>init</h3><p>Generates configuration from manifest.yaml.</p><pre>./swiftdeploy init</pre><p>⚠️ Do not edit generated files manually.</p><h3>validate</h3><p>Runs pre-flight checks.</p><pre>./swiftdeploy validate</pre><p>Checks:</p><ol><li>Valid YAML</li><li>Required fields present</li><li>Docker image exists</li><li>Port availability</li><li>Valid Nginx config</li></ol><h3>deploy</h3><p>Full deployment with health checks.</p><pre>./swiftdeploy deploy</pre><ul><li>Runs init</li><li>Starts services</li><li>Waits for health checks</li></ul><h3>promote</h3><p>Switch deployment modes.</p><pre>./swiftdeploy promote canary<br>./swiftdeploy promote stable</pre><p>What it does:</p><ul><li>Updates manifest</li><li>Regenerates config</li><li>Restarts app container only</li><li>Confirms via /healthz</li></ul><h3>teardown</h3><p>Clean shutdown.</p><pre>./swiftdeploy teardown<br>./swiftdeploy teardown --clean</pre><h3>API Endpoints</h3><p>MethodPathDescriptionGET/App infoGET/healthzHealth checkPOST/chaosSimulate failures</p><h3>Chaos Testing (Canary Only)</h3><p>Simulate latency:</p><pre>curl -X POST http://localhost:8080/chaos \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{&quot;mode&quot;: &quot;slow&quot;, &quot;duration&quot;: 3}&#39;</pre><p>Inject errors:</p><pre>curl -X POST http://localhost:8080/chaos \<br>  -d &#39;{&quot;mode&quot;: &quot;error&quot;, &quot;rate&quot;: 0.5}&#39;</pre><p>Recover:</p><pre>curl -X POST http://localhost:8080/chaos \<br>  -d &#39;{&quot;mode&quot;: &quot;recover&quot;}&#39;</pre><h3>manifest.yaml</h3><pre>services:<br>  image: swift-deploy-1-node:latest<br>  port: 3000<br>  mode: stable<br>  version: &quot;1.0.0&quot;<br>  restart_policy: unless-stopped<br>  log_volume: swiftdeploy-logs</pre><pre>nginx:<br>  image: nginx:latest<br>  port: 8080<br>  proxy_timeout: 30<br>  contact: ops@swiftdeploy.io</pre><pre>network:<br>  name: swiftdeploy-net<br>  driver_type: bridge</pre><h3>Observability</h3><p>Log format:</p><pre>$time_iso8601 | $status | ${request_time}s | $upstream_addr | $request</pre><p>Example:</p><pre>2024-01-15T12:34:56+00:00 | 200 | 0.002s | 172.18.0.3:3000 | GET / HTTP/1.1</pre><h3>🔐 Security</h3><ul><li>Runs as non-root user</li><li>Drops unnecessary capabilities</li><li>Uses no-new-privileges</li><li>No direct exposure of app container</li><li>All traffic goes through Nginx</li></ul><h3>📁 Project Structure</h3><pre>swiftdeploy/<br>├── manifest.yaml<br>├── swiftdeploy<br>├── Dockerfile<br>├── app/<br>│   └── main.py<br>├── templates/<br>│   ├── nginx.conf.j2<br>│   └── docker-compose.yml.j2<br>├── nginx.conf<br>├── docker-compose.yml<br>└── README.md</pre><h3>🎯 Final Thoughts</h3><p>SwiftDeploy is built on a simple idea:</p><p><strong>Define once. Deploy consistently. Scale confidently.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=567f63e4e5f1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Built a System That Watches Your Server 24/7 and Automatically Blocks Hackers — Here’s How It…]]></title>
            <link>https://medium.com/@chinomsogeorge123/i-built-a-system-that-watches-your-server-24-7-and-automatically-blocks-hackers-heres-how-it-24b869e24d25?source=rss-b3fff4d36664------2</link>
            <guid isPermaLink="false">https://medium.com/p/24b869e24d25</guid>
            <category><![CDATA[docker-compose]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[ddos-attack]]></category>
            <category><![CDATA[devsecops]]></category>
            <dc:creator><![CDATA[Chinomso Destiny Daniel]]></dc:creator>
            <pubDate>Tue, 28 Apr 2026 11:50:49 GMT</pubDate>
            <atom:updated>2026-04-29T07:52:40.268Z</atom:updated>
            <content:encoded><![CDATA[<h3>I Built a System That Watches Your Server 24/7 and Automatically Blocks Hackers — Here’s How It Works</h3><p><em>What if your server could defend itself?</em></p><p>Imagine you run a cloud storage platform. Thousands of users upload files, share documents, and access their data every single day. Then one night, while you are asleep someone starts hammering your server with thousands of requests per second trying to break in.</p><p>By the time you wake up, your server is down. Your users are locked out. Your data might be compromised.</p><p>This is exactly the problem I was asked to solve as a DevSecOps Engineer using cloud.ng a Nextcloud-powered cloud storage service used by people all over the world.</p><p>My solution: <strong>an anomaly detection engine</strong> that watches every single HTTP request in real time, learns what normal traffic looks like, and automatically blocks attackers without any human intervention.</p><p>In this post I will walk you through exactly how I built it, in plain English. No security background needed.</p><h3>What Problem Are We Actually Solving?</h3><p>Every time someone visits a website, their browser sends an HTTP request to the server. Something like:</p><pre>GET /index.html from IP: 41.58.120.33</pre><p>On a normal day, a server might get 2 or 3 requests per second from any given user. Someone browsing, uploading a file, refreshing a page.</p><p>But during an attack called a <strong>DDoS (Distributed Denial of Service)</strong> — a single IP address (or many IPs working together) might send <strong>hundreds or thousands of requests per second</strong>. The goal is to overwhelm the server until it crashes and legitimate users can no longer access it.</p><p>The challenge is: <strong>how do you tell the difference between a busy legitimate user and an attacker?</strong></p><p>You cannot just say “block anyone who sends more than 10 requests per second” because:</p><ul><li>At 2am, 10 requests/second might be very unusual</li><li>At 2pm on a Monday, 10 requests/second might be completely normal</li><li>During a product launch, everyone sends lots of requests at once</li></ul><p>You need something smarter. You need a system that <strong>learns</strong> what normal looks like and raises the alarm when something deviates from that — regardless of the time of day.</p><p>That is exactly what I built.</p><h3>The Architecture — How Everything Fits Together</h3><p>Before we dive into the detection logic, let me show you the big picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*WAoKcRQ4TTxYmo4vz8opag.png" /></figure><p><strong>Nginx</strong> sits in front of Nextcloud like a reception desk. Every visitor goes through it and it writes a record of every single request to a log file in JSON format like this:</p><pre>{<br>  &quot;source_ip&quot;: &quot;41.58.120.33&quot;,<br>  &quot;timestamp&quot;: 1714123456.789,<br>  &quot;method&quot;: &quot;GET&quot;,<br>  &quot;path&quot;: &quot;/index.php&quot;,<br>  &quot;status&quot;: 200,<br>  &quot;response_size&quot;: 4521<br>}</pre><p>Our <strong>anomaly detector</strong> reads these log lines in real time the moment Nginx writes them. It analyses them, learns patterns, and takes action when something looks wrong.</p><p>All running as Docker containers on a Linux server. All automatically. All the time.</p><h3>Part 1: Watching the Log in Real Time</h3><p>The first challenge is reading the log file continuously without missing a single line. This is called <strong>tailing</strong> a file.</p><p>Think of the log file like a river. New lines keep flowing in at the bottom. Our detector stands at the bank watching everything that flows past.</p><p>Here is how monitor.py does it:</p><pre># Open the log file and jump to the end<br># (we don&#39;t want to replay old history)<br>file = open(&quot;/var/log/nginx/hng-access.log&quot;, &quot;r&quot;)<br>file.seek(0, 2)  # seek to end of file</pre><pre># Watch forever<br>while True:<br>    line = file.readline()</pre><pre>    if line:<br>        # A new log line arrived — parse it and process it<br>        entry = parse_line(line)<br>        queue.put(entry)<br>    else:<br>        # No new lines yet — wait a moment and try again<br>        time.sleep(0.1)</pre><p>Every 100 milliseconds, we check if a new line has appeared. The moment Nginx writes a new request, we see it and start processing it.</p><p>We also handle <strong>log rotation </strong>when the log file gets too big, Nginx creates a new one. Our detector detects this by watching the file’s inode number (a unique ID the OS gives every file). If the inode changes, we know a new file was created and we reopen it.</p><h3>Part 2: The Sliding Window — Short-Term Memory</h3><p>Now that we can see requests as they arrive, we need to answer: <strong>“How fast is this IP sending requests right now?”</strong></p><p>The naive approach would be: count all requests from that IP in the last minute. But “the last minute” resets every 60 seconds — it is not continuous. At second 59 you might have 100 requests, then at second 60 the counter resets to 0 even though 99 of those requests were just 1 second ago.</p><p>The right approach is a <strong>sliding window</strong> a window that moves forward in time continuously.</p><p>Here is how it works:</p><p>Instead of counting requests, we <strong>store the timestamp of each request</strong> in a deque (a special list that is fast at both ends):</p><pre>from collections import deque</pre><pre># For each IP, we keep a deque of request timestamps<br>ip_window = deque()</pre><pre># When a new request arrives, add its timestamp to the right<br>ip_window.append(1714123456.789)<br>ip_window.append(1714123457.123)<br>ip_window.append(1714123457.891)<br># ... and so on</pre><p>When we want to know the current rate, we:</p><ol><li>Remove any timestamps from the <strong>left</strong> that are older than 60 seconds</li><li>Count what is left</li><li>Divide by 60</li></ol><pre>now = time.time()<br>cutoff = now - 60  # 60 seconds ago</pre><pre># Evict old entries from the left<br># (oldest timestamps are always on the left because we append newest on the right)<br>while ip_window and ip_window[0] &lt; cutoff:<br>    ip_window.popleft()</pre><pre># What remains is all requests in the last 60 seconds<br>rate = len(ip_window) / 60  # requests per second</pre><p>This is a <strong>true sliding window</strong>. If 100 requests arrived 30 seconds ago, they are still counted. One second later, those same requests are still counted — the window has simply slid forward by one second.</p><p>We maintain one of these deques <strong>per IP address</strong> and one <strong>global deque</strong> for all traffic combined.</p><h3>The Rolling Baseline: Long-Term Memory</h3><p>The sliding window tells us what is happening <strong>right now</strong>. But to know if right now is unusual, we need to know what <strong>normal</strong> looks like.</p><p>This is the baseline.</p><p>Every second, we record how many total requests the server received in that second:</p><pre>Second 1:  3 requests<br>Second 2:  2 requests<br>Second 3:  4 requests<br>Second 4:  1 request<br>Second 5:  3 requests<br>...</pre><p>We keep 30 minutes of these per-second counts. Every 60 seconds, we compute two numbers from this data:</p><p><strong>Mean</strong> — the average requests per second:</p><pre>mean = sum(counts) / len(counts)<br># Example: mean = 2.6 req/s</pre><p><strong>Standard deviation</strong> — how much the traffic typically varies:</p><pre>variance = sum((x - mean)**2 for x in counts) / len(counts)<br>stddev = sqrt(variance)<br># Example: stddev = 0.8 req/s</pre><p>Together these two numbers describe what normal looks like. Mean = the typical level. Stddev = how much it normally swings up and down.</p><p>We also keep <strong>per-hour buckets</strong>. Traffic at 2am looks different from traffic at 2pm. If the current hour has enough data (60+ seconds), we prefer that hour’s statistics over the 30-minute rolling window. This means the detector adapts to the time of day automatically.</p><p>We also set <strong>floor values</strong> to handle startup:</p><pre>floor_mean:   0.1   # minimum mean — prevents false alarms when server is brand new<br>floor_stddev: 0.05  # minimum stddev</pre><p>Without these, a brand new server with 0 traffic would have a mean of 0 and the first real user would look like an attacker.</p><h3>Part 4: The Detection Logic: Making a Decision</h3><p>Now we have:</p><ul><li>Current rate (from the sliding window)</li><li>Baseline mean and stddev (from the rolling baseline)</li></ul><p>Time to decide: <strong>is this normal or an attack?</strong></p><p>We use a statistical concept called the <strong>Z-score</strong>:</p><pre>z-score = (current_rate - baseline_mean) / baseline_stddev</pre><p>The Z-score answers: <em>“How many standard deviations above normal is the current rate?”</em></p><ul><li>Z-score of 1.0 = slightly above average (happens all the time)</li><li>Z-score of 2.0 = noticeably above average (somewhat unusual)</li><li>Z-score of 3.0 = very far above average (only happens 0.13% of the time by chance)</li></ul><p><strong>We trigger an alert when the Z-score exceeds 3.0.</strong></p><pre>z = (current_rate - baseline_mean) / baseline_stddev</pre><pre>if z &gt; 3.0:<br>    # This is statistically very unusual — flag it<br>    trigger_alert(ip, condition=f&quot;z-score={z:.2f} &gt; 3.0&quot;)</pre><p>But Z-score alone is not enough. What if the baseline is very low (like 0.1 req/s) and the attacker is sending 2 req/s? That is a Z-score of maybe 24 — but an absolute rate of 2 req/s. We also check:</p><pre>if current_rate &gt; 5 * baseline_mean:<br>    # Rate is more than 5x normal — flag it regardless of z-score<br>    trigger_alert(ip, condition=f&quot;rate={current_rate:.2f} &gt; 5x mean&quot;)</pre><p><strong>Whichever fires first wins.</strong></p><h3>Error Surge Tightening</h3><p>There is one more trick. If an IP is getting a lot of 4xx errors (404 Not Found, 403 Forbidden, 401 Unauthorized) it might be <strong>scanning for vulnerabilities</strong> or trying to brute-force login pages. This is suspicious even at lower request rates.</p><p>When an IP’s error rate is more than 3x the baseline error rate, we halve the Z-score threshold from 3.0 to 1.5 making detection twice as sensitive for that IP:</p><pre>if ip_error_rate &gt; 3 * baseline_error_mean:<br>    # This IP is getting lots of errors — tighten the threshold<br>    effective_threshold = 3.0 * 0.5  # = 1.5</pre><h3>Part 5: Blocking with iptables</h3><p>When an IP is confirmed as an attacker, we need to stop them immediately. Not just slow them down but stop them completely.</p><p><strong>iptables</strong> is Linux’s built-in firewall. It operates at the kernel level, which means it intercepts packets before they even reach Nginx. Blocked IPs cannot complete a TCP connection. They just get dropped.</p><p>One command blocks an IP:</p><pre>iptables -I INPUT -s 41.58.120.33 -j DROP</pre><p>Breaking this down:</p><ul><li>-I INPUT — insert a rule at the top of the incoming traffic chain</li><li>-s 41.58.120.33 — for traffic from this source IP</li><li>-j DROP — silently drop the packet (attacker gets no response)</li></ul><p>We use -I (insert at top) instead of -A (append at bottom) so our block rules are checked first, before any allow rules.</p><p>Our Python code runs this command asynchronously — within 10 seconds of detection:</p><pre>proc = await asyncio.create_subprocess_exec(<br>    &quot;iptables&quot;, &quot;-I&quot;, &quot;INPUT&quot;, &quot;-s&quot;, ip, &quot;-j&quot;, &quot;DROP&quot;<br>)<br>await proc.communicate()</pre><h3>Progressive Ban Schedule</h3><p>We do not just block forever on the first offence. We use a <strong>backoff schedule</strong>:</p><p>Offence Ban Duration 1st time caught 10 minutes 2nd time caught 30 minutes 3rd time caught 2 hours 4th time and beyond Permanent</p><p>An unbanner process runs every 30 seconds and automatically releases expired bans. If the IP comes back and attacks again, the next ban is longer.</p><h3>Part 6: Slack Alerts</h3><p>Every ban, unban, and global spike sends a Slack message to our security channel:</p><pre>🚨 IP BANNED — 41.58.120.33<br>• Condition: z-score=8.42 &gt; 3.0 | rate=47.32 &gt; 5x mean=0.85<br>• Rate: 47.32 req/s  • Baseline: 0.85 req/s<br>• Ban Duration: 10 min (offense #1)<br>• Time: 2026-04-26 10:00:00 UTC</pre><p>This uses Slack’s Incoming Webhooks — a URL you POST a JSON message to and it appears in your channel. No polling, no third-party service.</p><h3>Part 7: The Live Dashboard</h3><p>The final piece is visibility. We serve a live web dashboard at port 8080 that refreshes every 3 seconds showing:</p><ul><li>Currently banned IPs</li><li>Global requests per second</li><li>Top 10 source IPs</li><li>CPU and memory usage</li><li>Current baseline mean and stddev</li><li>How long the detector has been running</li></ul><h3>Running It All with Docker</h3><p>The entire stack runs with one command:</p><pre>docker compose up -d --build</pre><p>Four containers start automatically:</p><pre>PostgreSQL  ← database for Nextcloud<br>Nextcloud   ← the cloud storage app (pre-built by HNG)<br>Nginx       ← reverse proxy, writes JSON logs<br>Detector    ← our Python daemon</pre><p>The Nginx logs are shared between containers via a Docker named volume called HNG-nginx-logs. Nginx writes to it. The detector reads from it. They never need to know about each other directly.</p><h3>What I Learned</h3><p>Building this taught me a few things that I did not fully appreciate before:</p><p><strong>Statistics are practical tools.</strong> Z-scores are not just a school concept. They are exactly the right tool for anomaly detection because they automatically adapt to whatever the baseline is.</p><p><strong>The baseline cannot be hardcoded.</strong> Traffic patterns change by hour, by day, by season. A fixed threshold of “100 requests per second = attack” would generate false alarms during busy periods and miss attacks during quiet ones.</p><p><strong>Layers of defence matter.</strong> The detector blocks at the OS level (iptables), logs everything to an audit file, sends real-time Slack alerts, and shows a live dashboard. Any one of these alone would be less useful than all of them together.</p><p><strong>Docker makes complex stacks manageable.</strong> Four services, one command. The shared volume pattern for log sharing is clean and requires no API between services.</p><h3>The Full Code</h3><p>The entire project is open source on GitHub: <br><a href="https://github.com/desgee/Anomaly-Detector-deamon.git">https://github.com/desgee/Anomaly-Detector-deamon.git</a></p><p>The repository includes:</p><ul><li>The full project folder</li><li>Nginx configuration with JSON logging</li><li>Docker Compose setup</li><li>Full README with setup instructions from a fresh server</li></ul><p><em>If you found this useful, follow me for more DevSecOps and cloud infrastructure content. And if you have questions about any part of the implementation, drop them in the comments — I read every one.</em></p><p><a href="https://www.linkedin.com/in/chinomso-george-daniel-pmp/">https://www.linkedin.com/in/chinomso-george-daniel-pmp/</a><br>https://github.com/desgee</p><p><strong>Tags:</strong> DevSecOps Python Docker Security Nginx Nextcloud Linux HNG</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24b869e24d25" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Reusable Infrastructure with Terraform Modules]]></title>
            <link>https://medium.com/@chinomsogeorge123/building-reusable-infrastructure-with-terraform-modules-abc277b23a36?source=rss-b3fff4d36664------2</link>
            <guid isPermaLink="false">https://medium.com/p/abc277b23a36</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform-modules]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Chinomso Destiny Daniel]]></dc:creator>
            <pubDate>Thu, 26 Mar 2026 06:49:34 GMT</pubDate>
            <atom:updated>2026-03-26T06:49:34.829Z</atom:updated>
            <content:encoded><![CDATA[<p>As I progressed in my Terraform journey, I realised something important: writing infrastructure code is only half the job, the real power comes from <strong>how reusable, scalable, and maintainable that code is</strong>.</p><p>This is where <strong>Terraform modules</strong> come in. Modules transform repetitive infrastructure scripts into clean, reusable building blocks, very similar to functions in software engineering.</p><p>In this post, I’ll break down:</p><ul><li>Module directory structure</li><li>How inputs and outputs work</li><li>How to call modules from a root configuration</li><li>What makes a module easy (or painful) to use</li><li>Best practices for structuring Terraform modules</li></ul><p><strong>What is a Terraform Module?<br></strong>A module is a self-contained unit of Terraform configuration that encapsulates infrastructure logic.</p><p>Instead of rewriting the same resources over and over again, you define them once inside a module and reuse them across environments.</p><h3>Module Directory Structure</h3><p>A clean module structure is critical for readability and reuse.</p><p>Here’s a standard layout:</p><pre>modules/<br>  ec2-instance/<br>    main.tf<br>    variables.tf<br>    outputs.tf<br>    README.md</pre><h3>What each file does:</h3><ul><li>main.tf → Core infrastructure logic</li><li>variables.tf → Inputs (configuration points)</li><li>outputs.tf → Values exposed to the caller</li><li>README.md → Documentation (very important!)</li></ul><h3>Module Inputs (Making Modules Configurable)</h3><p>Inputs allow you to customise your module without changing its internal logic.</p><h3>Example: variables.tf</h3><pre>variable &quot;instance_type&quot; {<br>  description = &quot;Type of EC2 instance&quot;<br>  type        = string<br>}</pre><pre>variable &quot;ami&quot; {<br>  description = &quot;AMI ID for the instance&quot;<br>  type        = string<br>}</pre><h3>Why this matters</h3><p>Inputs make your module:</p><ul><li>Flexible</li><li>Reusable across environments</li><li>Easy to adapt without rewriting code</li></ul><h3>Module Outputs (Exposing Values)</h3><p>Outputs allow your module to return useful information.</p><h3>Example: outputs.tf</h3><pre>output &quot;instance_id&quot; {<br>  value = aws_instance.web.id<br>}</pre><pre>output &quot;public_ip&quot; {<br>  value = aws_instance.web.public_ip<br>}</pre><h3>Why this matters</h3><p>Outputs enable:</p><ul><li>Communication between modules</li><li>Integration with other infrastructure layers</li><li>Visibility into deployed resources</li></ul><h3>Example Module: EC2 Instance</h3><h3>main.tf</h3><pre>resource &quot;aws_instance&quot; &quot;web&quot; {<br>  ami           = var.ami<br>  instance_type = var.instance_type</pre><pre>  tags = {<br>    Name = &quot;Terraform-Module-Instance&quot;<br>  }<br>}</pre><h3>Calling the Module from Root Configuration</h3><p>This is where the module gets used.</p><h3>Root main.tf</h3><pre>module &quot;web_server&quot; {<br>  source = &quot;../../modules/ec2-instance&quot;</pre><pre>  ami           = &quot;ami-123456&quot;<br>  instance_type = &quot;t2.micro&quot;<br>}</pre><p><strong>Key Flow</strong><br>Inputs → Module Logic → Outputs<br>You pass inputs<br>The module provisions resources<br>Outputs return useful values<br>Easy-to-Use vs Painful Modules</p><p>This is where real engineering judgment comes in.</p><p>✅ <strong>Easy-to-Use Module</strong><br>Clear input variables<br>Good defaults where possible<br>Minimal required configuration<br>Well-documented<br>Predictable outputs</p><p><strong>Painful Module</strong><br>Too many required inputs<br>Hardcoded values<br>Poor naming<br>No documentation<br>Unclear outputs</p><p><strong>Key Insight</strong></p><p>A module is not just about functionality, it’s about developer experience.</p><p><strong>Best Practices for Structuring Terraform Modules</strong></p><p>1. Use Clear Naming Conventions<br>Module names should reflect purpose:<br>ec2-instance<br>vpc-network<br>rds-database</p><p>Variable names should be:<br>Descriptive<br>Consistent</p><p>2. Keep Modules Small and Focused</p><p>One module = one responsibility</p><p>Bad:<br>One module creates VPC + EC2 + RDS</p><p>Good:<br>vpc module<br>ec2 module<br>rds module</p><p>3. When to Split a Module</p><p>Split when:</p><p>It’s doing too many things<br>It becomes hard to test or reuse<br>Different teams need different parts</p><p>4. Avoid Hardcoding Values</p><p>❌ Bad:</p><p>instance_type = “t2.micro”</p><p>✅ Good:</p><p>instance_type = var.instance_type</p><p>5. Provide Sensible Defaults<br>variable “instance_type” {<br> type = string<br> default = “t2.micro”<br>}</p><p>Makes the module easier to use</p><p>6. Write a Useful README (Very Important)</p><p>A good module README should include:</p><p>📌 Example structure:<br><strong># EC2 Instance Module</strong></p><p><strong>## Description</strong><br>Creates an EC2 instance with configurable parameters.</p><p><strong>## Inputs</strong><br>- instance_type (string)<br>- ami (string)</p><p><strong>## Outputs</strong><br>- instance_id<br>- public_ip</p><p><strong>## Usage</strong><br>module “web” {<br> source = “./modules/ec2-instance”</p><p>instance_type = “t2.micro”<br> ami = “ami-123456”<br>}<br><strong>Why README matters</strong><br>Saves time for other engineers<br>Improves adoption<br>Makes your GitHub stand out</p><p><strong>Final Thoughts</strong></p><p>Terraform modules are what turn infrastructure code into a scalable system.</p><p>Modules encapsulate logic<br>Inputs make them flexible<br>Outputs make them composable</p><p>But most importantly:</p><p>A good module is not just one that works, it’s one that others can use easily.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*NlozBehqKHsIHoG7j6mKSA.png" /><figcaption>Module structure</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=abc277b23a36" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[State Isolation: Workspaces vs File Layouts — When to Use Each]]></title>
            <link>https://medium.com/@chinomsogeorge123/state-isolation-workspaces-vs-file-layouts-when-to-use-each-16cb6fbe34c1?source=rss-b3fff4d36664------2</link>
            <guid isPermaLink="false">https://medium.com/p/16cb6fbe34c1</guid>
            <category><![CDATA[environment]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Chinomso Destiny Daniel]]></dc:creator>
            <pubDate>Wed, 25 Mar 2026 03:29:20 GMT</pubDate>
            <atom:updated>2026-03-25T03:29:20.971Z</atom:updated>
            <content:encoded><![CDATA[<p>When working with Terraform at scale, one of the first architectural decisions you’ll face is <strong>how to isolate state across environments</strong>. Whether you’re managing dev, staging, and production or multiple regions and teams, state isolation is critical to avoiding conflicts, ensuring safety, and enabling collaboration.</p><p>Two common approaches dominate this conversation: <strong>workspaces</strong> and <strong>file layouts</strong>. Both solve the same problem, but in very different ways and with very different trade-off.</p><p>This post breaks down both approaches honestly, highlights where each falls short, and gives a clear recommendation based on real-world usage.</p><p><strong>Create and switch between workspaces</strong></p><pre>terraform workspace new dev<br>terraform workspace new staging<br>terraform workspace new production<br>terraform workspace list<br>terraform workspace select dev</pre><h3>Why State Isolation Matters</h3><p>Terraform stores the current state of your infrastructure in a state file. Without proper isolation:</p><ul><li>Changes meant for <em>dev</em> could accidentally impact <em>production</em></li><li>Multiple engineers could overwrite each other’s work</li><li>Debugging becomes painful and error-prone</li></ul><p>So the question isn’t <em>if</em> you should isolate state — it’s <em>how</em>.</p><h3>Approach 1: Workspaces</h3><p>Workspaces allow you to use <strong>the same Terraform configuration</strong> but maintain <strong>separate state files</strong> for different environments.</p><h3>How It Works</h3><p>You define your infrastructure once, and Terraform manages different states like:</p><ul><li>dev</li><li>staging</li><li>production</li></ul><p>You switch between them using:</p><pre>terraform workspace select dev</pre><h3>Approach 2: File Layouts</h3><p>File layouts isolate environments by using <strong>separate directories</strong> for each one.</p><h3>Example Structure</h3><pre>environment/<br>  dev/<br>    main.tf<br>  staging/<br>    main.tf<br>  prod/<br>    main.tf</pre><p>Each environment has its own configuration and backend.</p><h3>Advantages of File Layouts</h3><p><strong>1. Strong isolation (code + state)</strong><br>Each environment is fully independent:</p><ul><li>Separate state files</li><li>Separate configurations</li><li>Reduced risk of accidental cross-environment changes</li></ul><p><strong>2. Safer for production systems</strong><br>You physically cannot “accidentally” apply dev code to prod without explicitly navigating to the prod directory.</p><p>This adds a layer of safety that workspaces simply don’t provide.</p><p><strong>3. Better for team collaboration</strong></p><ul><li>Clear separation of responsibilities</li><li>Easier CI/CD pipeline integration</li><li>More predictable deployments</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*C5YrA1t2rU1bj5FOFmpoWw.png" /></figure><h3>When to Use Workspaces</h3><p>Workspaces are a good fit when:</p><ul><li>You’re working on <strong>small projects</strong></li><li>Environments are <strong>nearly identical</strong></li><li>You’re working <strong>solo or in a small team</strong></li><li>You want <strong>quick experimentation or prototyping</strong></li></ul><h3>When to Use File Layouts</h3><p>File layouts are better when:</p><ul><li>You’re managing <strong>production systems</strong></li><li>You need <strong>strict environment separation</strong></li><li>You’re working in <strong>teams</strong></li><li>Environments have <strong>different configurations</strong></li><li>You’re building <strong>CI/CD pipelines</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*sbcG7TMP5i4ANtLk0EzBIg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16cb6fbe34c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Managing Terraform State: Best Practices for DevOps]]></title>
            <link>https://medium.com/@chinomsogeorge123/managing-terraform-state-best-practices-for-devops-60e1ce0c3922?source=rss-b3fff4d36664------2</link>
            <guid isPermaLink="false">https://medium.com/p/60e1ce0c3922</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform-state-lock]]></category>
            <category><![CDATA[aws-s3]]></category>
            <dc:creator><![CDATA[Chinomso Destiny Daniel]]></dc:creator>
            <pubDate>Tue, 24 Mar 2026 22:26:03 GMT</pubDate>
            <atom:updated>2026-03-24T22:26:03.770Z</atom:updated>
            <content:encoded><![CDATA[<ul><li><em>What is Terraform State?</em></li><li><em>Shared Storage for State Files</em></li><li><em>Managing State Across Teams</em></li></ul><p>Terraform state is a mapping between your Terraform configuration and real-world infrastructure, In order to properly and correctly manage your infrastructure resources, terraform stores the state of your managed infrastructure. Terraform uses this state on each execution to plan and make changes to your infrastructure. This state must be stored and maintained on each execution so future operations can perform correctly.</p><p><strong>Benefits of State</strong><br>During execution, Terraform will examine the state of the currently running infrastructure, determine what differences exist between the current state and the revised desired state, and indicate the necessary changes that must be applied. When approved to proceed, only the necessary changes will be applied, leaving existing, valid infrastructure untouched.</p><p><strong>What It Contains</strong><br>Resource IDs (e.g, EC2 instance IDs)<br>Metadata<br>Dependency relationships<br>Current state of infrastructure</p><p><strong>Without State</strong></p><p>Terraform would:</p><ul><li>Recreate resources every time</li><li>Lose track of infrastructure</li><li>Break your environment</li></ul><p><strong>Shared Storage for State Files</strong><br>Default: Local State, Stored on your machine:</p><p><strong>Problems:</strong><br>Not shareable<br>Risk of overwrites<br>No locking<br>Unsafe for teams</p><p><strong>Best Practice: Remote State</strong></p><p>Uses centralised storage</p><p>Common Setup (AWS)<br>S3 Bucket → stores state file<br>DynamoDB Table → provides locking</p><h3>Configure Remote State Storage with S3 and DynamoDB</h3><p>Create a separate “bootstrap” Terraform project<br>Step 1: Create a new folder<br>mkdir terraform-bootstrap<br>cd terraform-bootstrap<br>Step 2: Create a file<br>touch main.tf<br>Step 3: Paste your code into main.tf</p><pre>resource &quot;aws_s3_bucket&quot; &quot;terraform_state&quot; {<br>  bucket = &quot;your-unique-terraform-state-bucket&quot;</pre><pre>  lifecycle {<br>    prevent_destroy = true<br>  }<br>}</pre><pre>resource &quot;aws_s3_bucket_versioning&quot; &quot;enabled&quot; {<br>  bucket = aws_s3_bucket.terraform_state.id<br>  versioning_configuration {<br>    status = &quot;Enabled&quot;<br>  }<br>}</pre><pre>resource &quot;aws_s3_bucket_server_side_encryption_configuration&quot; &quot;default&quot; {<br>  bucket = aws_s3_bucket.terraform_state.id<br>  rule {<br>    apply_server_side_encryption_by_default {<br>      sse_algorithm = &quot;AES256&quot;<br>    }<br>  }<br>}</pre><pre>resource &quot;aws_dynamodb_table&quot; &quot;terraform_locks&quot; {<br>  name         = &quot;terraform-state-locks&quot;<br>  billing_mode = &quot;PAY_PER_REQUEST&quot;<br>  hash_key     = &quot;LockID&quot;</pre><pre>  attribute {<br>    name = &quot;LockID&quot;<br>    type = &quot;S&quot;<br>  }<br>}</pre><p>Step 4:Configure (paste)the backend block in your Terraform configuration:</p><pre>terraform {<br>  backend &quot;s3&quot; {<br>    bucket         = &quot;your-unique-terraform-state-bucket&quot;<br>    key            = &quot;global/s3/terraform.tfstate&quot;<br>    region         = &quot;us-east-1&quot;<br>    dynamodb_table = &quot;terraform-state-locks&quot;<br>    encrypt        = true<br>  }<br>}</pre><p><strong>Step 5 — Migrate your state by running terraform init again.</strong> <br>Terraform will detect the new backend and offer to copy your existing local state to S3.<br>Confirm the migration worked by checking your S3 bucket in the AWS Console — your state file should be there, versioned and encrypted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EqFNp1rkFBMsSGpix4CSlg.png" /></figure><p><strong>Test State Locking</strong><br>Open two terminal windows pointing to the same Terraform configuration. In the first, run terraform apply. While it is running, attempt terraform plan in the second. Observe the lock error. Document what it says and why this protection matters in a team environment.<br>Step 4: Initialize Terraform (LOCAL state)<br>terraform init.</p><p>Output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w4gT_R2fNHGhS6Kqwosflw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60e1ce0c3922" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Managing High Traffic Applications with AWS Elastic Load Balancer and Terraform]]></title>
            <link>https://medium.com/@chinomsogeorge123/managing-high-traffic-applications-with-aws-elastic-load-balancer-and-terraform-3d9331c78d62?source=rss-b3fff4d36664------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d9331c78d62</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform-state]]></category>
            <category><![CDATA[load-balancing]]></category>
            <dc:creator><![CDATA[Chinomso Destiny Daniel]]></dc:creator>
            <pubDate>Tue, 24 Mar 2026 03:00:51 GMT</pubDate>
            <atom:updated>2026-03-24T03:00:51.822Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Terraform State</strong></p><p>It is stored in a file called terraform.tfstate</p><p><strong>What it does</strong></p><p>It maps your terraform code to real AWS resources<br>It stores resources ids, metadata, dependencies</p><p><strong>Task</strong></p><p>Deploy a fully configured <strong>AWS Application Load Balancer</strong> in front of your Auto Scaling Group.</p><p>The deployment should include:</p><ul><li>An Application Load Balancer with a public-facing listener on port 80</li><li>A Target Group configured for HTTP health checks</li><li>An Auto Scaling Group attachment to the Target Group</li><li>Security groups that allow inbound HTTP to the ALB and restrict direct access to instances</li><li>Output values exposing the ALB DNS name</li></ul><pre>output &quot;alb_dns_name&quot; {<br>  value       = aws_lb.example.dns_name<br>  description = &quot;The domain name of the load balancer&quot;<br>}</pre><p>After applying, hit the ALB DNS name in your browser and confirm it routes to your instances. Test that if you stop one instance, the ALB continues serving traffic from the others.<br><strong>main.tf</strong></p><pre>###############################################################<br># Data source – fetch AZs dynamically so we never hardcode them<br>###############################################################<br>data &quot;aws_availability_zones&quot; &quot;all&quot; {}<br><br>data &quot;aws_vpc&quot; &quot;default&quot; {<br>  default = true<br>}<br><br>data &quot;aws_subnets&quot; &quot;default&quot; {<br>  filter {<br>    name   = &quot;vpc-id&quot;<br>    values = [data.aws_vpc.default.id]<br>  }<br>}<br><br>data &quot;aws_ami&quot; &quot;amazon_linux_2&quot; {<br>  most_recent = true<br>  owners      = [&quot;amazon&quot;]<br><br>  filter {<br>    name   = &quot;name&quot;<br>    values = [<br>      &quot;amzn2-ami-hvm-*-x86_64-gp2&quot;,<br>      &quot;amzn2-ami-hvm-*-x86_64-gp3&quot;<br>    ]<br>  }<br>}<br><br>###############################################################<br># Security group – EC2 instances<br>###############################################################<br>resource &quot;aws_security_group&quot; &quot;instance&quot; {<br>  name = &quot;terraform-asg-instance&quot;<br><br>  ingress {<br>    from_port       = var.server_port<br>    to_port         = var.server_port<br>    protocol        = &quot;tcp&quot;<br>    security_groups = [aws_security_group.alb.id]<br>  }<br><br>  egress {<br>    from_port   = 0<br>    to_port     = 0<br>    protocol    = &quot;-1&quot;<br>    cidr_blocks = [&quot;0.0.0.0/0&quot;]<br>  }<br>}<br><br>###############################################################<br># Security group – ALB<br>###############################################################<br>resource &quot;aws_security_group&quot; &quot;alb&quot; {<br>  name = &quot;terraform-asg-alb&quot;<br><br>  ingress {<br>    from_port   = var.alb_port<br>    to_port     = var.alb_port<br>    protocol    = &quot;tcp&quot;<br>    cidr_blocks = [&quot;0.0.0.0/0&quot;]<br>  }<br><br>  egress {<br>    from_port   = 0<br>    to_port     = 0<br>    protocol    = &quot;-1&quot;<br>    cidr_blocks = [&quot;0.0.0.0/0&quot;]<br>  }<br>}<br><br>resource &quot;aws_launch_template&quot; &quot;example&quot; {<br>  name_prefix   = &quot;terraform-asg-example-&quot;<br>  image_id      = data.aws_ami.amazon_linux_2.id<br>  instance_type = var.instance_type<br><br>  vpc_security_group_ids = [aws_security_group.instance.id]<br><br>  user_data = base64encode(&lt;&lt;-EOF<br>    #!/bin/bash<br>    mkdir -p /opt/web<br>    cat &gt; /opt/web/index.html &lt;&lt;&#39;HTML&#39;<br>    &lt;!DOCTYPE html&gt;<br>    &lt;html lang=&quot;en&quot;&gt;<br>    &lt;head&gt;<br>      &lt;meta charset=&quot;UTF-8&quot; /&gt;<br>      &lt;title&gt;Highly Available Web App&lt;/title&gt;<br>      &lt;style&gt;<br>        body {<br>          font-family: Georgia, serif;<br>          display: flex;<br>          align-items: center;<br>          justify-content: center;<br>          min-height: 100vh;<br>          margin: 0;<br>          background: #0f1923;<br>          color: #f0f0f0;<br>        }<br>        .card {<br>          text-align: center;<br>          padding: 60px 80px;<br>          border: 1px solid #2a3a4a;<br>          border-radius: 8px;<br>          background: #162030;<br>          max-width: 640px;<br>        }<br>        h1 {<br>          font-size: 2rem;<br>          font-weight: normal;<br>          line-height: 1.4;<br>          margin: 0 0 24px;<br>          color: #7eb8f7;<br>        }<br>        p {<br>          font-size: 0.95rem;<br>          color: #8a9bac;<br>          margin: 0;<br>        }<br>        .host {<br>          margin-top: 28px;<br>          font-size: 0.8rem;<br>          color: #4a6a8a;<br>          font-family: monospace;<br>        }<br>      &lt;/style&gt;<br>    &lt;/head&gt;<br>    &lt;body&gt;<br>      &lt;div class=&quot;card&quot;&gt;<br>        &lt;h1&gt;Deploying a Highly Available Web App on AWS Using Terraform&lt;/h1&gt;<br>        &lt;p&gt;Served via an Application Load Balancer &amp;amp; Auto Scaling Group&lt;/p&gt;<br>        &lt;div class=&quot;host&quot;&gt;Instance: $(hostname -f)&lt;/div&gt;<br>      &lt;/div&gt;<br>    &lt;/body&gt;<br>    &lt;/html&gt;<br>    HTML<br><br>    PORT=${var.server_port}<br><br>    if command -v python3 &gt;/dev/null 2&gt;&amp;1; then<br>      nohup python3 -m http.server &quot;$PORT&quot; --directory /opt/web &gt; /var/log/webserver.log 2&gt;&amp;1 &amp;<br>    elif command -v python &gt;/dev/null 2&gt;&amp;1; then<br>      nohup python -m SimpleHTTPServer &quot;$PORT&quot; &gt; /var/log/webserver.log 2&gt;&amp;1 &amp;<br>    elif command -v busybox &gt;/dev/null 2&gt;&amp;1; then<br>      nohup busybox httpd -f -p &quot;$PORT&quot; -h /opt/web &gt; /var/log/webserver.log 2&gt;&amp;1 &amp;<br>    elif command -v nc &gt;/dev/null 2&gt;&amp;1; then<br>      nohup bash -c &#39;while true; do printf &quot;HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nConnection: close\r\n\r\n%s&quot; &quot;$(cat /opt/web/index.html)&quot; | nc -l -p &#39;&quot;$PORT&quot;&#39; -q 1; done&#39; &gt; /var/log/webserver.log 2&gt;&amp;1 &amp;<br>    else<br>      echo &quot;No supported web server runtime found&quot; &gt; /var/log/webserver.log<br>    fi<br>    EOF<br>  )<br><br>  lifecycle {<br>    create_before_destroy = true<br>  }<br>}<br><br>###############################################################<br># Auto Scaling Group<br>###############################################################<br>resource &quot;aws_autoscaling_group&quot; &quot;example&quot; {<br>  vpc_zone_identifier = data.aws_subnets.default.ids<br>  launch_template {<br>    id      = aws_launch_template.example.id<br>    version = &quot;$Latest&quot;<br>  }<br><br>  instance_refresh {<br>    strategy = &quot;Rolling&quot;<br><br>    preferences {<br>      min_healthy_percentage = 50<br>    }<br><br>    triggers = [&quot;launch_template&quot;]<br>  }<br><br>  min_size = var.asg_min_size<br>  desired_capacity = var.desired_size<br>  max_size = var.asg_max_size<br>  health_check_grace_period = 300<br><br>  target_group_arns = [aws_lb_target_group.asg.arn]<br>  health_check_type = &quot;ELB&quot;<br><br>  tag {<br>    key                 = &quot;Name&quot;<br>    value               = &quot;terraform-asg-example&quot;<br>    propagate_at_launch = true<br>  }<br>}<br><br>###############################################################<br># Application Load Balancer<br>###############################################################<br>resource &quot;aws_lb&quot; &quot;example&quot; {<br>  name               = &quot;terraform-asg-example&quot;<br>  load_balancer_type = &quot;application&quot;<br>  subnets            = data.aws_subnets.default.ids<br>  security_groups    = [aws_security_group.alb.id]<br>}<br><br>###############################################################<br># Target Group<br>###############################################################<br>resource &quot;aws_lb_target_group&quot; &quot;asg&quot; {<br>  name     = &quot;terraform-asg-example&quot;<br>  port     = var.server_port<br>  protocol = &quot;HTTP&quot;<br>  vpc_id   = data.aws_vpc.default.id<br><br>  health_check {<br>    path                = &quot;/&quot;<br>    protocol            = &quot;HTTP&quot;<br>    matcher             = &quot;200&quot;<br>    interval            = 15<br>    timeout             = 3<br>    healthy_threshold   = 2<br>    unhealthy_threshold = 2<br>  }<br>}<br><br>###############################################################<br># Listener<br>###############################################################<br>resource &quot;aws_lb_listener&quot; &quot;http&quot; {<br>  load_balancer_arn = aws_lb.example.arn<br>  port              = var.alb_port<br>  protocol          = &quot;HTTP&quot;<br><br>  default_action {<br>    type             = &quot;forward&quot;<br>    target_group_arn = aws_lb_target_group.asg.arn<br>  }<br>}<br></pre><p><strong>variables.tf</strong></p><pre>variable &quot;server_port&quot; {<br>  description = &quot;Port the web server listens on&quot;<br>  type        = number<br>  default     = 8080<br>}<br><br>variable &quot;alb_port&quot; {<br>  description = &quot;Port the ALB listener accepts traffic on&quot;<br>  type        = number<br>  default     = 80<br>}<br><br>variable &quot;instance_type&quot; {<br>  description = &quot;EC2 instance type for the ASG&quot;<br>  type        = string<br>  default     = &quot;t2.micro&quot;<br>}<br><br>variable &quot;asg_min_size&quot; {<br>  description = &quot;Minimum number of EC2 instances in the ASG&quot;<br>  type        = number<br>  default     = 2<br>}<br><br>variable &quot;desired_size&quot; {<br>  description = &quot;Desired number of EC2 instances in the ASG&quot;<br>  type        = number<br>  default     = 5<br>}<br><br>variable &quot;asg_max_size&quot; {<br>  description = &quot;Maximum number of EC2 instances in the ASG&quot;<br>  type        = number<br>  default     = 10<br>}</pre><p><strong>outputs.tf</strong></p><pre>output &quot;alb_dns_name&quot; {<br>  description = &quot;The domain name of the load balancer&quot;<br>  value       = aws_lb.example.dns_name<br>}</pre><p><strong>Deployment</strong></p><pre>terraform init<br>terraform plan<br>terraform apply<br>terraform output -raw alb_dns_name</pre><p><strong>Output</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*oy9LKIPDwXZdvztEQG9aNQ.png" /></figure><p><strong>Confirm Deployment</strong></p><pre>http://terraform-asg-example-689549894.eu-west-2.elb.amazonaws.com</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q1m4wdyRLGTHawpiXtC4bQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d9331c78d62" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying a Highly Available Web App on AWS Using Terraform]]></title>
            <link>https://medium.com/@chinomsogeorge123/day-4-deploying-a-highly-available-web-app-on-aws-using-terraform-329d02357314?source=rss-b3fff4d36664------2</link>
            <guid isPermaLink="false">https://medium.com/p/329d02357314</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Chinomso Destiny Daniel]]></dc:creator>
            <pubDate>Mon, 23 Mar 2026 17:37:35 GMT</pubDate>
            <atom:updated>2026-03-24T02:37:29.540Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Task:</strong><br><em>Use an Auto Scaling Group (ASG) backed by a Launch Configuration and put an Application Load Balancer (ALB) in front of it.<br>Your cluster should include:<br>A Launch Configuration or Launch Template defining the instance spec<br>An Auto Scaling Group with a minimum of 2 instances and a maximum of 5<br>An Application Load Balancer distributing traffic across the instances<br>A Target Group and Listener connecting the ALB to the ASG<br>Security groups allowing HTTP traffic in and all traffic out<br>Use a data source to fetch the list of available availability zones dynamically:</em><br>data “aws_availability_zones” “all” {}<br><em>Deploy, confirm the ALB DNS name resolves and returns your web page, then destroy everything.</em></p><p><strong>Deploying the cluster Webserver</strong></p><p>The project files<br>variables.tf</p><pre>variable &quot;server_port&quot; {<br>  description = &quot;Port the web server listens on&quot;<br>  type        = number<br>  default     = 8080<br>}<br><br>variable &quot;alb_port&quot; {<br>  description = &quot;Port the ALB listener accepts traffic on&quot;<br>  type        = number<br>  default     = 80<br>}<br><br>variable &quot;instance_type&quot; {<br>  description = &quot;EC2 instance type for the ASG&quot;<br>  type        = string<br>  default     = &quot;t2.micro&quot;<br>}<br><br>variable &quot;asg_min_size&quot; {<br>  description = &quot;Minimum number of EC2 instances in the ASG&quot;<br>  type        = number<br>  default     = 2<br>}<br><br>variable &quot;desired_size&quot; {<br>  description = &quot;Desired number of EC2 instances in the ASG&quot;<br>  type        = number<br>  default     = 5<br>}<br><br>variable &quot;asg_max_size&quot; {<br>  description = &quot;Maximum number of EC2 instances in the ASG&quot;<br>  type        = number<br>  default     = 10<br>}</pre><p><strong>Why these defaults?</strong><br>server_port 8080 — keeps the app port separate from port 80, which requires root privileges on Linux. The ALB handles port 80 externally and forwards to 8080 internally.<br>alb_port 80 — standard HTTP so any browser reaches the ALB without specifying a port.<br>instance_type t2.micro — free tier eligible, appropriate for learning and lab work.<br>asg_min_size 2 — two instances across two AZs means the app stays up if one AZ has an outage.<br>asg_max_size 5 — caps scaling to control cost while leaving room for genuine traffic growth.</p><p><strong>main.tf</strong></p><p>Full cluster configuration: data sources, security groups, launch configuration, ASG, ALB, target group, and listener.</p><pre>###############################################################<br># Data source – fetch AZs dynamically so we never hardcode them<br>###############################################################<br>data &quot;aws_availability_zones&quot; &quot;all&quot; {}<br><br>data &quot;aws_vpc&quot; &quot;default&quot; {<br>  default = true<br>}<br><br>data &quot;aws_subnets&quot; &quot;default&quot; {<br>  filter {<br>    name   = &quot;vpc-id&quot;<br>    values = [data.aws_vpc.default.id]<br>  }<br>}<br><br>data &quot;aws_ami&quot; &quot;amazon_linux_2&quot; {<br>  most_recent = true<br>  owners      = [&quot;amazon&quot;]<br><br>  filter {<br>    name   = &quot;name&quot;<br>    values = [<br>      &quot;amzn2-ami-hvm-*-x86_64-gp2&quot;,<br>      &quot;amzn2-ami-hvm-*-x86_64-gp3&quot;<br>    ]<br>  }<br>}<br><br>###############################################################<br># Security group – EC2 instances<br>###############################################################<br>resource &quot;aws_security_group&quot; &quot;instance&quot; {<br>  name = &quot;terraform-asg-instance&quot;<br><br>  ingress {<br>    from_port   = var.server_port<br>    to_port     = var.server_port<br>    protocol    = &quot;tcp&quot;<br>    cidr_blocks = [&quot;0.0.0.0/0&quot;]<br>  }<br><br>  egress {<br>    from_port   = 0<br>    to_port     = 0<br>    protocol    = &quot;-1&quot;<br>    cidr_blocks = [&quot;0.0.0.0/0&quot;]<br>  }<br>}<br><br>###############################################################<br># Security group – ALB<br>###############################################################<br>resource &quot;aws_security_group&quot; &quot;alb&quot; {<br>  name = &quot;terraform-asg-alb&quot;<br><br>  ingress {<br>    from_port   = var.alb_port<br>    to_port     = var.alb_port<br>    protocol    = &quot;tcp&quot;<br>    cidr_blocks = [&quot;0.0.0.0/0&quot;]<br>  }<br><br>  egress {<br>    from_port   = 0<br>    to_port     = 0<br>    protocol    = &quot;-1&quot;<br>    cidr_blocks = [&quot;0.0.0.0/0&quot;]<br>  }<br>}<br><br>resource &quot;aws_launch_template&quot; &quot;example&quot; {<br>  name_prefix   = &quot;terraform-asg-example-&quot;<br>  image_id      = data.aws_ami.amazon_linux_2.id<br>  instance_type = var.instance_type<br><br>  vpc_security_group_ids = [aws_security_group.instance.id]<br><br>  user_data = base64encode(&lt;&lt;-EOF<br>    #!/bin/bash<br>    mkdir -p /opt/web<br>    cat &gt; /opt/web/index.html &lt;&lt;&#39;HTML&#39;<br>    &lt;!DOCTYPE html&gt;<br>    &lt;html lang=&quot;en&quot;&gt;<br>    &lt;head&gt;<br>      &lt;meta charset=&quot;UTF-8&quot; /&gt;<br>      &lt;title&gt;Highly Available Web App&lt;/title&gt;<br>      &lt;style&gt;<br>        body {<br>          font-family: Georgia, serif;<br>          display: flex;<br>          align-items: center;<br>          justify-content: center;<br>          min-height: 100vh;<br>          margin: 0;<br>          background: #0f1923;<br>          color: #f0f0f0;<br>        }<br>        .card {<br>          text-align: center;<br>          padding: 60px 80px;<br>          border: 1px solid #2a3a4a;<br>          border-radius: 8px;<br>          background: #162030;<br>          max-width: 640px;<br>        }<br>        h1 {<br>          font-size: 2rem;<br>          font-weight: normal;<br>          line-height: 1.4;<br>          margin: 0 0 24px;<br>          color: #7eb8f7;<br>        }<br>        p {<br>          font-size: 0.95rem;<br>          color: #8a9bac;<br>          margin: 0;<br>        }<br>        .host {<br>          margin-top: 28px;<br>          font-size: 0.8rem;<br>          color: #4a6a8a;<br>          font-family: monospace;<br>        }<br>      &lt;/style&gt;<br>    &lt;/head&gt;<br>    &lt;body&gt;<br>      &lt;div class=&quot;card&quot;&gt;<br>        &lt;h1&gt;Deploying a Highly Available Web App on AWS Using Terraform&lt;/h1&gt;<br>        &lt;p&gt;Served via an Application Load Balancer &amp;amp; Auto Scaling Group&lt;/p&gt;<br>        &lt;div class=&quot;host&quot;&gt;Instance: $(hostname -f)&lt;/div&gt;<br>      &lt;/div&gt;<br>    &lt;/body&gt;<br>    &lt;/html&gt;<br>    HTML<br><br>    PORT=${var.server_port}<br><br>    if command -v python3 &gt;/dev/null 2&gt;&amp;1; then<br>      nohup python3 -m http.server &quot;$PORT&quot; --directory /opt/web &gt; /var/log/webserver.log 2&gt;&amp;1 &amp;<br>    elif command -v python &gt;/dev/null 2&gt;&amp;1; then<br>      nohup python -m SimpleHTTPServer &quot;$PORT&quot; &gt; /var/log/webserver.log 2&gt;&amp;1 &amp;<br>    elif command -v busybox &gt;/dev/null 2&gt;&amp;1; then<br>      nohup busybox httpd -f -p &quot;$PORT&quot; -h /opt/web &gt; /var/log/webserver.log 2&gt;&amp;1 &amp;<br>    elif command -v nc &gt;/dev/null 2&gt;&amp;1; then<br>      nohup bash -c &#39;while true; do printf &quot;HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nConnection: close\r\n\r\n%s&quot; &quot;$(cat /opt/web/index.html)&quot; | nc -l -p &#39;&quot;$PORT&quot;&#39; -q 1; done&#39; &gt; /var/log/webserver.log 2&gt;&amp;1 &amp;<br>    else<br>      echo &quot;No supported web server runtime found&quot; &gt; /var/log/webserver.log<br>    fi<br>    EOF<br>  )<br><br>  lifecycle {<br>    create_before_destroy = true<br>  }<br>}<br><br>###############################################################<br># Auto Scaling Group<br>###############################################################<br>resource &quot;aws_autoscaling_group&quot; &quot;example&quot; {<br>  vpc_zone_identifier = data.aws_subnets.default.ids<br>  launch_template {<br>    id      = aws_launch_template.example.id<br>    version = &quot;$Latest&quot;<br>  }<br><br>  instance_refresh {<br>    strategy = &quot;Rolling&quot;<br><br>    preferences {<br>      min_healthy_percentage = 50<br>    }<br><br>    triggers = [&quot;launch_template&quot;]<br>  }<br><br>  min_size = var.asg_min_size<br>  desired_capacity = var.desired_size<br>  max_size = var.asg_max_size<br>  health_check_grace_period = 300<br><br>  target_group_arns = [aws_lb_target_group.asg.arn]<br>  health_check_type = &quot;ELB&quot;<br><br>  tag {<br>    key                 = &quot;Name&quot;<br>    value               = &quot;terraform-asg-example&quot;<br>    propagate_at_launch = true<br>  }<br>}<br><br>###############################################################<br># Application Load Balancer<br>###############################################################<br>resource &quot;aws_lb&quot; &quot;example&quot; {<br>  name               = &quot;terraform-asg-example&quot;<br>  load_balancer_type = &quot;application&quot;<br>  subnets            = data.aws_subnets.default.ids<br>  security_groups    = [aws_security_group.alb.id]<br>}<br><br>###############################################################<br># Target Group<br>###############################################################<br>resource &quot;aws_lb_target_group&quot; &quot;asg&quot; {<br>  name     = &quot;terraform-asg-example&quot;<br>  port     = var.server_port<br>  protocol = &quot;HTTP&quot;<br>  vpc_id   = data.aws_vpc.default.id<br><br>  health_check {<br>    path                = &quot;/&quot;<br>    protocol            = &quot;HTTP&quot;<br>    matcher             = &quot;200&quot;<br>    interval            = 15<br>    timeout             = 3<br>    healthy_threshold   = 2<br>    unhealthy_threshold = 2<br>  }<br>}<br><br>###############################################################<br># Listener<br>###############################################################<br>resource &quot;aws_lb_listener&quot; &quot;http&quot; {<br>  load_balancer_arn = aws_lb.example.arn<br>  port              = var.alb_port<br>  protocol          = &quot;HTTP&quot;<br><br>  default_action {<br>    type             = &quot;forward&quot;<br>    target_group_arn = aws_lb_target_group.asg.arn<br>  }<br>}<br></pre><p>outputs.tf</p><pre>output &quot;alb_dns_name&quot; {<br>  description = &quot;DNS name of the Application Load Balancer&quot;<br>  value       = aws_lb.example.dns_name<br>}</pre><p><strong>How the resources connect</strong><br>The Launch Configuration defines the EC2 blueprint (AMI, type, user data, security group).<br>The ASG reads the Launch Configuration and uses data.aws_availability_zones.all.names to spread instances across every AZ automatically.<br>The ASG registers each instance into the Target Group via target_group_arns.<br>The ALB is attached to default VPC subnets fetched by data source and protected by its own security group.</p><p>The Listener binds the ALB on port 80 and forwards all requests to the Target Group.<br>The Target Group runs health checks on port 8080 / path “/” and only routes to healthy instances.</p><p>Deployment Steps</p><pre>terraform init<br>terraform plan<br>terraform apply<br>yes</pre><h3>terraform output</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*x8XCg4CCm2cG3MNn7RTCpA.png" /></figure><p><strong>Deployment Confirmation</strong></p><p><a href="http://terraform-asg-example-671204943.eu-west-2.elb.amazonaws.com/">http://terraform-asg-example-671204943.eu-west-2.elb.amazonaws.com</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VS-Soqo0R1qg4Svz88ZeNA.png" /></figure><p><strong>Cleanup</strong><br><em>terraform destroy</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4gKOU9b-apQHHQv1Rv4Q7g.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=329d02357314" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying My First Server with Terraform (Step-by-Step Tutorial)]]></title>
            <link>https://medium.com/@chinomsogeorge123/deploying-my-first-server-with-terraform-step-by-step-tutorial-923754a0f419?source=rss-b3fff4d36664------2</link>
            <guid isPermaLink="false">https://medium.com/p/923754a0f419</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[web-server]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Chinomso Destiny Daniel]]></dc:creator>
            <pubDate>Sun, 22 Mar 2026 03:04:19 GMT</pubDate>
            <atom:updated>2026-03-22T03:04:19.670Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction</strong><br>On Day 3 the goal was simple to deploy a working web server on AWS using Terraform and access it from the browser.</p><p><strong>Prerequisites</strong></p><p>AWS Account</p><p>Terraform Installed</p><h3>The Terraform Code</h3><p>main.tf</p><pre>provider &quot;aws&quot; {<br>  region = &quot;eu-central-1&quot;<br>}<br><br># Get latest Ubuntu AMI<br>data &quot;aws_ami&quot; &quot;ubuntu&quot; {<br>  most_recent = true<br><br>  owners = [&quot;099720109477&quot;] # Canonical<br><br>  filter {<br>    name   = &quot;name&quot;<br>    values = [&quot;ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*&quot;]<br>  }<br>}<br><br># Security Group<br>resource &quot;aws_security_group&quot; &quot;web_sg&quot; {<br>  name        = &quot;web-sg&quot;<br>  description = &quot;Allow HTTP and SSH&quot;<br><br>  ingress {<br>    description = &quot;HTTP&quot;<br>    from_port   = 80<br>    to_port     = 80<br>    protocol    = &quot;tcp&quot;<br>    cidr_blocks = [&quot;0.0.0.0/0&quot;]<br>  }<br><br>  ingress {<br>    description = &quot;SSH&quot;<br>    from_port   = 22<br>    to_port     = 22<br>    protocol    = &quot;tcp&quot;<br>    cidr_blocks = [&quot;0.0.0.0/0&quot;] # Do not do this in production<br>  }<br><br>  egress {<br>    from_port   = 0<br>    to_port     = 0<br>    protocol    = &quot;-1&quot;<br>    cidr_blocks = [&quot;0.0.0.0/0&quot;]<br>  }<br>}<br><br># EC2 Instance<br>resource &quot;aws_instance&quot; &quot;web&quot; {<br>  ami           = data.aws_ami.ubuntu.id<br>  instance_type = &quot;t3.micro&quot;<br><br>  security_groups = [aws_security_group.web_sg.name]<br><br>  user_data = file(&quot;userdata.sh&quot;)<br><br>  tags = {<br>    Name = &quot;Terraform-Web-Server&quot;<br>  }<br>}</pre><p><strong>The Provider Block</strong></p><pre>provider &quot;aws&quot; {<br>  region = &quot;eu-central-1&quot;<br>}</pre><p>This tells Terraform to use AWS and deploy everything in the Frankfurt region — eu-central-1.</p><p><strong>The Security Group</strong><br>I created a security group to allow inbound and outbound traffic</p><pre># Security Group<br>resource &quot;aws_security_group&quot; &quot;web_sg&quot; {<br>  name        = &quot;web-sg&quot;<br>  description = &quot;Allow HTTP and SSH&quot;<br><br>  ingress {<br>    description = &quot;HTTP&quot;<br>    from_port   = 80<br>    to_port     = 80<br>    protocol    = &quot;tcp&quot;<br>    cidr_blocks = [&quot;0.0.0.0/0&quot;]<br>  }<br><br>  ingress {<br>    description = &quot;SSH&quot;<br>    from_port   = 22<br>    to_port     = 22<br>    protocol    = &quot;tcp&quot;<br>    cidr_blocks = [&quot;0.0.0.0/0&quot;] # Do not do this in production<br>  }<br><br>  egress {<br>    from_port   = 0<br>    to_port     = 0<br>    protocol    = &quot;-1&quot;<br>    cidr_blocks = [&quot;0.0.0.0/0&quot;]<br>  }<br>}<br><br></pre><p>This gives access to port 80 for inbound traffic and for outbound it gives access to all ports through all protocols.</p><p><strong>EC2 Instance</strong></p><pre># EC2 Instance<br>resource &quot;aws_instance&quot; &quot;web&quot; {<br>  ami           = data.aws_ami.ubuntu.id<br>  instance_type = &quot;t3.micro&quot;<br><br>  security_groups = [aws_security_group.web_sg.name]<br><br>  user_data = file(&quot;userdata.sh&quot;)<br><br>  tags = {<br>    Name = &quot;Terraform-Web-Server&quot;<br>  }<br>}</pre><p><strong>Userdata.sh</strong></p><pre>#!/bin/bash<br>apt update -y<br>apt install -y apache2<br><br>systemctl start apache2<br>systemctl enable apache2<br><br>cat &lt;&lt;EOF &gt; /var/www/html/index.html<br>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>    &lt;title&gt;Terraform Web Server&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>    &lt;h1&gt; Deployed with Terraform&lt;/h1&gt;<br>    &lt;p&gt;This web server is running on AWS EC2 (Ubuntu)&lt;/p&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;<br>EOF</pre><p>This launches a server, Installs Apache and creates a simple web page automatically.</p><h3>Outputs</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*0cC5f6TtBzGU8FXYFzhwTw.png" /></figure><p><strong>Variables.tf</strong></p><pre>variable &quot;instance_type&quot; {<br>  default = &quot;t3.micro&quot;<br>}</pre><h3>Step 1: Initialize Terraform</h3><pre>terraform init</pre><p>The downloads AWS provider and prepares the working directory</p><h3>Step 2: Run Terraform Plan</h3><pre>terraform plan</pre><p>This shows what terraform will create but no actual changes takes effect at this point.</p><h3>Step 3: Run Terraform Apply</h3><pre>terraform apply</pre><pre>yes</pre><p>This creates the Security group, EC2 instance and returns the public ip and the web url</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*0cC5f6TtBzGU8FXYFzhwTw.png" /></figure><h3>Step 4: Test the Server</h3><pre>http://3.66.226.222</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*mMqQVc-6UqY7PXyiTTbQxQ.png" /></figure><h3>Step 5: Clean Up</h3><pre>terraform destroy</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=923754a0f419" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up Terraform Environment]]></title>
            <link>https://medium.com/@chinomsogeorge123/day-2-of-my-30-day-terraform-challenge-setting-up-terraform-environment-ac50cc361f92?source=rss-b3fff4d36664------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac50cc361f92</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Chinomso Destiny Daniel]]></dc:creator>
            <pubDate>Wed, 18 Mar 2026 22:16:47 GMT</pubDate>
            <atom:updated>2026-03-24T02:36:46.515Z</atom:updated>
            <content:encoded><![CDATA[<p>Before you can build, you have to prepare. And yesterday was all about laying the foundation.</p><p>Setting up my environment wasn’t just a checklist task, it was a reminder that every solid system starts with the right tools, properly configured and ready to scale. From creating AWS IAM access and secret keys, installing AWS CLI, configuring AWS CLI, Installing Terraform, to adding HashiCorp Terraform and AWS Toolkit extensions to the IDE. Yesterday was about getting everything aligned for what’s ahead.</p><p>✅ Terraform installed</p><p>✅ AWS CLI installed and configured configured</p><p>✅ Credentials verified</p><p>✅ Environment fully ready</p><p>Now the real fun begins, deploying infrastructure as code</p><p>As promised, kindly find the detailed step-by-step documentation</p><p><a href="https://www.notion.so/Day-2-Setting-Up-Your-Terraform-Environment-3270ceb381a38052a984cf419cb85d54?source=copy_link">Day 2: Setting Up Your Terraform Environment | Notion</a></p><p>The journey continues!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*EuWkjYgAoRmnJYfgK2Jmxg.jpeg" /></figure><p>#30DayTerraformChallenge #TerraformChallenge #TerraformSetup #AWS #DevOps #AWSUserGroupKenya #EveOps</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac50cc361f92" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Infrastructure as Code and Why It’s Transforming DevOps]]></title>
            <link>https://medium.com/@chinomsogeorge123/what-is-infrastructure-as-code-and-why-its-transforming-devops-e6c2883aa0f9?source=rss-b3fff4d36664------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6c2883aa0f9</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[30dayterraformchallenge]]></category>
            <category><![CDATA[hashicorp]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <dc:creator><![CDATA[Chinomso Destiny Daniel]]></dc:creator>
            <pubDate>Tue, 17 Mar 2026 22:21:42 GMT</pubDate>
            <atom:updated>2026-03-17T22:21:42.660Z</atom:updated>
            <content:encoded><![CDATA[<p>A few months ago, whenever I needed to deploy infrastructure in the cloud, my process looked something like this.</p><p>Open the cloud console.<br> Click through multiple tabs.<br> Create a server.<br> Configure networking.<br> Attach storage.<br> Set permissions.</p><p>Then repeat the same process again… and again… and again.</p><p>At first, it felt manageable. But as systems grew larger and more complex, something became obvious: <strong>manual infrastructure management doesn’t scale</strong>.</p><p>One small mistake in configuration could break an entire environment. Reproducing the same setup for development, staging, and production became time-consuming. And documenting every step so someone else could replicate it felt almost impossible.</p><p>That’s when I began hearing more about <strong>Infrastructure as Code (IaC), </strong>the idea that infrastructure shouldn’t be created by clicking buttons, but instead <strong>defined in code</strong>.</p><p>The concept immediately made sense. If developers use code to build applications, why shouldn’t engineers use code to build infrastructure?</p><p>Recently, I decided to go deeper by joining the <strong>30-Day Terraform Challenge</strong> organized by AWS UG AI/ML Kenya, Meru HashiCorp User Group, and the EveOps community.</p><p>On Day 1 of the challenge, I started reading <em>Terraform: Up &amp; Running</em> by Yevgeniy Brikman, and it reinforced a powerful shift happening in the way modern infrastructure is managed.</p><p>🔹 𝐖𝐡𝐚𝐭 𝐢𝐬 𝐈𝐧𝐟𝐫𝐚𝐬𝐭𝐫𝐮𝐜𝐭𝐮𝐫𝐞 𝐚𝐬 𝐂𝐨𝐝𝐞 (𝐈𝐚𝐂)?<br> IaC is the practice of managing and provisioning infrastructure through code instead of manual processes. Rather than clicking through cloud consoles, infrastructure is defined in version-controlled configuration files. This solves problems like inconsistency, configuration drift, and slow manual deployments, enabling teams to build reliable and repeatable environments.</p><p>🔹 𝐃𝐞𝐜𝐥𝐚𝐫𝐚𝐭𝐢𝐯𝐞 𝐯𝐬 𝐈𝐦𝐩𝐞𝐫𝐚𝐭𝐢𝐯𝐞 𝐀𝐩𝐩𝐫𝐨𝐚𝐜𝐡𝐞𝐬<br> One concept that stood out was the difference between imperative and declarative infrastructure management.<br>Imperative: You define step-by-step instructions for creating infrastructure.<br>Declarative: You define the desired end state, and the tool figures out how to achieve it.<br>Terraform uses a declarative approach, which simplifies infrastructure management and reduces human error.</p><p>🔹 𝐖𝐡𝐲 𝐓𝐞𝐫𝐫𝐚𝐟𝐨𝐫𝐦 𝐢𝐬 𝐖𝐨𝐫𝐭𝐡 𝐋𝐞𝐚𝐫𝐧𝐢𝐧𝐠<br> Terraform has become a standard tool in modern DevOps and cloud engineering because it allows teams to automate infrastructure across multiple cloud providers while maintaining consistency, scalability, and version control.</p><p>🎯 𝐌𝐲 𝐆𝐨𝐚𝐥 𝐟𝐨𝐫 𝐓𝐡𝐢𝐬 30-𝐃𝐚𝐲 𝐂𝐡𝐚𝐥𝐥𝐞𝐧𝐠𝐞<br> Over the next 30 days, I aim to:<br> • Deepen my Infrastructure as Code skills<br> • Build and manage cloud infrastructure using Terraform<br> • Share my learning journey publicly and contribute to the DevOps community</p><p>Looking forward to the next 29 days of learning and building! Let’s build.💡</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*EuWkjYgAoRmnJYfgK2Jmxg.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6c2883aa0f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>