<?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 Mandy Reed on Medium]]></title>
        <description><![CDATA[Stories by Mandy Reed on Medium]]></description>
        <link>https://medium.com/@mandymreed?source=rss-8e7c70fd4f14------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*WpfcDjJGh6nokgyhqrgfLg.png</url>
            <title>Stories by Mandy Reed on Medium</title>
            <link>https://medium.com/@mandymreed?source=rss-8e7c70fd4f14------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 08:28:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mandymreed/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[☁️ I Built a Real-Time AWS Pipeline. My Kitten Had Other Plans. ]]></title>
            <link>https://medium.com/@mandymreed/%EF%B8%8F-i-built-a-real-time-aws-pipeline-my-kitten-had-other-plans-81ba484f1f1b?source=rss-8e7c70fd4f14------2</link>
            <guid isPermaLink="false">https://medium.com/p/81ba484f1f1b</guid>
            <dc:creator><![CDATA[Mandy Reed]]></dc:creator>
            <pubDate>Mon, 16 Nov 2026 01:07:47 GMT</pubDate>
            <atom:updated>2026-11-16T01:07:47.098Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Building a serverless network telemetry pipeline with Kinesis, Lambda, DynamoDB, Terraform, and a tiny supervisor who believes keyboards are beds.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ltKcPsRTyqlWcVv-xZGThg.png" /><figcaption><em>Cloud engineering is difficult enough without a kitten who considers your keyboard prime real estate. Meet Koda, my newest and least productive project supervisor. 🐾</em></figcaption></figure><h3>🐾 First, Let Me Introduce My Project Supervisor</h3><p>I had a plan.</p><p>Build a real-time data processing pipeline on AWS. Use Terraform to provision the infrastructure. Generate simulated network traffic with Python. Process everything through Lambda. Store the results in DynamoDB.</p><p>Simple enough, right?</p><p>Well, first of all, we know how my projects usually go.</p><p>Second, I recently adopted a kitten named Koda.</p><p>Koda has decided that my laptop is the single greatest invention in human history.</p><p>Not because he appreciates technology.</p><p>Not because he’s interested in cloud engineering.</p><p>Because apparently the keyboard is warm, and my attempts to type are deeply offensive to him.</p><p>So while I was trying to troubleshoot Kinesis, Lambda, and Terraform, I also had a tiny furry coworker who kept attempting to shut down development.</p><p><strong>Deployment blocked by Koda.</strong> 🐾</p><p>Honestly, I’ve encountered less persistent production issues.</p><p>But despite the feline interference, we managed to build something pretty interesting.</p><p>And naturally, once it worked, I decided to break it.</p><p>Because apparently that’s just what I do now. 😂</p><h3>☁️ The Project: Real-Time Network Telemetry on AWS</h3><p>This project started with an idea inspired by my AWS coursework: build an infrastructure solution capable of processing real-time data.</p><p>I wanted to take that concept further.</p><p>Instead of simply connecting AWS services and calling it finished, I wanted to understand how a streaming application behaves when something goes wrong.</p><p>What happens when Lambda receives malformed data?</p><p>Does one bad record affect the rest of a batch?</p><p>What happens when retries are exhausted?</p><p>Can I isolate invalid records without losing valid ones?</p><p>And how do I know the entire pipeline is actually working?</p><p>Those questions turned a relatively straightforward streaming project into an exercise in serverless processing, monitoring, failure handling, and resilience.</p><h3>🏗️ The Architecture</h3><p>The primary data flow was:</p><p><strong>Python → Amazon Kinesis Data Streams → AWS Lambda → Amazon DynamoDB</strong></p><p>I also added:</p><ul><li>Amazon SQS for failed-batch information and malformed-record quarantine.</li><li>Amazon CloudWatch for logs, metrics, and alarms.</li><li>Amazon SNS for email notifications.</li><li>Terraform to provision and manage the infrastructure.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gzv0UYLfdRtOICMBrLbv4Q.png" /><figcaption><em>The final AWS architecture. What started as a simple streaming pipeline eventually grew into a system with monitoring, retry controls, and separate failure-handling paths.</em></figcaption></figure><p>I built the infrastructure in AWS us-east-1, using Terraform to keep the configuration reproducible.</p><p>And yes, everything was eventually destroyed after testing.</p><p>We’ll get to that part. 😈</p><h3>🚀 Phase 1: Terraform, Kinesis, and a Reasonable Amount of Optimism</h3><p>I started with Terraform.</p><p>The initial goal was to deploy an Amazon Kinesis Data Stream that could receive simulated network events.</p><p>For this lab, I configured:</p><ul><li>One provisioned shard.</li><li>A 24-hour retention period.</li><li>A stream named network-telemetry-stream.</li></ul><p>The idea was straightforward.</p><p>My Python application would generate network traffic records, send them to Kinesis, and eventually Lambda would process those records.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HYMBRAXu-o4JYDqvtOcQaw.png" /><figcaption><em>My Kinesis Data Stream, deployed through Terraform with one provisioned shard and 24-hour retention.</em></figcaption></figure><p>One thing I appreciate about working with Terraform is that I’m getting more comfortable understanding how resources connect.</p><p>For example, instead of manually copying a Kinesis ARN into the Lambda configuration, Terraform can reference it directly:</p><pre>event_source_arn = aws_kinesis_stream.network_events.arn</pre><p>That tells Terraform to use the ARN of the Kinesis stream it manages.</p><p>It’s a small line of code, but understanding those relationships has been an important part of my infrastructure-as-code learning.</p><p>And fortunately, Terraform behaved itself during the initial deployment.</p><p>Which should have been my first warning.</p><h3>🐍 Phase 2: Generating My Own Network Traffic</h3><p>Next, I wrote a Python application using Boto3 to generate simulated network events.</p><p>Each event included information such as:</p><ul><li>A unique event ID.</li><li>Source and destination IP addresses.</li><li>Destination port.</li><li>Protocol.</li><li>Bytes transferred.</li><li>An action of ACCEPT or REJECT.</li><li>A timestamp.</li></ul><p>The initial version generated ten events and stopped.</p><p>That was enough to verify that Python could authenticate with AWS and successfully submit records to Kinesis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*YYmlftuGgpIt6WQLFeVxAQ.png" /><figcaption><em>The first successful test of my Python network traffic generator. Ten simulated events made it into Kinesis.</em></figcaption></figure><p>At this point, I had a producer and a stream.</p><p>But getting records into Kinesis wasn’t the same as processing them.</p><p>That required the next piece of the architecture.</p><h3>⚡ Phase 3: Lambda Meets DynamoDB</h3><p>I deployed a Python-based Lambda function named:</p><p>network-telemetry-processor</p><p>The function receives Kinesis records, decodes the payload, parses the JSON, validates the event, and determines a traffic classification.</p><p>I kept the classification logic intentionally simple.</p><ul><li><strong>REJECTED:</strong> Action is REJECT.</li><li><strong>NORMAL:</strong> Action is ACCEPT and destination port is 80 or 443.</li><li><strong>UNUSUAL:</strong> Action is ACCEPT and destination port is anything other than 80 or 443.</li></ul><p>These are demonstration rules, not a production intrusion-detection system.</p><p>After classification, Lambda writes the event to DynamoDB.</p><p>I used event_id as the table&#39;s partition key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*Ab4Y-ipIEeP45VH78T3gww.png" /><figcaption><em>The first successfully processed network events stored in DynamoDB, complete with classification metadata added by Lambda.</em></figcaption></figure><p>And just like that, the primary pipeline worked.</p><p><strong>Python → Kinesis → Lambda → DynamoDB</strong></p><p>Records were flowing.</p><p>Lambda was processing.</p><p>DynamoDB was storing.</p><p>I could have stopped there.</p><p>But where’s the fun in that?</p><h3>📊 Phase 4: Monitoring Something Before I Break It</h3><p>Before deliberately introducing failures, I wanted visibility into what the application was doing.</p><p>I configured CloudWatch logging and monitored Lambda metrics such as invocations, duration, and errors.</p><p>Then I created a CloudWatch alarm to detect Lambda execution errors.</p><p>The alarm was configured to trigger when the Lambda Errors metric reached at least one error during a 60-second period.</p><p>I connected the alarm to an SNS topic with a confirmed email subscription.</p><p>That gave me an alerting path:</p><p><strong>Lambda error → CloudWatch alarm → SNS → Email</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uw0q7usC9ce1zJcf4KstyA.png" /><figcaption><em>The CloudWatch alarm configured to detect Lambda errors and trigger an SNS notification.</em></figcaption></figure><p>Of course, creating an alarm doesn’t prove that it works.</p><p>So I intentionally triggered a Lambda failure.</p><p>CloudWatch detected the error, transitioned into the alarm state, and SNS delivered the notification.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KowQ-5eUDL_oE5Gkxui9vQ.png" /><figcaption><em>Success! A deliberately triggered Lambda error produced a real CloudWatch alarm and an SNS email notification.</em></figcaption></figure><p>There is something oddly satisfying about receiving an AWS error notification when you caused the error on purpose.</p><p>For once, the alert was good news. 😂</p><p>And now that I knew the monitoring worked, it was time to investigate something more interesting.</p><h3>😈 Phase 5: What Happens When One Kinesis Record Is Bad?</h3><p>This is where the project really started getting interesting.</p><p>I created a controlled test with three records:</p><ol><li>A valid network event.</li><li>A malformed JSON record.</li><li>Another valid network event.</li></ol><p>My original Lambda processor assumed incoming records contained valid JSON.</p><p>That assumption worked beautifully.</p><p>Right up until it didn’t.</p><p>When Lambda encountered the malformed record, JSON parsing failed.</p><p>I examined the CloudWatch logs and watched the resulting failure behavior.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*urMBreCJdroMLvjf7fHYfg.png" /><figcaption><em>My deliberately malformed Kinesis record triggered a JSON parsing error, giving me a chance to investigate Lambda’s retry behavior.</em></figcaption></figure><p>This exposed an important issue.</p><p>When Lambda consumes records from Kinesis, failures can affect processing progress.</p><p>A bad record can cause a batch to be retried, which means valid records may be encountered again.</p><p>That matters because a streaming pipeline needs to handle failures without creating unnecessary duplicate processing or getting stuck on permanently invalid data.</p><p>So I went back to Terraform.</p><h3>Adding Retry Controls</h3><p>I configured the Lambda event source mapping with:</p><pre>maximum_retry_attempts         = 2<br>bisect_batch_on_function_error = true</pre><p>The retry limit prevents unlimited retries.</p><p>Batch splitting helps isolate problematic records when function-level batch failures occur.</p><p>I also configured an SQS destination for failed-batch information after applicable retry or discard conditions are met.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*VXaQmj3BXUw15pDPEGNn1g.png" /><figcaption><em>The SQS failed-batch destination received failure information after the configured Kinesis processing failure conditions were reached.</em></figcaption></figure><p>That was useful, but it wasn’t the complete solution.</p><p>I still needed the application itself to handle malformed records more gracefully.</p><p>And that led to the next upgrade.</p><h3>🛡️ Phase 6: Making Lambda More Resilient</h3><p>The original processor was fine when everything went according to plan.</p><p>Unfortunately, real applications don’t have the luxury of assuming that every incoming record is perfect.</p><p>So I upgraded the Lambda processor.</p><h3>Input Validation</h3><p>Instead of assuming the event contained all required fields, the function now validates the incoming data.</p><h3>Malformed-Record Quarantine</h3><p>I created a dedicated SQS queue:</p><p>network-telemetry-quarantine</p><p>When Lambda identifies a malformed record, it sends information about that record to the quarantine queue.</p><p>That information includes the failure reason, Kinesis sequence number, timestamp, and original encoded payload.</p><p>The invalid record can then be investigated separately.</p><h3>Idempotent DynamoDB Writes</h3><p>I also added conditional DynamoDB writes.</p><p>This prevents a record with an existing event_id from overwriting the previously stored event.</p><p>Why does that matter?</p><p>Because Kinesis and Lambda processing can involve retries.</p><p>If records are processed more than once, the application needs to handle that possibility safely.</p><h3>Partial Batch Failure Reporting</h3><p>I enabled:</p><pre>function_response_types = [<br>  &quot;ReportBatchItemFailures&quot;<br>]</pre><p>This allows Lambda to report retryable record failures using Kinesis sequence numbers.</p><p>For Kinesis, processing can resume from the lowest reported failed sequence number, meaning subsequent records may be processed again.</p><p>Another reason idempotency matters.</p><h3>The Retest</h3><p>Once the resilience improvements were deployed, I repeated the same three-record experiment.</p><p>Valid record.</p><p>Malformed JSON.</p><p>Valid record.</p><p>This time, the results were much better.</p><p>The malformed record was identified and sent to SQS quarantine.</p><p>The two valid records were successfully processed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s134mc9fHsxjC694YR3WXA.png" /><figcaption><em>CloudWatch logs showing the upgraded Lambda processor identifying and quarantining a malformed network record.</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*0dig1kkwvcC0oqtF4UXL1A.png" /><figcaption><em>The malformed event preserved in the dedicated SQS quarantine queue, including information needed to investigate the validation failure.</em></figcaption></figure><p>This was one of my favorite parts of the project.</p><p>Not because the first version failed.</p><p>But because I could see exactly why it failed, make changes, and prove that the improved version behaved differently.</p><p><strong>Build it. Break it. Fix it. Learn from it.</strong></p><p>That’s becoming a theme. 😂</p><h3>🔄 Phase 7: Let’s Keep the Traffic Flowing</h3><p>By this point, my Python generator was still primarily designed for limited tests.</p><p>I wanted to simulate a more continuous stream of activity.</p><p>So I upgraded it to support:</p><ul><li>Continuous execution.</li><li>A configurable interval between events.</li><li>An optional maximum event count.</li><li>Successful and failed submission tracking.</li><li>Traffic classification statistics.</li><li>Graceful shutdown with Ctrl+C.</li></ul><p>For example:</p><pre>python producer/network_generator.py --interval 1</pre><p>This generates approximately one event per second until stopped.</p><p>Or, for a limited test:</p><pre>python producer/network_generator.py --interval 1 --count 50</pre><p>I ran the continuous generator for approximately one minute.</p><p>And the results?</p><p><strong>68 events submitted. Zero failed sends.</strong></p><ul><li><strong>NORMAL:</strong> 21 events</li><li><strong>UNUSUAL:</strong> 15 events</li><li><strong>REJECTED:</strong> 32 events</li><li><strong>Total:</strong> 68 events</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*txUtdNtlU_N7Ye9yeVAwfg.png" /><figcaption><em>My upgraded Python generator submitting 68 network events to Kinesis with zero failed sends.</em></figcaption></figure><p>But I wasn’t ready to celebrate yet.</p><p>Because here’s something important I learned:</p><p><strong>Successfully sending records to Kinesis does not automatically mean they were processed and stored in DynamoDB.</strong></p><p>The producer only confirms successful submission to the stream.</p><p>I still needed to verify the rest of the pipeline.</p><h3>✅ Phase 8: Did All 68 Records Actually Make It?</h3><p>Before the continuous test, my DynamoDB table contained 14 records.</p><p>After submitting another 68, the expected total was:</p><p><strong>14 + 68 = 82</strong></p><p>I checked DynamoDB.</p><p>And there they were.</p><p><strong>82 records.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W5nt_wVKb98KUf__4RPQCw.png" /><figcaption><em>End-to-end verification in DynamoDB. The table contained the expected 82 records after the continuous traffic test.</em></figcaption></figure><p>I also checked CloudWatch logs to verify that Lambda had successfully processed the incoming events.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j7nJcvb9A-lrPELYVZHBFQ.png" /><figcaption><em>CloudWatch logs confirming successful Lambda processing and completed batches during the continuous traffic test.</em></figcaption></figure><p>That gave me much stronger evidence than simply seeing a successful message from my Python script.</p><p>I had verified the complete path from the producer to persistent storage.</p><p>And the resilience tests had already demonstrated that the system could handle malformed records separately from valid ones.</p><p>For a learning project, that felt like a meaningful milestone.</p><h3>🐾 Meanwhile, My Coworker Was Contributing Absolutely Nothing</h3><p>Somewhere during all of this, Koda decided that the laptop was his.</p><p>Not occasionally.</p><p>Not when I wasn’t using it.</p><p><strong>While I was actively trying to work.</strong></p><p>He would climb onto the keyboard, settle in, and look completely comfortable while I tried to figure out how to continue troubleshooting around him.</p><p>I could be examining CloudWatch logs.</p><p>He’d be sleeping.</p><p>I could be reviewing Terraform changes.</p><p>He’d be sleeping.</p><p>I could be trying to type an important command.</p><p>Suddenly, there was a kitten.</p><p>I spent a good portion of this project negotiating access to my own computer.</p><p>And I don’t think I won a single negotiation. 😂</p><p>I may have built a resilient AWS pipeline, but I have yet to develop a reliable solution for kitten-based deployment interference.</p><p>That might require a separate project.</p><h3>🧠 What This Project Taught Me</h3><p>I’ve been building hands-on AWS and DevOps projects as I work toward transitioning from enterprise IT support into cloud engineering.</p><p>One thing I’ve noticed is that the most valuable learning often happens after the initial deployment.</p><p>This project reinforced several lessons.</p><h3>1. A Successful Deployment Is Not the Same as a Working Application</h3><p>Terraform can successfully create every resource.</p><p>That doesn’t prove the entire application works.</p><p>You still need to test the actual data flow.</p><h3>2. Failure Handling Needs to Be Designed</h3><p>Malformed input and temporary processing failures are different problems.</p><p>One may require quarantine.</p><p>The other may require retries.</p><p>Treating every failure the same way isn’t necessarily the best approach.</p><h3>3. Idempotency Matters in Streaming Systems</h3><p>Retries can cause records to be processed again.</p><p>Conditional DynamoDB writes helped protect against overwriting events with duplicate IDs.</p><h3>4. Monitoring Should Be Tested</h3><p>Creating a CloudWatch alarm is one thing.</p><p>Intentionally triggering it and receiving the expected SNS notification is another.</p><h3>5. Terraform References Are Worth Understanding</h3><p>I continue to get more comfortable with resource references and how values flow between Terraform-managed resources.</p><p>Understanding those connections makes infrastructure code easier to reason about.</p><h3>6. Verify the Entire Pipeline</h3><p>A successful producer submission doesn’t guarantee successful downstream processing.</p><p>Checking DynamoDB and CloudWatch provided evidence that the complete system worked.</p><h3>7. Sometimes You Need to Break Something to Understand It</h3><p>This was probably my biggest takeaway.</p><p>The initial pipeline worked.</p><p>But the failure experiments exposed behaviors I wouldn’t have understood nearly as well if I’d stopped there.</p><h3>🧹 And Then I Destroyed Everything</h3><p>Because no AWS project is truly complete until I’ve checked that I’m not leaving resources running unnecessarily.</p><p>After documenting the architecture, collecting screenshots, testing the system, and publishing the code to GitHub, I ran:</p><pre>terraform destroy</pre><p>Terraform reported:</p><p><strong>15 resources destroyed.</strong></p><p>I also went back into the AWS console afterward to check for leftover resources.</p><p>Because apparently I’ve reached the point in my cloud journey where I trust absolutely nothing until I’ve verified it myself. 🤣</p><p>And honestly?</p><p>That’s probably not a terrible habit.</p><h3>🚀 What’s Next?</h3><p>I’m continuing to build hands-on experience while preparing for the AWS Certified Solutions Architect — Associate exam.</p><p>This project gave me practical experience with several important AWS concepts:</p><ul><li>Event-driven architecture.</li><li>Streaming data processing.</li><li>Serverless applications.</li><li>Infrastructure as Code.</li><li>Monitoring and alerting.</li><li>Retry behavior.</li><li>Failure isolation.</li><li>Idempotency.</li><li>End-to-end validation.</li></ul><p>There are plenty of things I could add later, including automated tests, CloudWatch dashboards, custom metrics, and CI/CD deployment automation.</p><p>But for now, I’m happy with what this project accomplished.</p><p>It started as a simple real-time data pipeline.</p><p>It became a much deeper lesson in building, troubleshooting, and improving AWS infrastructure.</p><p>And somehow, I managed to finish it despite my smallest coworker’s best efforts.</p><h3>💚 Final Thoughts</h3><p>Every project seems to teach me something different.</p><p>Sometimes it’s a new AWS service.</p><p>Sometimes it’s a Terraform configuration I haven’t worked with before.</p><p>Sometimes it’s learning why a perfectly reasonable assumption causes an application to fail.</p><p>And sometimes it’s discovering that an eight-week-old kitten has more authority over my laptop than I do.</p><p>This project reminded me why I enjoy hands-on cloud engineering so much.</p><p>I like understanding how things work.</p><p>I like figuring out why they don’t.</p><p>And apparently, I really like breaking things just so I can fix them again.</p><p><strong>Build it. Break it. Fix it. Learn from it.</strong> ☁️💚</p><p>Now, if you’ll excuse me, I need to see whether Koda is willing to let me use my laptop again.</p><p>I’m not optimistic. 🐾😂</p><h3>🔗 Explore the Project</h3><p><strong>GitHub Repository:</strong><br><a href="https://github.com/mandyreed223/aws-realtime-network-telemetry">https://github.com/mandyreed223/aws-realtime-network-telemetry</a></p><p><strong>Cloud Engineering Portfolio:</strong><br><a href="https://mandyreed.com/">https://mandyreed.com</a></p><p><em>Thanks for following along on another AWS adventure!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81ba484f1f1b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[☁️ I Turned a Simple AWS Assignment Into Four Days of CloudFormation Chaos. ]]></title>
            <link>https://medium.com/@mandymreed/%EF%B8%8F-i-turned-a-simple-aws-assignment-into-four-days-of-cloudformation-chaos-b3d389e7bff5?source=rss-8e7c70fd4f14------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3d389e7bff5</guid>
            <dc:creator><![CDATA[Mandy Reed]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 02:10:52 GMT</pubDate>
            <atom:updated>2026-11-09T02:10:52.661Z</atom:updated>
            <content:encoded><![CDATA[<p><em>From deploying WordPress to building a highly available AWS architecture, breaking EC2 instances, troubleshooting everything, and surviving on KitKats and Trolli.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WL-XNXzTlPPE67Q_ZkeLWw.png" /></figure><h3>🚀 It Was Supposed to Be a Simple Course Assignment</h3><p>You know those projects where you look at the requirements and think:</p><p><em>Okay, this shouldn’t be too bad.</em></p><p>Yeah.</p><p>This was not one of those projects. 😂</p><p>I’m currently working through my AWS Cloud Architect training while preparing for the AWS Solutions Architect Associate certification and continuing my transition into Cloud and DevOps Engineering.</p><p>One of my course-end projects involved deploying WordPress using AWS CloudFormation.</p><p>The original requirements were fairly straightforward:</p><ul><li>Deploy a working WordPress application using CloudFormation.</li><li>Create a development/testing environment with operating-hour controls.</li><li>Implement monitoring.</li></ul><p>Reasonable enough.</p><p>But somewhere along the way, I started asking questions.</p><p>What happens if an EC2 instance fails?</p><p>What happens to WordPress when Auto Scaling replaces that instance?</p><p>Will my uploaded images still exist?</p><p>What if the database connection fails?</p><p>Can I make the application accessible over HTTPS without giving the EC2 instances public IP addresses?</p><p>And, most importantly…</p><p><strong>Can I build all of this with CloudFormation and actually understand how the pieces connect?</strong></p><p>Because apparently, I cannot leave a perfectly reasonable course assignment alone. 🤣</p><p>So I expanded it.</p><p>And expanded it.</p><p>And then spent four days discovering why infrastructure that looks beautiful on an architecture diagram doesn’t always cooperate in real life.</p><h3>🏗️ The Architecture: Let’s Make WordPress Highly Available</h3><p>My goal was to build a WordPress environment that could recover from an unhealthy application instance without losing its database records or uploaded files.</p><p>I used AWS CloudFormation to define the infrastructure as code.</p><p>The environment was deployed in <strong>us-east-1</strong>, across two Availability Zones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5DRkFjIk6Nf6DZOgRhyonA.png" /><figcaption><em>The final architecture, with public load balancing, private WordPress instances, shared EFS storage, and a Multi-AZ RDS database.</em></figcaption></figure><h3>☁️ What I built</h3><p><strong>Networking</strong></p><ul><li>One VPC with a 10.0.0.0/16 CIDR block.</li><li>Two public subnets</li><li>Two private application subnets.</li><li>Two private database subnets.</li><li>An internet gateway.</li><li>Two NAT gateways, one per Availability Zone.</li><li>Route tables and security groups.</li></ul><p><strong>Application layer</strong></p><ul><li>An internet-facing Application Load Balancer.</li><li>An EC2 Auto Scaling Group spanning two Availability Zones.</li><li>A launch template for WordPress instances.</li><li>EC2 instances deployed without public IP addresses.</li></ul><p><strong>Persistent storage</strong></p><ul><li>Amazon EFS for shared WordPress application files and uploads.</li><li>Amazon RDS for MariaDB with Multi-AZ enabled.</li><li>AWS Secrets Manager for managed database credentials.</li></ul><p><strong>Operations</strong></p><ul><li>Amazon CloudWatch monitoring.</li><li>EventBridge Scheduler definitions for development operating hours.</li><li>AWS Systems Manager access.</li><li>Amazon Route 53 DNS.</li><li>AWS Certificate Manager for HTTPS.</li></ul><p>The request flow looked something like this:</p><p><strong>Visitor → Route 53 → HTTPS Application Load Balancer → Private EC2 WordPress Instances → EFS + RDS</strong></p><p>The ALB distributed requests to healthy WordPress instances.</p><p>EFS provided shared application files.</p><p>RDS provided persistent database storage.</p><p>And the Auto Scaling Group was responsible for replacing unhealthy application instances.</p><p>At least, that was the plan.</p><p><strong>Then came the part where AWS expected me to configure everything correctly.</strong> 😂</p><h3>🛠️ CloudFormation: Where the Real Learning Started</h3><p>I’ve worked with Terraform on several projects, so Infrastructure as Code wasn’t completely new territory.</p><p>But CloudFormation has its own way of connecting resources.</p><p>And this project gave me a much better understanding of how those connections work.</p><h3>🔹 Parameters: Making the template reusable</h3><p>Instead of hardcoding every value, I used CloudFormation parameters.</p><p>For example, the template accepts an environment selection:</p><pre>EnvironmentName:<br>  Type: String<br>  AllowedValues:<br>    - Development<br>    - Production</pre><p>This allows the same template to support different environment configurations.</p><p>I also used parameters for networking values, the ACM certificate ARN, and an Amazon Linux 2023 AMI resolved through an SSM public parameter.</p><h3>🔹 Mappings: Different environments, different configurations</h3><p>One feature I wanted to understand better was !FindInMap.</p><p>My template uses an environment mapping to select configuration values based on the environment.</p><p>For example:</p><pre>!FindInMap<br>  - EnvironmentConfig<br>  - !Ref EnvironmentName<br>  - InstanceType</pre><p>Here’s what happens:</p><ol><li>!Ref EnvironmentName retrieves the selected environment.</li><li>!FindInMap looks up that environment in EnvironmentConfig.</li><li>CloudFormation returns the corresponding instance type.</li></ol><p>That same mapping pattern controls other environment-specific settings, including the database instance class and Auto Scaling capacities.</p><p>It’s a small piece of YAML, but understanding <strong>where the value comes from and where it goes</strong> makes the template much easier to follow.</p><h3>🔹 Resource references: Connecting everything together</h3><p>Another important concept was !Ref.</p><p>For example:</p><pre>VPCZoneIdentifier:<br>  - !Ref PrivateAppSubnet1<br>  - !Ref PrivateAppSubnet2</pre><p>Instead of manually entering subnet IDs, CloudFormation retrieves the IDs of the subnets created by the template.</p><p>Those values are then passed into the Auto Scaling Group.</p><p>The same idea applies when connecting the Auto Scaling Group to its target group.</p><p>And !GetAtt lets the template retrieve attributes such as a resource ARN or launch template version.</p><p>For example:</p><pre>!GetAtt WordPressLaunchTemplate.LatestVersionNumber</pre><p>This retrieves the latest version number of the launch template.</p><p>I also used conditions so development-specific scheduling resources would only be created for the appropriate environment.</p><p><strong>My biggest CloudFormation takeaway:</strong></p><p>It’s not just about declaring resources.</p><p>It’s about understanding how values flow between resources, how dependencies are established, and how a single incorrect configuration can affect everything downstream.</p><p>And believe me, I got plenty of opportunities to learn that last part. 🤣</p><h3>🎉 First Victory: WordPress Actually Installed!</h3><p>After building out the template and working through deployment, I finally had a successful CloudFormation stack.</p><p><strong>CREATE_COMPLETE.</strong></p><p>Beautiful words.</p><p>But I wasn’t ready to celebrate just yet.</p><p>Because one thing I learned very quickly is:</p><p><strong>CloudFormation saying CREATE_COMPLETE does not mean your application is working.</strong></p><p>It means CloudFormation successfully created the resources it was responsible for creating.</p><p>Your EC2 UserData could still fail.</p><p>Your application could still be misconfigured.</p><p>Your database connection could still be broken.</p><p>And your load balancer could still have unhealthy targets.</p><p>So I kept testing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*gEGSsrSckgFSimEV19qFcw.png" /><figcaption><em>CloudFormation successfully created the infrastructure. Application health still required separate verification.</em></figcaption></figure><p>Eventually, I reached the WordPress installation screen, completed the setup, and accessed the administration dashboard.</p><p>I had a functioning WordPress application!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dmYmmIuAJsKGLhgQB3WpXQ.png" /><figcaption><em>WordPress installation completed successfully after the infrastructure and application configuration were working together.</em></figcaption></figure><p>But a working WordPress page wasn’t enough.</p><p>I also wanted to know whether the load balancer considered both application instances healthy.</p><p>After resolving the initialization and health-check issues, the Application Load Balancer reported <strong>two healthy targets</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*Mp2TE2fVd4BOas7Zta31aA.png" /><figcaption><em>Both WordPress application targets passed the ALB health checks.</em></figcaption></figure><p>Two healthy targets.</p><p>Two Availability Zones.</p><p>One very relieved cloud engineering student.</p><p>But we weren’t finished.</p><p>Not even close. 😂</p><h3>🔐 Private Networking: Because Security Matters</h3><p>One of my goals was to keep the WordPress EC2 instances out of the public internet.</p><p>The Application Load Balancer was internet-facing, but the EC2 instances lived in private application subnets.</p><p>They did not have public IP addresses.</p><p>The RDS database was also deployed privately.</p><p>This meant visitors could reach WordPress through the load balancer, but they couldn’t connect directly to the application instances over the public internet.</p><p>The ALB accepted HTTPS connections on port <strong>443</strong> using an ACM certificate.</p><p>It forwarded HTTP traffic on port <strong>80</strong> to the WordPress targets.</p><p>The application instances used NAT gateways for outbound internet access.</p><p>And they accessed EFS over NFS port <strong>2049</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-FLQTmyrK9_BuRn8XIcfAA.png" /><figcaption><em>WordPress EC2 instances deployed across two Availability Zones without public IP addresses.</em></figcaption></figure><p>I also configured a temporary Route 53 alias for:</p><p>wordpress.mandyreed.com</p><p>That allowed me to access the application through my own domain during testing.</p><p>The DNS record was removed during cleanup, so the WordPress site is no longer live.</p><p>One important lesson here was that private networking introduces additional operational requirements.</p><p>The instances still needed to download packages, connect to the database, mount EFS, and complete their initialization.</p><p>A working VPC diagram doesn’t automatically mean those connections work.</p><p><strong>Routing, security groups, DNS, permissions, and application configuration all have to agree.</strong></p><p>And sometimes they absolutely refuse. 😂</p><h3>💥 Troubleshooting Adventure #1: MariaDB Wanted TLS</h3><p>This was one of the more interesting problems.</p><p>My RDS MariaDB database was configured to require encrypted connections.</p><p>Which is a good security decision.</p><p>Unfortunately, my original WordPress database connection logic wasn’t fully prepared for that requirement.</p><p>The database was there.</p><p>The networking was configured.</p><p>But WordPress still needed to establish a connection that satisfied the database’s TLS requirement.</p><h3>🔧 The fix</h3><p>I updated the database readiness connection to use TLS and configured the WordPress MySQL client to request SSL.</p><p>One of the relevant PHP flags was:</p><pre>MYSQLI_CLIENT_SSL</pre><p>Once the connection configuration aligned with the database’s secure-transport requirement, WordPress could connect successfully.</p><p><strong>Lesson learned:</strong></p><p>Security controls are not just checkboxes.</p><p>They affect how applications communicate.</p><p>And when you enable a security requirement, the client configuration needs to support it.</p><p>One additional hardening improvement would be validating the RDS server certificate, not just requesting encrypted transport.</p><p>That’s going on my future improvements list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qoh4AnDISHE3jwEsJkpY6Q.png" /><figcaption><em>RDS MariaDB was configured with encrypted storage and Multi-AZ deployment. The application also needed to satisfy the database’s TLS connection requirement.</em></figcaption></figure><h3>💥 Troubleshooting Adventure #2: The Load Balancer Said 403</h3><p>Now for one of my favorite lessons from this project.</p><p>The Application Load Balancer needed a health-check endpoint.</p><p>I configured a local endpoint:</p><pre>/health.html</pre><p>This endpoint lived outside the shared EFS-mounted WordPress directory.</p><p>That was intentional.</p><p>I wanted a simple health check that could verify the web server was responding without depending on the entire WordPress application.</p><p>Seems reasonable, right?</p><p>Well…</p><p><strong>HTTP 403. Forbidden.</strong></p><p>Of course. 😂</p><p>After troubleshooting, I discovered that Apache couldn’t traverse the health directory because its permissions were too restrictive.</p><h3>🔧 The fix</h3><p>I added the following command to EC2 UserData after creating the health directory:</p><pre>chmod 755 /var/www/health</pre><p>That corrected the directory permissions.</p><p>But here’s the part that made this especially important.</p><p>I could have logged into the instance and fixed it manually.</p><p>And that might have made the current instance healthy.</p><p><strong>But what happens when Auto Scaling replaces that instance?</strong></p><p>The replacement would be created from the launch template and UserData.</p><p>If the fix wasn’t included there, the same problem could return.</p><p>So the solution needed to be part of the automated initialization process.</p><p>Not a one-time manual repair.</p><p><strong>That was a big lesson for me:</strong></p><p>In an Auto Scaling environment, the replacement instance needs to work without someone logging in and fixing it.</p><p>Because if recovery depends on manual intervention, the automation isn’t really finished.</p><h3>💾 EFS + RDS: Making Sure WordPress Could Survive Replacement</h3><p>Now we get to one of the main reasons I expanded this project.</p><p>I wanted to know what would happen to WordPress content if an EC2 instance disappeared.</p><p>A traditional single-instance WordPress deployment can store application files locally.</p><p>But if that instance is replaced and those files aren’t stored somewhere persistent, the replacement may not have the same content.</p><p>So I separated the application instances from their persistent data.</p><h3>📁 Amazon EFS</h3><p>I used Amazon EFS for shared WordPress application files and uploads.</p><p>The EFS file system had mount targets in both application Availability Zones.</p><p>This allowed the WordPress instances to access the same shared files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*JxNjotINnv8DZZrn8ACDag.png" /><figcaption><em>The EFS file system had available mount targets in both application Availability Zones.</em></figcaption></figure><h3>🗄️ Amazon RDS</h3><p>I used RDS MariaDB for the WordPress database.</p><p>The database was configured with Multi-AZ support.</p><p>That provides a managed standby for database failover.</p><p>It’s important to understand that Multi-AZ RDS doesn’t mean I had two independent writable WordPress databases.</p><p>The application used one database endpoint backed by a managed primary/standby deployment.</p><h3>🧪 The persistence test</h3><p>I created WordPress content and uploaded media.</p><p>Including a custom image we made for my AWS Cloud Lab.</p><p>Because apparently even my test data needs personality. 🤣💚</p><p>Then I tested recovery behavior.</p><p>After the application environment recovered, I verified that the WordPress test post and uploaded media were still accessible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XpCBGsAwlTpFIChh_5kUtw.png" /><figcaption><em>The uploaded WordPress media remained accessible after recovery testing, supporting the persistence test alongside the replacement activity evidence.</em></figcaption></figure><p>This was one of the most satisfying parts of the entire project.</p><p>The EC2 instances were replaceable.</p><p>The WordPress content remained accessible.</p><p>And I had a much better understanding of why separating compute from persistent storage matters.</p><h3>🔥 Time to Break Something: Testing Auto Scaling Recovery</h3><p>You knew this part was coming.</p><p>I built it.</p><p>I got it working.</p><p>So naturally…</p><p><strong>I wanted to break it.</strong> 🤣</p><p>The Auto Scaling Group was configured to maintain two WordPress instances across the private application subnets.</p><p>It used ELB health checks to help determine instance health.</p><p>I wanted to verify that the environment could recover from an unhealthy instance rather than simply trusting the configuration.</p><p>During testing, Auto Scaling reported unhealthy-instance replacement activity.</p><p>I captured the replacement process and monitored the environment as capacity recovered.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ex7Ws44660vEmomUn1j0uA.png" /><figcaption><em>Auto Scaling activity recorded unhealthy-instance replacement and capacity recovery behavior.</em></figcaption></figure><p>Then came the part I was waiting for.</p><p><strong>Two healthy ALB targets again.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*zni59Emaz4ZkXxEuEpaJMw.png" /><figcaption><em>After the recovery test, the Application Load Balancer reported two healthy WordPress targets.</em></figcaption></figure><p>Now, one screenshot doesn’t prove an entire failure-and-recovery timeline.</p><p>But the Auto Scaling activity, replacement evidence, and healthy target results together provided evidence that the application layer recovered.</p><p>And that was exactly what I wanted to test.</p><p><strong>High availability isn’t just something you configure.</strong></p><p>It’s something you need to validate.</p><p>Because two EC2 instances on an architecture diagram are nice.</p><p>Two healthy instances after a failure?</p><p>That’s much more interesting. ☁️</p><h3>⏰ EventBridge Scheduler: Giving Development an Off Switch</h3><p>Another requirement from the original assignment involved development operating hours.</p><p>The idea was to avoid keeping development application instances running when they weren’t needed.</p><p>I used EventBridge Scheduler definitions to adjust Auto Scaling Group capacity on weekdays.</p><p>The intended schedule was:</p><p><strong>Monday through Friday</strong></p><p>🟢 <strong>9:00 AM:</strong> Set minimum and desired capacity to 2.</p><p>🔴 <strong>6:00 PM:</strong> Set minimum and desired capacity to 0.</p><p>Time zone: America/New_York</p><p>This approach changes the number of EC2 instances managed by the Auto Scaling Group.</p><p>It does not stop the entire architecture.</p><p>The load balancer, NAT gateways, RDS database, and other resources can continue generating charges.</p><p>That distinction matters.</p><h3>🧪 Testing scale-down and restoration</h3><p>For safety, I left the EventBridge schedules <strong>disabled by default</strong> in the final CloudFormation template.</p><p>I separately tested the capacity changes manually.</p><p>When I scaled the Auto Scaling Group down to zero, the application became unavailable.</p><p>Which was expected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*d3sY-hPPdaevoY6IUCbAcA.png" /><figcaption><em>The development start and stop schedules were defined in EventBridge Scheduler but disabled by default.</em></figcaption></figure><p>During manual scale-down testing, WordPress became unavailable because the application instances were no longer running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nF1FHPQE6Q1qSjqXgUs8eg.png" /><figcaption><em>The load balancer returned HTTP 503 while the Auto Scaling Group had no available application targets.</em></figcaption></figure><p>When I restored the desired capacity to two, Auto Scaling could begin launching replacement instances.</p><p>The important distinction here is that I tested the capacity changes manually.</p><p>I did <strong>not</strong> verify that an actual scheduled EventBridge invocation triggered them.</p><p>That remains a separate test for a future iteration.</p><p>And yes, I learned that setting desired capacity to two and having two healthy application instances are not the same moment in time.</p><p>There’s still initialization and health checking to complete.</p><h3>📈 CloudWatch: Monitoring Doesn’t Automatically Mean Scaling</h3><p>The course also required monitoring.</p><p>I configured an Amazon CloudWatch CPU utilization alarm with an <strong>80% threshold</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*faWwlyDSm3IFYeU05-6FDQ.png" /><figcaption><em>CloudWatch CPU utilization monitoring was configured with an 80% threshold.</em></figcaption></figure><p>One distinction I wanted to understand was the difference between monitoring and scaling.</p><p>A CloudWatch alarm can monitor a metric and change state when a threshold is reached.</p><p>But that doesn’t automatically mean it will launch additional EC2 instances.</p><p>For that, you need the appropriate scaling policy and integration.</p><p>In this project, the CPU alarm was configured for monitoring.</p><p><strong>It was not used as an automatic scaling policy.</strong></p><p>This was another useful reminder that AWS services often work together, but configuring one doesn’t automatically configure the others.</p><h3>💸 The Part Nobody Wants to Talk About: AWS Costs</h3><p>Let’s talk about something important.</p><p>This architecture was designed for learning and testing high availability.</p><p>It was not designed to be the cheapest possible WordPress deployment.</p><p>Two NAT gateways.</p><p>An Application Load Balancer.</p><p>Multi-AZ RDS.</p><p>EFS.</p><p>EC2 instances.</p><p>All of those resources can contribute to the bill.</p><p>And some continue generating charges even when the application instances are scaled down.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*RLc-drD-C6_uhorg48WyxQ.png" /><figcaption><em>Estimated AWS charges captured during the lab. The screenshot was not a final bill.</em></figcaption></figure><p>For me, the cost was part of the learning experience.</p><p>But it also reinforced why resource cleanup matters.</p><p>Especially when experimenting with architectures that involve multiple managed services.</p><p>Which brings us to the final challenge.</p><h3>🧹 Cleanup: The Project Isn’t Finished Until the Resources Are Gone</h3><p>After completing the deployment and recovery tests, it was time to tear everything down.</p><p>And if you’ve followed my previous projects, you know I take cleanup seriously.</p><p>Because nothing ruins the satisfaction of a completed AWS project quite like discovering a forgotten resource on your bill. 😂</p><p>I deleted the CloudFormation stack:</p><pre>aws cloudformation delete-stack `<br>  --stack-name wordpress-ha-lab `<br>  --region us-east-1</pre><p>Then waited for deletion to complete:</p><pre>aws cloudformation wait stack-delete-complete `<br>  --stack-name wordpress-ha-lab `<br>  --region us-east-1</pre><p>I also checked selected AWS resources in the region, including NAT gateways, RDS database instances, EFS file systems, and load balancers.</p><p>And I removed the temporary Route 53 alias for the WordPress hostname.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*8vEwcBvLUEe9SqtYPdECXA.png" /><figcaption><em>CloudFormation confirmed completion of the stack deletion wait operation.</em></figcaption></figure><p>These checks supported cleanup of the lab’s stack and selected resources.</p><p>They weren’t intended to be a complete account-wide audit.</p><p>But they gave me confidence that the environment I had created was no longer sitting there generating unnecessary charges.</p><p>And honestly?</p><p><strong>Watching the infrastructure disappear successfully was almost as satisfying as watching it deploy.</strong> 🤣</p><h3>🧠 What Four Days of CloudFormation Taught Me</h3><p>This project reinforced several lessons that I think will stay with me as I continue working toward Cloud and DevOps Engineering.</p><h3>1. CREATE_COMPLETE is only the beginning.</h3><p>CloudFormation can successfully create infrastructure while the application running on it is completely broken.</p><p>Infrastructure deployment and application health are two different things.</p><h3>2. High availability needs to be tested.</h3><p>Configuring an Auto Scaling Group across two Availability Zones is important.</p><p>But testing replacement behavior and checking target health provides much stronger evidence that the design works.</p><h3>3. Persistent storage changes everything.</h3><p>Separating WordPress files and database records from the EC2 instances allowed the application content to remain accessible after recovery.</p><p>The application instances could be replaced without treating them as permanent storage.</p><h3>4. UserData is part of the architecture.</h3><p>If a replacement instance requires manual repairs, those repairs need to be incorporated into the automated initialization process.</p><p>The health-check directory permissions were a perfect example.</p><h3>5. Security and functionality have to work together.</h3><p>Private networking, TLS requirements, security groups, and IAM permissions all influence whether an application works.</p><p>Secure infrastructure still needs correctly configured applications.</p><h3>6. Understand what your automation actually does.</h3><p>EventBridge Scheduler changing ASG capacity isn’t the same as shutting down every AWS resource.</p><p>A CloudWatch alarm isn’t automatically a scaling policy.</p><p>And restoring desired capacity doesn’t instantly mean the application is healthy.</p><p>Those distinctions matter.</p><h3>7. Cleanup is part of the engineering process.</h3><p>A project isn’t really complete until you understand what resources were created, what they cost, and how to remove them safely.</p><h3>🔮 What Would I Improve Next?</h3><p>Because apparently I still haven’t learned how to leave a working project alone. 😂</p><p>If I revisit this architecture, I’d like to explore:</p><p>🔹 Automated application smoke tests after deployment and instance replacement.</p><p>🔹 Stronger TLS certificate validation for RDS connections.</p><p>🔹 CloudWatch alarm notifications.</p><p>🔹 Automated Route 53 DNS creation and cleanup.</p><p>🔹 Lower-cost networking options for temporary development environments.</p><p>🔹 A controlled RDS failover test with measured recovery time.</p><p>🔹 End-to-end validation of EventBridge Scheduler invocations.</p><p>There are plenty of directions I could take it.</p><p>But for now?</p><p>I’m calling this one complete.</p><h3>💚 From a Course Assignment to a Real Learning Experience</h3><p>When I started this project, the goal was to complete an AWS course assignment.</p><p>Four days later, I had built and tested a much more involved environment.</p><p>I used CloudFormation to provision infrastructure across two Availability Zones.</p><p>I configured private networking, HTTPS, load balancing, shared storage, and a managed Multi-AZ database.</p><p>I troubleshot database TLS requirements and Apache health-check permissions.</p><p>I tested EC2 replacement and Auto Scaling recovery.</p><p>I verified that WordPress content remained accessible.</p><p>I tested development capacity changes.</p><p>And I cleaned up the environment when I was finished.</p><p>But the biggest accomplishment wasn’t getting CloudFormation to display CREATE_COMPLETE.</p><p>It was understanding what happened <strong>after</strong> the resources were created.</p><p>What failed.</p><p>Why it failed.</p><p>How I fixed it.</p><p>And how I could make the fix survive the next instance replacement.</p><p>That’s the kind of hands-on experience I’m trying to build as I transition from enterprise IT support into Cloud and DevOps Engineering.</p><p>And if there’s one thing this project reminded me, it’s that the best learning often happens when things don’t work the first time.</p><p>Or the second.</p><p>Or the third. 🤣</p><p><strong>Build it. Break it. Troubleshoot it. Fix it. Automate it. Test it.</strong></p><p>And then document it before you forget what happened.</p><p>Preferably with KitKats and Trolli Very Berry Crawlers nearby. 🍫💚</p><p>Because after four days of CloudFormation…</p><p><strong>I’m not entirely sure whether I survived CloudFormation or CloudFormation survived me.</strong> 😂☁️🚀</p><h3>🔗 Explore the Project</h3><p>The complete CloudFormation template, architecture diagram, project documentation, and testing screenshots are available in my GitHub repository.</p><p><strong>GitHub:</strong> <a href="http://github.com/mandyreed223/aws-cloudformation-wordpress-automation">github.com/mandyreed223/aws-cloudformation-wordpress-automation</a></p><p>The lab has been torn down to avoid ongoing charges, but the infrastructure code and documentation remain available.</p><p><em>I’m continuing to build hands-on AWS and DevOps projects while preparing for the AWS Solutions Architect Associate certification.</em></p><p><em>Thanks for following along on another adventure in building things, breaking things, and figuring out how to make them work again.</em> ☁️💚</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3d389e7bff5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[☁️ My AWS Portfolio Worked Fine. So Naturally, I Rebuilt Half of It. ]]></title>
            <link>https://medium.com/@mandymreed/%EF%B8%8F-my-aws-portfolio-worked-fine-so-naturally-i-rebuilt-half-of-it-dfc985690ac8?source=rss-8e7c70fd4f14------2</link>
            <guid isPermaLink="false">https://medium.com/p/dfc985690ac8</guid>
            <dc:creator><![CDATA[Mandy Reed]]></dc:creator>
            <pubDate>Tue, 03 Nov 2026 04:46:02 GMT</pubDate>
            <atom:updated>2026-11-03T04:46:02.598Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Securing S3 with CloudFront OAC, automating deployments with GitHub Actions and OIDC, then adding a Terraform-managed serverless visitor counter because apparently a static website was too peaceful.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ut9dDM_bxS8u38Fa90EISA.png" /><figcaption>Image created using ChatGPT</figcaption></figure><p>A few months ago, I built my cloud engineering portfolio on AWS.</p><p>It started as a simple HTML/CSS website and somehow turned into an actual cloud project with:</p><p>☁️ Amazon S3<br>🌎 CloudFront<br>🔐 ACM<br>🗺️ Route 53<br>💻 GitHub<br>🌐 My own domain</p><p>I wrote about that adventure in my original portfolio article:</p><p><strong>“So I Decided I Needed a Portfolio Website. What Could Possibly Go Wrong?”</strong></p><p>At the time, I was thrilled.</p><p>My site worked.</p><p>HTTPS worked.</p><p>My custom domain worked.</p><p>CloudFront worked.</p><p>I could update my portfolio whenever I finished another project.</p><p>There was just one tiny problem.</p><p><strong>I had learned a lot more about AWS since I originally built it.</strong></p><p>And suddenly I couldn’t stop noticing things. 😂</p><p>My S3 bucket was still configured around the original static website architecture.</p><p>Deployments still involved manually pushing website updates.</p><p>CloudFront invalidations were manual.</p><p>And my portfolio was basically saying:</p><blockquote><em>“Look at all these automation projects I built!”</em></blockquote><p>…while waiting for me to manually deploy its updates.</p><p>Yeah.</p><p>We needed to talk.</p><h3>🧠 This Was Supposed to Be a Mini Lab</h3><p>Seriously.</p><p>The original idea was basically:</p><blockquote><em>Can I make my S3 bucket private?</em></blockquote><p>Then came:</p><blockquote><em>Could GitHub automatically deploy my portfolio when I push an update?</em></blockquote><p>Then:</p><blockquote><em>Could it invalidate CloudFront too?</em></blockquote><p>Then:</p><blockquote><em>We should probably use OIDC instead of storing AWS credentials…</em></blockquote><p>And somewhere along the way I apparently decided my static website also needed a serverless backend.</p><p>Because why fix one thing when you can accidentally redesign half the architecture? 😂</p><p>By the end, my little mini lab had turned into three connected upgrades:</p><pre>1. Secure the S3 origin behind CloudFront<br>2. Automate website deployments with GitHub Actions + OIDC<br>3. Build a Terraform-managed serverless visitor counter</pre><p>The portfolio still looked familiar from the outside.</p><p>Underneath?</p><p>Very different story.</p><h3>🔐 PART 1: Making S3 Private</h3><h3>☁️ The Original Architecture</h3><p>My original portfolio used Amazon S3 static website hosting behind CloudFront.</p><p>Conceptually:</p><pre>Visitor<br>   ↓<br>Route 53<br>   ↓<br>CloudFront<br>   ↓<br>S3 Static Website Endpoint</pre><p>It worked.</p><p>But an S3 website endpoint expects publicly accessible website content.</p><p>Since CloudFront was already sitting in front of the site, I wanted CloudFront to become the authorized path to my portfolio files.</p><p>At this point, my S3 configuration still reflected that original architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OAf05LWIqZv5aWE_JMlPKA.png" /><figcaption><em>Before the upgrade: the S3 configuration still supported the original public static website architecture.</em></figcaption></figure><p>The new goal:</p><pre>Visitor<br>   ↓<br>Route 53<br>   ↓<br>CloudFront<br>   ↓<br>Origin Access Control<br>   ↓<br>Private S3 Bucket</pre><p>No direct public access to the portfolio files.</p><h3>🔒 Enter CloudFront Origin Access Control</h3><p>I changed CloudFront from using the S3 website endpoint to using the S3 REST origin.</p><p>Then I created a CloudFront <strong>Origin Access Control</strong>, or OAC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*Bc26JcJ2HbCYCcQrdCTsAw.png" /><figcaption><em>Creating the CloudFront Origin Access Control that would allow CloudFront to securely access the private S3 origin.</em></figcaption></figure><p>OAC allows CloudFront to authenticate its requests to S3.</p><p>That meant my bucket policy could stop granting public access and instead allow the CloudFront service principal.</p><p>More importantly, I restricted that permission to <strong>my specific CloudFront distribution</strong>.</p><p>The new bucket policy effectively says:</p><pre>CloudFront Service<br>       ↓<br>Is the request coming from my distribution?<br>       ↓<br>      YES<br>       ↓<br>Allow s3:GetObject</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hj3TK016ikafZMS60aosxA.png" /><figcaption><em>The updated S3 bucket policy grants read access to CloudFront and restricts it to the portfolio distribution. AWS account information has been redacted for publication.</em></figcaption></figure><p>Then I turned on all four S3 <strong>Block Public Access</strong> settings.</p><pre>S3 Block Public Access<br>        ↓<br>       ON</pre><p>Now the relationship looks like this:</p><pre>Public Internet<br>     ❌<br>     ↓<br>Private S3 Bucket<br></pre><pre>CloudFront<br>     ✅<br>     ↓<br>Private S3 Bucket</pre><p>That distinction matters.</p><p>I wasn’t simply putting CloudFront in front of a public bucket anymore.</p><p>I was making CloudFront the authorized path into the bucket.</p><h3>🧪 How Do You Test a Security Change?</h3><p>There were two things I needed to prove.</p><p>First:</p><pre>https://mandyreed.com</pre><p>Still worked.</p><p>✅ It did.</p><p>Then I tried accessing the S3 object directly.</p><p>And AWS gave me:</p><pre>AccessDenied</pre><p>🎉</p><p>Which is probably the only time I’ve ever been genuinely excited to see an AWS access error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*tGwY6VLEfmJBAWX6ic8MHw.png" /><figcaption><em>Success! Direct access to S3 now returns AccessDenied while the portfolio remains available through CloudFront.</em></figcaption></figure><p>That proved exactly what I wanted:</p><pre>CloudFront → S3<br>      ✅</pre><pre>Internet → S3<br>      ❌</pre><p>Security upgrade complete.</p><p>Except…</p><p>I still had to manually deploy updates.</p><p>And now that was bothering me too.</p><h3>🚀 PART 2: Making git push Do the Work</h3><p>My portfolio update workflow looked something like this:</p><pre>Edit index.html / style.css<br>        ↓<br>git add<br>        ↓<br>git commit<br>        ↓<br>git push<br>        ↓<br>Open AWS<br>        ↓<br>Upload updated files to S3<br>        ↓<br>Create CloudFront invalidation</pre><p>The first half was automated.</p><p>The second half was me clicking things.</p><p>That seemed unnecessary.</p><p>What I wanted was:</p><pre>git push<br>   ↓<br>GitHub Actions<br>   ↓<br>AWS<br>   ↓<br>Update S3<br>   ↓<br>Invalidate CloudFront<br>   ↓<br>Done</pre><p>Much better.</p><p>But that created a more interesting question.</p><h3>How should GitHub authenticate to AWS?</h3><p>I could have created AWS access keys and stored them as GitHub secrets.</p><p>Technically, that would work.</p><p>But after spending more time working with IAM roles, I didn’t want to solve my automation problem by creating a long-lived credential problem.</p><p>So I used <strong>OpenID Connect, or OIDC</strong>.</p><h3>🔑 GitHub Actions + AWS OIDC</h3><p>Instead of:</p><pre>GitHub<br>   ↓<br>Stored AWS Access Keys<br>   ↓<br>AWS</pre><p>I built:</p><pre>GitHub Actions<br>      ↓<br>OIDC Token<br>      ↓<br>AWS validates identity<br>      ↓<br>IAM Role<br>      ↓<br>STS Temporary Credentials<br>      ↓<br>AWS Resources</pre><p>No long-lived AWS access keys are stored in GitHub.</p><p>GitHub proves the workflow’s identity to AWS, and AWS provides temporary credentials by allowing that workload to assume an IAM role.</p><p>The first piece was creating the GitHub OIDC identity provider in AWS IAM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wly2dYmZ5j-ZxlOZfaeqEA.png" /><figcaption><em>GitHub’s OIDC provider registered with AWS IAM, allowing AWS to validate identity tokens from GitHub Actions.</em></figcaption></figure><p>Then came one of the IAM concepts that has become much clearer to me through hands-on projects.</p><p>There are really <strong>two different security questions</strong> here.</p><h3>🪪 WHO can assume the role?</h3><p>That’s controlled by the <strong>trust policy</strong>.</p><p>I restricted the role to my portfolio repository and the main branch.</p><p>Conceptually:</p><pre>GitHub<br>   ↓<br>Is this mandyreed223/cloud-engineer-portfolio?<br>   ↓<br>Is this refs/heads/main?<br>   ↓<br>YES<br>   ↓<br>Assume Role</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QdrJoLMxz7BjIa_lztlnPg.png" /><figcaption><em>The IAM trust relationship restricts role assumption to the portfolio repository’s main branch.</em></figcaption></figure><h3>🔐 WHAT can the role do?</h3><p>That’s controlled by the <strong>permissions policy</strong>.</p><p>Once GitHub assumes the role, it only needs enough access to:</p><pre>Update portfolio files in S3<br>            +<br>Remove stale objects when required<br>            +<br>Create CloudFront invalidations</pre><p>So:</p><pre>WHO?<br> ↓<br>Trust Policy<br></pre><pre>WHAT?<br> ↓<br>Permissions Policy</pre><p>That separation finally stopped feeling like IAM vocabulary I needed to memorize and started feeling like an actual security model.</p><h3>⚙️ Building the Deployment Workflow</h3><p>Inside my repository, I created:</p><pre>.github/<br>└── workflows/<br>    └── deploy.yml</pre><p>The workflow runs whenever I push to main.</p><p>One of the most important pieces is:</p><pre>permissions:<br>  id-token: write<br>  contents: read</pre><p>contents: read lets the workflow check out the repository.</p><p>id-token: write allows GitHub Actions to request the OIDC token needed for AWS authentication.</p><p>Then:</p><pre>- name: Configure AWS credentials<br>  uses: aws-actions/configure-aws-credentials@v5<br>  with:<br>    role-to-assume: arn:aws:iam::&lt;ACCOUNT-ID&gt;:role/GitHubActions-Portfolio-Deploy<br>    aws-region: us-east-1</pre><p>This is where GitHub assumes the AWS IAM role and receives temporary credentials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*Y3C7Yx0gyww20zw7qBqMxw.png" /><figcaption><em>The GitHub Actions workflow requests an OIDC token and assumes the AWS deployment role without storing long-lived AWS credentials.</em></figcaption></figure><p>Once authenticated, the workflow deploys my site:</p><pre>- name: Deploy website to S3<br>  run: |<br>    aws s3 cp index.html s3://mandy-cloud-portfolio-site/index.html<br>    aws s3 cp style.css s3://mandy-cloud-portfolio-site/style.css<br>    aws s3 sync images/ s3://mandy-cloud-portfolio-site/images/ --delete</pre><p>Then CloudFront gets invalidated:</p><pre>- name: Invalidate CloudFront cache<br>  run: |<br>    aws cloudfront create-invalidation \<br>      --distribution-id &lt;DISTRIBUTION-ID&gt; \<br>      --paths &quot;/*&quot;</pre><p>So my new deployment process became:</p><pre>Edit<br> ↓<br>Commit<br> ↓<br>Push<br> ↓<br>Go do literally anything else</pre><p>😂</p><p>GitHub Actions handles the AWS deployment.</p><h3>👀 PART 3: Apparently the Website Needed a Backend</h3><p>At this point I could have stopped.</p><p>Really.</p><p>The S3 bucket was private.</p><p>CloudFront still served the site.</p><p>Deployments were automated.</p><p>GitHub could authenticate without stored AWS access keys.</p><p>This was already a successful mini lab.</p><p>So naturally:</p><blockquote><em>“What if we add a visitor counter?”</em></blockquote><p>😂</p><p>But if I was going to add one, I didn’t want a hard-coded number or some random third-party widget.</p><p>I wanted to build it on AWS.</p><p>The plan:</p><pre>Browser<br>   ↓<br>API Gateway<br>   ↓<br>Lambda<br>   ↓<br>DynamoDB<br>   ↓<br>Persistent Count</pre><p>And because apparently I had completely forgotten the phrase “mini lab,” I decided to provision the backend with <strong>Terraform</strong>.</p><h3>🏗️ Building the Serverless Backend with Terraform</h3><p>One important distinction:</p><p><strong>Terraform does not currently manage my entire portfolio infrastructure.</strong></p><p>My existing S3 bucket, CloudFront distribution, Route 53 configuration, and ACM certificate were created before this Terraform configuration.</p><p>For this upgrade, Terraform manages the <strong>serverless visitor-counter backend</strong>.</p><p>That includes:</p><pre>Amazon DynamoDB<br>AWS Lambda<br>Lambda IAM Role<br>IAM Permissions<br>Amazon API Gateway HTTP API<br>API Integration<br>GET /count Route<br>API Stage<br>Lambda Invocation Permission</pre><p>This let me add Infrastructure as Code without pretending the existing portfolio infrastructure had magically always been Terraform-managed.</p><h3>🗃️ Giving the Counter Somewhere to Live</h3><p>First, I created an on-demand DynamoDB table:</p><pre>resource &quot;aws_dynamodb_table&quot; &quot;visitor_counter&quot; {<br>  name         = &quot;portfolio-visitor-counter&quot;<br>  billing_mode = &quot;PAY_PER_REQUEST&quot;<br>  hash_key     = &quot;id&quot;</pre><pre>  attribute {<br>    name = &quot;id&quot;<br>    type = &quot;S&quot;<br>  }<br>}</pre><p>DynamoDB stores the persistent count.</p><p>That’s important because Lambda itself isn’t where I want to store state.</p><p>Lambda does the work.</p><p>DynamoDB remembers the result.</p><h3>⚡ Building the Lambda Function</h3><p>The Lambda function increments the count using DynamoDB’s atomic ADD operation:</p><pre>response = table.update_item(<br>    Key={&quot;id&quot;: &quot;portfolio&quot;},<br>    UpdateExpression=&quot;ADD #count :increment&quot;,<br>    ExpressionAttributeNames={<br>        &quot;#count&quot;: &quot;count&quot;<br>    },<br>    ExpressionAttributeValues={<br>        &quot;:increment&quot;: 1<br>    },<br>    ReturnValues=&quot;UPDATED_NEW&quot;<br>)</pre><p>Instead of:</p><pre>Read count<br>   ↓<br>Add 1<br>   ↓<br>Write new count</pre><p>DynamoDB handles:</p><pre>Atomically increment count<br>          ↓<br>Return updated value</pre><p>That helps avoid a race condition where multiple requests could read the same old value and overwrite one another.</p><p>Tiny visitor counter.</p><p>Actual concurrency lesson.</p><p>I’ll take it. 😂</p><h3>🔐 Lambda Needed an Identity Too</h3><p>This project ended up reinforcing IAM from two completely different directions.</p><p>GitHub Actions needed an IAM role.</p><p>Lambda needed an IAM role.</p><p>But those roles trust different identities.</p><p>For Lambda:</p><pre>Principal = {<br>  Service = &quot;lambda.amazonaws.com&quot;<br>}</pre><p>The flow is:</p><pre>AWS Lambda Service<br>       ↓<br>AssumeRole<br>       ↓<br>Lambda Execution Role</pre><p>Then I gave the role only the DynamoDB behavior my Python code actually uses:</p><pre>Action = [<br>  &quot;dynamodb:UpdateItem&quot;<br>]</pre><pre>Resource = aws_dynamodb_table.visitor_counter.arn</pre><p>And this is where Terraform resource references really started clicking for me.</p><p>I didn’t need to copy the table ARN out of AWS and paste it into the policy.</p><p>Terraform already knew it.</p><pre>aws_dynamodb_table.visitor_counter.arn</pre><p>means:</p><pre>DynamoDB Resource<br>       ↓<br>Read its ARN attribute<br>       ↓<br>Pass that ARN into the IAM policy</pre><p>That is the difference between resources simply existing next to one another and resources actually being <strong>linked together</strong>.</p><h3>🔗 Following the Values Through Terraform</h3><p>The same pattern showed up everywhere.</p><p>Lambda needs the DynamoDB table name:</p><pre>environment {<br>  variables = {<br>    TABLE_NAME = aws_dynamodb_table.visitor_counter.name<br>  }<br>}</pre><p>Follow the value:</p><pre>aws_dynamodb_table.visitor_counter<br>              ↓<br>            .name<br>              ↓<br>portfolio-visitor-counter<br>              ↓<br>Lambda environment variable TABLE_NAME<br>              ↓<br>Python<br>              ↓<br>os.environ[&quot;TABLE_NAME&quot;]</pre><p>That’s a real Terraform resource attribute flowing through the infrastructure and into the application code.</p><p>Another example:</p><pre>integration_uri = aws_lambda_function.visitor_counter.invoke_arn</pre><p>Flow:</p><pre>Lambda Resource<br>      ↓<br>.invoke_arn<br>      ↓<br>API Gateway Integration</pre><p>And later:</p><pre>source_arn = &quot;${aws_apigatewayv2_api.visitor_counter_api.execution_arn}/*/*&quot;</pre><p>Flow:</p><pre>API Gateway<br>     ↓<br>.execution_arn<br>     ↓<br>Lambda Permission<br>     ↓<br>API Gateway may invoke Lambda</pre><p>This is one of those concepts that makes much more sense to me when I can physically trace where the value comes from and where it’s going.</p><h3>🌐 Adding API Gateway</h3><p>Next I created an API Gateway HTTP API.</p><p>The frontend needed one simple route:</p><pre>GET /count</pre><p>That route connects to the Lambda integration.</p><pre>GET /count<br>     ↓<br>API Gateway Route<br>     ↓<br>API Integration<br>     ↓<br>Lambda</pre><p>When I applied this part of the Terraform configuration, Terraform created the API pieces and Lambda invocation permission that connect the two services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*RxU7XG_CD3ui0vU0YVgX8A.png" /><figcaption><em>Terraform creating the Lambda and IAM portions of the visitor-counter backend.</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*PTye4PSsR6zGhvu6IMk5IQ.png" /><figcaption><em>Terraform adding API Gateway, the route, integration, stage, and Lambda invocation permission.</em></figcaption></figure><p>Now the backend architecture existed.</p><p>But existing and working are two very different things.</p><p>Time to test it.</p><h3>🧪 Test One Layer at a Time</h3><p>Rather than connecting everything to the website and then trying to figure out which service was broken, I tested each layer independently.</p><p>First, Lambda:</p><pre>aws lambda invoke `<br>  --function-name portfolio-visitor-counter `<br>  --payload &#39;{}&#39; `<br>  response.json</pre><pre>Get-Content response.json</pre><p>The count increased.</p><p>Then I invoked it again.</p><p>It increased again.</p><p>That proved:</p><pre>Lambda<br>   ↓<br>DynamoDB</pre><p>was working.</p><p>Next I tested the full API path:</p><pre>Invoke-RestMethod `<br>  -Uri &quot;https://&lt;API-ID&gt;.execute-api.us-east-1.amazonaws.com/count&quot; `<br>  -Method GET</pre><p>And got:</p><pre>count<br>-----<br>3</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*ZyI_6s4LGAQNhyutGdWTrg.png" /><figcaption><em>Calling the API Gateway endpoint returns count 3, proving the API Gateway → Lambda → DynamoDB path is working.</em></figcaption></figure><p>That test proved:</p><pre>HTTP Request<br>     ↓<br>API Gateway<br>     ↓<br>Lambda<br>     ↓<br>DynamoDB<br>     ↓<br>Response</pre><p>Before the frontend was involved at all.</p><p>That made troubleshooting much easier.</p><h3>🌍 CORS Entered the Chat</h3><p>My portfolio runs at:</p><pre>https://mandyreed.com</pre><p>while API Gateway uses an AWS domain.</p><p>From the browser’s perspective, that’s a cross-origin request.</p><p>So I configured CORS to allow:</p><pre>https://mandyreed.com<br>https://www.mandyreed.com</pre><p>But there was an important security distinction here too.</p><p><strong>CORS is not authentication.</strong></p><p>CORS controls which origins browsers allow to make cross-origin requests.</p><p>It doesn’t make the API private.</p><p>Someone can still call a public API directly outside the browser.</p><p>For this project, that’s okay.</p><p>It’s a simple public <strong>page-view counter</strong>.</p><p>It is not authentication.</p><p>It is not secure analytics.</p><p>And it is definitely not a unique-visitor tracker.</p><p>Technically someone could script requests and make my portfolio look extremely popular.</p><p>Please don’t tell the internet. 😂</p><h3>💻 Connecting the Frontend</h3><p>Once the backend worked independently, I added the frontend call.</p><p>The JavaScript performs a request to:</p><pre>GET /count</pre><p>Then displays the returned value inside my AWS Portfolio project card.</p><p>The final production path became:</p><pre>mandyreed.com<br>      ↓<br>JavaScript fetch()<br>      ↓<br>API Gateway<br>      ↓<br>Lambda<br>      ↓<br>DynamoDB UpdateItem<br>      ↓<br>Persistent Count<br>      ↓<br>API Response<br>      ↓<br>Browser</pre><p>I opened the live portfolio.</p><p>It showed:</p><pre>👀 Portfolio Views: 4</pre><p>Then I refreshed.</p><pre>👀 Portfolio Views: 5</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*Kp6y00hhsEXpKtbU4YV34w.png" /><figcaption><em>The final result on the live portfolio: the serverless backend successfully increments and returns the page-view count.</em></figcaption></figure><p>I’m not going to pretend watching <strong>4 turn into 5</strong> wasn’t ridiculously satisfying considering how much AWS infrastructure was sitting behind that tiny number. 😂</p><h3>🚀 Then the New Pipeline Got Its First Real Assignment</h3><p>Here’s where everything came together.</p><p>I had just changed:</p><pre>index.html<br>style.css<br>README.md<br>Terraform configuration<br>Lambda code</pre><p>Previously, getting the website changes into production would have meant manually updating S3 and invalidating CloudFront.</p><p>Not anymore.</p><p>I committed the project:</p><pre>git add README.md index.html style.css terraform/</pre><p>Then:</p><pre>git commit -m &quot;Add serverless visitor counter with Terraform&quot;</pre><p>And finally:</p><pre>git push</pre><p>That’s it.</p><p>The pipeline I’d just built took over.</p><pre>Push to main<br>      ↓<br>GitHub Actions<br>      ↓<br>OIDC authentication<br>      ↓<br>AWS validates workload identity<br>      ↓<br>Temporary AWS credentials<br>      ↓<br>Website files deployed to S3<br>      ↓<br>CloudFront invalidated<br>      ↓<br>Updated portfolio live</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WqliXzX-T0uvet-9XUhD9Q.png" /><figcaption><em>The new deployment pipeline gets its first real assignment. Every deployment step completes successfully after the visitor-counter update is pushed to main.</em></figcaption></figure><p>That might be my favorite part of this whole project.</p><p>I didn’t just build automation to prove I could.</p><p><strong>I immediately used the automation to deploy the next feature.</strong></p><h3>🧩 What the Portfolio Architecture Looks Like Now</h3><p>What started as a static website now has three distinct paths.</p><h3>🌎 Secure Content Delivery</h3><pre>Visitor<br>   ↓<br>Route 53<br>   ↓<br>CloudFront + HTTPS<br>   ↓<br>Origin Access Control<br>   ↓<br>Private Amazon S3</pre><h3>🚀 Automated Deployment</h3><pre>VS Code<br>   ↓<br>GitHub<br>   ↓<br>GitHub Actions<br>   ↓<br>OIDC<br>   ↓<br>AWS IAM Role<br>   ↓<br>STS Temporary Credentials<br>   ↓<br>Amazon S3<br>   ↓<br>CloudFront Invalidation</pre><h3>👀 Serverless Visitor Counter</h3><pre>Browser JavaScript<br>       ↓<br>GET /count<br>       ↓<br>Amazon API Gateway<br>       ↓<br>AWS Lambda<br>       ↓<br>Amazon DynamoDB<br>       ↓<br>Persistent Count<br>       ↓<br>Browser</pre><p>One website.</p><p>Three very different flows.</p><p>And suddenly my portfolio isn’t just displaying cloud projects.</p><p><strong>It has become one of them.</strong></p><h3>🧹 Keeping Terraform’s Local Files Out of GitHub</h3><p>Before committing the Terraform configuration, there was one more thing to handle.</p><p>Terraform creates local files that absolutely do not belong in my public repository.</p><p>So I added:</p><pre>terraform/.gitignore</pre><p>to exclude:</p><pre>.terraform/<br>*.tfstate<br>*.tfstate.*<br>*.tfplan<br>lambda/*.zip<br>response.json</pre><p>But I intentionally committed:</p><pre>.terraform.lock.hcl</pre><p>The provider lock file helps keep provider selections consistent.</p><p>Terraform state is different.</p><p>State contains infrastructure metadata and shouldn’t casually live in a public Git repository.</p><p>Right now, my state is local.</p><p>A future improvement will probably be moving it to a remote backend.</p><p>Because apparently I need to leave myself something else to mess with later. 😈</p><h3>🤔 Why Didn’t I Automate Terraform Too?</h3><p>Once GitHub Actions was deploying the website, there was an obvious next thought:</p><blockquote><em>Why not make the workflow run </em><em>terraform apply too?</em></blockquote><p>Because automation isn’t automatically better just because I can build it.</p><p>My GitHub deployment role currently has a deliberately narrow purpose:</p><pre>Deploy website files<br>        +<br>Invalidate CloudFront</pre><p>If I gave the same CI/CD identity permission to apply this Terraform configuration, its AWS permissions would need to expand considerably.</p><p>It could potentially need to manage:</p><pre>Lambda<br>API Gateway<br>DynamoDB<br>IAM</pre><p>That’s a very different permission boundary.</p><p>Could I automate Terraform later?</p><p>Absolutely.</p><p>But I’d want to design that intentionally rather than casually handing my website deployment role broad infrastructure-management permissions.</p><p>For now:</p><pre>GitHub Actions<br>      ↓<br>Frontend deployment<br></pre><pre>Terraform<br>      ↓<br>Backend infrastructure provisioning</pre><p>Separate responsibilities.</p><p>Separate permissions.</p><p>And honestly, deciding <strong>what not to automate yet</strong> was a useful engineering lesson too.</p><h3>💡 What This “Mini Lab” Actually Taught Me</h3><p>This started with:</p><blockquote><em>“Should I secure my S3 bucket?”</em></blockquote><p>It ended up reinforcing a lot more.</p><h3>🔐 CloudFront OAC</h3><p>CloudFront can securely access a private S3 origin without making the bucket publicly readable.</p><h3>🪪 Workload Identity</h3><p>GitHub Actions doesn’t need permanent AWS access keys.</p><p>OIDC + IAM + STS can provide temporary AWS credentials to a trusted workload.</p><h3>🧠 IAM Trust vs Permissions</h3><p>These answer two different questions:</p><pre>WHO can assume the role?</pre><pre>WHAT can the role do?</pre><p>I had seen those concepts before.</p><p>Building both a GitHub deployment role and a Lambda execution role made the distinction much clearer.</p><h3>🏗️ Terraform Resource References</h3><p>Instead of manually copying AWS-generated values:</p><pre>aws_dynamodb_table.visitor_counter.arn</pre><pre>aws_dynamodb_table.visitor_counter.name</pre><pre>aws_lambda_function.visitor_counter.invoke_arn</pre><pre>aws_apigatewayv2_api.visitor_counter_api.execution_arn</pre><p>Terraform lets resources pass values directly into other resources.</p><p>Following those values from <strong>source → attribute → destination</strong> has made Terraform resource linkage much easier for me to understand.</p><h3>⚡ Serverless State</h3><p>Lambda performs the work.</p><p>DynamoDB stores the persistent state.</p><h3>🌐 CORS Isn’t Authentication</h3><p>CORS controls browser cross-origin behavior.</p><p>It does not make a public API private.</p><h3>🚀 Automation Needs Boundaries</h3><p>Automating the website deployment made sense.</p><p>Giving the same deployment identity broad infrastructure permissions simply because I could did not.</p><h3>🔮 What’s Next?</h3><p>There are still plenty of ways I could keep evolving this.</p><pre>☁️ Remote Terraform state</pre><pre>🛡️ API throttling / abuse protection</pre><pre>📊 CloudWatch monitoring and observability</pre><pre>🧪 Post-deployment health validation</pre><pre>↩️ Automated rollback behavior</pre><pre>🏗️ Terraform CI/CD with its own carefully designed IAM boundary</pre><pre>👀 Better analytics beyond a simple page-view counter</pre><p>But those can wait.</p><p>Because, once again…</p><p><strong>this was supposed to be a mini lab.</strong></p><p>😂</p><h3>☁️ Final Thoughts</h3><p>The funny thing about this project is that none of these upgrades were required to make my website work.</p><p><strong>It already worked.</strong></p><p>That’s exactly what made the project useful.</p><p>When I originally built the portfolio, my question was:</p><blockquote><em>“How do I get a website online using AWS?”</em></blockquote><p>This time the questions were different.</p><blockquote><em>“How do I make the origin private?”</em></blockquote><blockquote><em>“How do I remove manual deployment steps?”</em></blockquote><blockquote><em>“How can GitHub authenticate to AWS without stored access keys?”</em></blockquote><blockquote><em>“How do I give workloads only the permissions they actually need?”</em></blockquote><blockquote><em>“How do I connect a static frontend to a serverless backend?”</em></blockquote><blockquote><em>“How does Terraform know which AWS-generated value needs to go where?”</em></blockquote><p>Those are much more interesting questions.</p><p>And somewhere between making S3 private and watching:</p><pre>👀 Portfolio Views: 4</pre><p>turn into:</p><pre>👀 Portfolio Views: 5</pre><p>I realized something.</p><p>The original portfolio project taught me how to <strong>build something on AWS</strong>.</p><p>This upgrade taught me how to look at something that already works and ask:</p><blockquote><strong><em>How can I make this more secure, more automated, and better engineered?</em></strong></blockquote><p>That’s a different kind of learning.</p><p>And apparently it’s also how a perfectly peaceful static website ends up with CloudFront OAC, GitHub Actions, OIDC, IAM, STS, Terraform, API Gateway, Lambda, DynamoDB, and its own CI/CD pipeline.</p><p>Oops. 😂☁️</p><h3>🔗 Project Links</h3><p><strong>Live Portfolio:</strong><br><a href="https://mandyreed.com/">https://mandyreed.com</a></p><p><strong>GitHub Repository:</strong><br><a href="https://github.com/mandyreed223/cloud-engineer-portfolio">https://github.com/mandyreed223/cloud-engineer-portfolio</a></p><p><strong>Part 1:</strong><br><a href="https://medium.com/@mandymreed/so-i-decided-i-needed-a-portfolio-website-what-could-possibly-go-wrong-5a726e889864"><em>So I Decided I Needed a Portfolio Website. What Could Possibly Go Wrong?</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dfc985690ac8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ I Built a CI/CD Pipeline. Then I Broke the Pipeline.]]></title>
            <link>https://medium.com/@mandymreed/i-built-a-ci-cd-pipeline-then-i-broke-the-pipeline-2397aae6bc7b?source=rss-8e7c70fd4f14------2</link>
            <guid isPermaLink="false">https://medium.com/p/2397aae6bc7b</guid>
            <dc:creator><![CDATA[Mandy Reed]]></dc:creator>
            <pubDate>Mon, 02 Nov 2026 01:38:51 GMT</pubDate>
            <atom:updated>2026-11-02T01:38:51.159Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>From Git commit to AWS Fargate: building an automated deployment pipeline, killing a task, blocking a broken release, fixing it, and proving the whole thing worked.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vdZC3Ep4TlkX9NK96kLzXw.png" /><figcaption>Image created by ChatGPT</figcaption></figure><p>There is apparently a point in learning cloud engineering where successfully deploying an application stops being enough.</p><p>You deploy it.</p><p>You look at it.</p><p>You confirm that it works.</p><p>And then you think:</p><p><strong>Okay… but what happens if I break it?</strong></p><p>That has become one of my favorite parts of these projects.</p><p>This time, though, I wasn’t just building infrastructure.</p><p>I wanted to build the process that gets an application <strong>from source code to a running AWS deployment automatically</strong>.</p><p>The goal was:</p><pre>GitHub<br>   ↓<br>Jenkins<br>   ↓<br>Docker<br>   ↓<br>Amazon ECR<br>   ↓<br>Amazon ECS<br>   ↓<br>AWS Fargate</pre><p>A Git commit would trigger Jenkins.</p><p>Jenkins would build the Docker image.</p><p>The application would have to pass a test.</p><p>Only then would the image be pushed to Amazon ECR.</p><p>Then Jenkins would create a new ECS task definition revision, update the service, and wait for the deployment to stabilize.</p><p>And once all of that worked?</p><p>Naturally, I planned to break it. 💀</p><h3>🚀 The Build: More Than Just “Deploy an App”</h3><p>I had already deployed applications manually in previous projects.</p><p>This project was different.</p><p>I wanted to understand the automation connecting all of the pieces.</p><p>The application itself was intentionally simple: a static Nginx page packaged into a Docker image.</p><p>The complexity wasn’t supposed to be in the application.</p><p>The interesting part was everything surrounding it.</p><pre>Developer<br>   ↓<br>Git push<br>   ↓<br>GitHub repository<br>   ↓<br>Jenkins detects change<br>   ↓<br>Docker image build<br>   ↓<br>Application quality gate<br>   ↓<br>Amazon ECR<br>   ↓<br>New ECS task definition revision<br>   ↓<br>ECS service update<br>   ↓<br>AWS Fargate</pre><p>That meant Jenkins needed more than the ability to execute a few shell commands.</p><p>It needed to talk to Docker.</p><p>It needed to authenticate to AWS.</p><p>It needed to push images to ECR.</p><p>It needed to query and modify ECS task definitions.</p><p>And it needed to deploy the correct image produced by the current build.</p><p>This became less of a “Jenkins project” and more of an exercise in understanding how a complete CI/CD chain fits together.</p><h3>🧰 Building a Jenkins Agent That Could Actually Do the Job</h3><p>My Jenkins controller was already running locally in Docker.</p><p>Rather than installing every build dependency directly into the controller, I created a dedicated Jenkins build agent.</p><p>The agent needed:</p><pre>Docker CLI<br>Git<br>curl<br>AWS CLI<br>Jenkins inbound agent</pre><p>The custom agent image was based on:</p><pre>FROM jenkins/inbound-agent:latest-jdk21</pre><p>Then I installed the required tools and configured access to the host Docker socket.</p><p>Once the agent was connected to Jenkins, I verified what environment the pipeline would actually have available.</p><pre>User: jenkins<br>Docker: available<br>AWS CLI: available<br>Git: available<br>Agent label: docker</pre><p>This was an important distinction for me.</p><p>Jenkins itself wasn’t magically building containers.</p><p><strong>The pipeline was running on an agent that had the tools and permissions necessary to perform the work.</strong></p><p>That sounds obvious once you understand it.</p><p>It was much less obvious before building it.</p><h3>🐳 First Stop: Build the Container</h3><p>The application used a small Nginx image.</p><p>My final Dockerfile eventually became:</p><pre>FROM nginx:alpine</pre><pre>COPY index.html /usr/share/nginx/html/index.html<br>COPY assets/ /usr/share/nginx/html/assets/</pre><pre>EXPOSE 80</pre><p>Simple application.</p><p>Very useful pipeline target.</p><p>The Jenkins build stage tagged each image using the Jenkins build number.</p><p>Conceptually:</p><pre>cloudops-app:BUILD_NUMBER</pre><p>That build number later became incredibly useful because I could trace a running ECS task all the way back to the Jenkins build that created its image.</p><p>That connection ended up being one of my favorite parts of the project.</p><h3>🧪 But Building an Image Doesn’t Mean It Works</h3><p>I didn’t want Jenkins to push every successfully built image to AWS.</p><p>A Docker build succeeding only proves that Docker managed to build the image.</p><p>It doesn’t prove the application inside it is healthy.</p><p>So I added a quality gate.</p><p>Jenkins started the newly built image as a temporary test container and checked the application for a known healthy response:</p><pre>wget -qO- http://localhost | grep &quot;Deployment Healthy&quot;</pre><p>If Jenkins found:</p><pre>Deployment Healthy</pre><p>the pipeline continued.</p><p>If it didn’t?</p><pre>Build<br>  ↓<br>Test<br>  ↓<br>PASS?<br>  ├── No → STOP<br>  │<br>  └── Yes<br>       ↓<br>      Push to ECR<br>       ↓<br>      Deploy to ECS</pre><p>That tiny test became one of the most important parts of the entire project later.</p><p>At this point, though, I just needed it to pass.</p><p>And it did. 💚</p><h3>☁️ Next Stop: Amazon ECR</h3><p>Once the application passed its test, Jenkins authenticated to AWS and pushed the image to Amazon Elastic Container Registry.</p><p>The image produced by a build followed this pattern:</p><pre>cloudops-app:BUILD_NUMBER</pre><p>It was then tagged for ECR:</p><pre>AWS_ACCOUNT_ID.dkr.ecr.us-east-1.amazonaws.com/cloudops-app:BUILD_NUMBER</pre><p>For example, the final deployment eventually produced:</p><pre>Jenkins Build #15<br>        ↓<br>Docker image :15<br>        ↓<br>Amazon ECR image :15</pre><p>This is where the pipeline started feeling less like several separate technologies and more like one connected system.</p><p>The build number wasn’t just a Jenkins number anymore.</p><p>It became part of the artifact moving through the deployment process.</p><h3>🔗 The Part That Finally Made ECS Deployment Click</h3><p>Getting an image into ECR still doesn’t deploy it.</p><p>ECS needs a task definition telling it which image to run.</p><p>And ECS task definitions are revisioned.</p><p>That meant Jenkins needed to:</p><pre>Read current task definition<br>        ↓<br>Replace container image<br>        ↓<br>Remove AWS read-only metadata<br>        ↓<br>Register new task definition revision<br>        ↓<br>Update ECS service<br>        ↓<br>Wait for service stability</pre><p>The pipeline first retrieved the current task definition:</p><pre>aws ecs describe-task-definition \<br>  --task-definition ${ECS_TASK_FAMILY} \<br>  --query taskDefinition \<br>  &gt; current-task-definition.json</pre><p>Then Python updated the container image to the image created by the current Jenkins build.</p><p>Conceptually:</p><pre>Jenkins Build #15<br>        ↓<br>cloudops-app:15<br>        ↓<br>ECR cloudops-app:15<br>        ↓<br>ECS task definition revision 4<br>        ↓<br>ECS service<br>        ↓<br>Fargate task</pre><p>This was a major “ohhh, THAT’S how those pieces connect” moment.</p><p>Jenkins wasn’t somehow telling Fargate:</p><blockquote><em>Run Build #15.</em></blockquote><p>It was creating an image.</p><p>ECR stored that image.</p><p>The ECS task definition referenced that image.</p><p>The ECS service referenced the new task definition revision.</p><p>Then ECS launched the Fargate task described by that revision.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*I0htS3xx8zFX2EU2OPKegA.png" /><figcaption><em>Task definition revision 4 pointing to the image produced by Jenkins Build #15.</em></figcaption></figure><p>That linkage is exactly the kind of thing that becomes much clearer when you actually build it.</p><h3>🤖 Making Deployment Automatic</h3><p>Once the pipeline could update ECS, the deployment stage became fully automated.</p><p>Jenkins would:</p><pre>1. Determine the current AWS account<br>2. Build the ECR image URI<br>3. Retrieve the current ECS task definition<br>4. Replace the container image<br>5. Create a clean task definition JSON document<br>6. Register a new revision<br>7. Update the ECS service<br>8. Wait for the service to stabilize</pre><p>The service update looked conceptually like:</p><pre>aws ecs update-service \<br>  --cluster cloudops-cluster \<br>  --service cloudops-service \<br>  --task-definition NEW_TASK_DEFINITION</pre><p>Then Jenkins waited:</p><pre>aws ecs wait services-stable \<br>  --cluster cloudops-cluster \<br>  --services cloudops-service</pre><p>That last step mattered.</p><p>I didn’t want Jenkins declaring victory just because AWS accepted an API request.</p><p>I wanted the pipeline to wait until ECS actually reached a stable state.</p><h3>🔄 Git Push → Deployment</h3><p>Then came the fun part.</p><p>I configured Jenkins to detect source changes from GitHub.</p><p>Now my workflow became:</p><pre>Edit code<br>   ↓<br>git add<br>   ↓<br>git commit<br>   ↓<br>git push<br>   ↓<br>Jenkins detects SCM change<br>   ↓<br>Pipeline starts automatically</pre><p>No manually clicking <strong>Build Now</strong>.</p><p>No manually building a Docker image.</p><p>No manually pushing to ECR.</p><p>No manually registering a task definition.</p><p>No manually updating the ECS service.</p><p>The commit became the trigger.</p><p>That was the moment this really felt like CI/CD instead of a collection of individual commands.</p><h3>💀 Phase One: Kill Something</h3><p>At this point I had a healthy application running on Fargate.</p><p>So obviously I killed it.</p><p>For science.</p><p>I intentionally stopped the running ECS task:</p><pre>aws ecs stop-task \<br>  --cluster cloudops-cluster \<br>  --task &lt;TASK_ARN&gt; \<br>  --reason &quot;Chaos test - intentional task failure&quot; \<br>  --region us-east-1</pre><p>Immediately after the task stopped, the service showed:</p><pre>Desired: 1<br>Pending: 0<br>Running: 0</pre><p>Then:</p><pre>Desired: 1<br>Pending: 1<br>Running: 0</pre><p>And finally:</p><pre>Desired: 1<br>Pending: 0<br>Running: 1</pre><p>ECS replaced the task.</p><p>I didn’t restart it.</p><p>I didn’t redeploy the application.</p><p>I didn’t tell ECS to create another one.</p><p>The service simply noticed:</p><pre>Desired state: 1 task<br>Actual state: 0 tasks</pre><p>and reconciled the difference.</p><p>That immediately reminded me of Kubernetes.</p><p>Different platform, same important idea:</p><p><strong>Desired state wins.</strong></p><p>Break a managed workload and the orchestrator tries to bring reality back in line with the declared state.</p><p>That was chaos test number one.</p><p>Infrastructure failure.</p><p>And AWS recovered from it.</p><h3>😈 Phase Two: Break the Application Instead</h3><p>Killing infrastructure was fun.</p><p>But then I wanted to test something completely different.</p><p>What happens if the infrastructure is perfectly healthy…</p><p>but <strong>I give the pipeline bad application code?</strong></p><p>My health check expected:</p><pre>Deployment Healthy 💚</pre><p>So I changed the application to:</p><pre>Deployment BROKEN 💀</pre><p>Then I committed it.</p><pre>Test pipeline quality gate with intentional failure</pre><p>And pushed.</p><p>Jenkins detected the change.</p><p>Build #13 started.</p><p>Checkout passed.</p><p>AWS authentication passed.</p><p>Docker build passed.</p><p>Then Jenkins launched the test container.</p><p>The web server responded successfully.</p><p>But this command:</p><pre>wget -qO- http://localhost | grep &quot;Deployment Healthy&quot;</pre><p>couldn’t find the expected text.</p><p>Exit code:</p><pre>1</pre><p>And the pipeline stopped.</p><h3>🛑 This Was the Moment the Pipeline Became Useful</h3><p>The Docker image had built successfully.</p><p>The application server was technically responding.</p><p>But the application did not meet the condition I defined as healthy.</p><p>So Jenkins refused to continue.</p><pre>Checkout        ✅<br>AWS Identity    ✅<br>Build           ✅<br>Test            ❌</pre><pre>ECR Push        SKIPPED<br>ECS Deploy      SKIPPED</pre><p>The broken release never reached ECR.</p><p>More importantly:</p><p><strong>The broken release never reached production.</strong></p><p>The existing Fargate deployment stayed healthy.</p><p>That distinction mattered.</p><p>My first chaos test proved:</p><blockquote><em>If the running infrastructure fails, ECS can recover it.</em></blockquote><p>My second chaos test proved:</p><blockquote><em>If the application fails before deployment, the CI/CD pipeline can stop it from reaching the running infrastructure.</em></blockquote><p>Those are two completely different failure domains.</p><p>And seeing both happen made the purpose of the pipeline much clearer.</p><p>A CI/CD pipeline isn’t valuable because it can deploy software quickly.</p><p>It’s valuable because it can decide when software <strong>should not be deployed at all.</strong></p><h3>🔧 Fix It and Let Automation Take Over Again</h3><p>Now that I had successfully broken my pipeline…</p><p>I wanted my green checkmarks back. 😂</p><p>I restored:</p><pre>Deployment Healthy 💚</pre><p>Then committed the fix:</p><pre>Fix deployment health check</pre><p>Jenkins detected the change.</p><p>The pipeline ran again.</p><p>This time:</p><pre>Checkout        ✅<br>AWS Identity    ✅<br>Build           ✅<br>Test            ✅<br>ECR Push        ✅<br>ECS Deploy      ✅</pre><p>The recovered build produced image:</p><pre>cloudops-app:14</pre><p>Jenkins pushed it to ECR.</p><p>A new ECS task definition revision was registered.</p><p>The service updated.</p><p>Fargate stabilized.</p><p>And the application was healthy again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ihJKUxahO8hyXXiJSvifpg.png" /><figcaption><em>Healthy deployment after fixing the intentional application failure.</em></figcaption></figure><p>The best part?</p><p>I didn’t have to manually clean up the failed release in AWS.</p><p>There wasn’t one.</p><p>The quality gate had prevented it from getting there in the first place.</p><h3>🌼 One Last Deployment</h3><p>At this point the project worked.</p><p>But it was late October, Día de los Muertos was approaching, and apparently my deployment needed a wardrobe change. 💀🌼</p><p>So I created a final version of the application with a Día de los Muertos theme.</p><p>That meant adding static assets to the Docker image.</p><p>My Dockerfile became:</p><pre>FROM nginx:alpine</pre><pre>COPY index.html /usr/share/nginx/html/index.html<br>COPY assets/ /usr/share/nginx/html/assets/</pre><pre>EXPOSE 80</pre><p>Simple.</p><p>Except…</p><p>Docker disagreed.</p><h3>🤦 The assests Incident</h3><p>My build failed with:</p><pre>&quot;/assets&quot;: not found</pre><p>Which was strange because I had absolutely created the assets folder.</p><p>Or at least I thought I had.</p><p>I checked the repository.</p><p>And there it was.</p><pre>assests/</pre><p>Not:</p><pre>assets/</pre><p>Ah.</p><p>Yes.</p><p>My sophisticated CI/CD architecture had been defeated by spelling. 😂</p><p>The Dockerfile was correctly asking for:</p><pre>COPY assets/ /usr/share/nginx/html/assets/</pre><p>The directory I had actually created was:</p><pre>assests/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7dNk1tgzAVUchp4lY8tccg.png" /><figcaption><em>Docker correctly informing me that the directory I insisted existed did not, in fact, exist.</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*QCsdLWoQrsnRjpZx6_cVGg.png" /><figcaption><em>Root cause: </em><em>assests versus </em><em>assets. Sometimes troubleshooting is very glamorous.</em></figcaption></figure><p>I renamed the folder:</p><pre>mv assests assets</pre><p>Then rebuilt.</p><pre>docker build -t cloudops-app:15 .</pre><p>Success.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*P8teOt_SaxnIxEjJJhauhw.png" /><figcaption><em>Final Docker build succeeding after fixing the directory name.</em></figcaption></figure><p>Another good reminder:</p><p>When an error says something doesn’t exist…</p><p>sometimes it really doesn’t.</p><p>Check the simple things first.</p><h3>👻 And Then Windows Tried to Join the Project</h3><p>During final documentation cleanup, I ran into another tiny but useful problem.</p><p>Some files had Windows CRLF line endings and trailing whitespace.</p><p>So before committing, I checked:</p><pre>git diff --check</pre><p>And normalized the affected files when necessary:</p><pre>sed -i &#39;s/\r$//&#39; Dockerfile index.html Jenkinsfile</pre><p>Later, I did the same cleanup for the README.</p><p>I also found some Windows metadata hitchhikers:</p><pre>:Zone.Identifier</pre><p>Those were removed and ignored going forward.</p><p>My .gitignore gained:</p><pre>*:Zone.Identifier<br>*.TMP<br>*~RF*</pre><p>This had nothing to do with AWS.</p><p>Nothing to do with Jenkins.</p><p>Nothing to do with Docker.</p><p>And yet it was still part of shipping a clean project.</p><p>That is one thing I keep learning from hands-on work:</p><p><strong>The interesting problems are rarely limited to the technology named in the project title.</strong></p><h3>🎉 Build #15: The Final Deployment</h3><p>With the Día de los Muertos version ready, I pushed the final change.</p><p>Jenkins detected the SCM update and started Build #15 automatically.</p><p>The pipeline ran through the entire sequence:</p><pre>Checkout<br>   ↓<br>AWS Identity<br>   ↓<br>Docker Build<br>   ↓<br>Quality Gate<br>   ↓<br>ECR Push<br>   ↓<br>ECS Task Definition Revision<br>   ↓<br>ECS Service Update<br>   ↓<br>Wait for Stability<br>   ↓<br>SUCCESS 💚</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E19eJ9zhMbe6kKLegKbhgQ.png" /><figcaption><em>Build #15 automatically triggered by the final Git change.</em></figcaption></figure><p>Then Jenkins deployed the new ECS task definition and waited for the service to stabilize.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pv346_G03XVaNt6-eeWCAg.png" /><figcaption><em>Jenkins successfully completing the automated ECS deployment.</em></figcaption></figure><p>The final linkage was:</p><pre>Jenkins Build #15<br>        ↓<br>Docker image cloudops-app:15<br>        ↓<br>Amazon ECR cloudops-app:15<br>        ↓<br>ECS task definition cloudops-app:4<br>        ↓<br>ECS service cloudops-service<br>        ↓<br>AWS Fargate</pre><p>And the final application was live.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*71QcO9oMcx7JbaPrG-nfIw.png" /><figcaption><em>The final Día de los Muertos deployment running successfully on AWS Fargate.</em></figcaption></figure><p>The page included one final message:</p><pre>Final Deployment:<br>Pipeline survived.<br>Infrastructure did not. 💀</pre><p>Which was about to become extremely accurate.</p><h3>🧹 A Successful Project Isn’t Finished Until the Bill Stops</h3><p>Once the testing was complete, it was time to clean up.</p><p>I scaled the ECS service down:</p><pre>Desired: 0<br>Pending: 0<br>Running: 0</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*VRoBClZ7uLFk9Dsu_qjo_g.png" /><figcaption>Scaling the ECS service to zero, the first step in tearing down the deployment.</figcaption></figure><p>Then I removed the project resources:</p><pre>ECS service<br>ECS cluster<br>ECS task definition revisions<br>ECR repository<br>Project security group<br>IAM execution role</pre><p>I was careful not to delete the default VPC or default subnets that the lab had used.</p><p>Then I performed a final AWS sweep.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*WXN820A4vqoE7LxYLEyyqA.png" /><figcaption><em>Final validation showing the project-created AWS resources were gone.</em></figcaption></figure><p>But I had one more test to perform.</p><h3>💀 And Then I Made Good on the Threat</h3><p>Earlier, the application had been happily running at its Fargate public IP.</p><p>After teardown, I refreshed that same address.</p><p>And got:</p><pre>Hmmm... can&#39;t reach this page</pre><pre>ERR_CONNECTION_TIMED_OUT</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*g-2T1L0OkXfjhSzj8ufYOw.png" /><figcaption>Refreshing the former Fargate endpoint after teardown confirmed the deployment was truly gone.</figcaption></figure><p>Perfect. 💚</p><p>The application wasn’t secretly still running.</p><p>The Fargate task was gone.</p><p>The infrastructure was gone.</p><p>The endpoint was dead.</p><p>I had built the pipeline.</p><p>I had broken the pipeline.</p><p>I had recovered the pipeline.</p><p>And then I destroyed the infrastructure underneath it.</p><p>Very on brand.</p><h3>🧽 Local Cleanup Counted Too</h3><p>AWS wasn’t the only environment that needed cleaning.</p><p>Over the course of the project, Docker had accumulated multiple local images:</p><pre>cloudops-app:...</pre><p>I removed them:</p><pre>docker images --format &#39;{{.Repository}}:{{.Tag}}&#39; \<br>  | grep &#39;cloudops-app&#39; \<br>  | xargs -r docker rmi</pre><p>Almost all of them disappeared.</p><p>Almost.</p><p>One image refused to die because an old stopped container was still referencing it.</p><p>So instead of reaching immediately for:</p><pre>docker system prune -a</pre><p>and nuking everything in sight, I traced the dependency.</p><p>I found the stopped container.</p><p>Removed it.</p><p>Then removed the image.</p><p>Final result:</p><pre>No cloudops-app images remain 💚<br>No cloudops containers remain 💚</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1009/1*hpLJJ2Psk0ZZ-hjgCkWTAg.png" /><figcaption>Final local validation confirming the CloudOps application images and containers were completely removed.</figcaption></figure><p>I intentionally preserved:</p><pre>jenkins/jenkins:lts<br>jenkins-cicd-agent:v2</pre><p>because those are reusable parts of my Jenkins environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*pz-BR1TGeouviABC6UN6Fw.png" /><figcaption>The obsolete Jenkins agent removed while preserving the reusable Jenkins controller and v2 build agent.</figcaption></figure><p>Clean up the project.</p><p>Keep the platform.</p><h3>🔐 One More Security Step</h3><p>For this lab, Jenkins used an AWS credential stored in Jenkins so the pipeline could authenticate to AWS.</p><p>Once the project was complete and the AWS infrastructure was gone, I removed that Jenkins credential.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EWzcuzCRP7r_996e5CFaEw.png" /><figcaption>Final Jenkins credential cleanup after the AWS deployment infrastructure was removed.</figcaption></figure><p>For a production environment, I would want to improve this architecture further with things like:</p><pre>Temporary AWS credentials / IAM roles<br>Private ECS tasks<br>Application Load Balancer<br>HTTPS<br>Restricted security groups<br>Centralized logging<br>Image scanning<br>Secrets Manager or Parameter Store<br>Deployment strategies such as rolling or blue/green releases</pre><p>This was a learning lab, not a production reference architecture.</p><p>Understanding that distinction is part of the project too.</p><h3>🧠 What This Project Actually Taught Me</h3><p>The biggest lesson wasn’t how to write a Jenkinsfile.</p><p>It was understanding the <strong>relationships</strong> between the technologies.</p><p>Before this project, it would have been easy to describe the stack as:</p><pre>GitHub<br>Jenkins<br>Docker<br>ECR<br>ECS<br>Fargate</pre><p>After building it, I think about it differently:</p><pre>GitHub stores the source<br>        ↓<br>Jenkins reacts to the source change<br>        ↓<br>Docker packages the application<br>        ↓<br>The quality gate decides whether that artifact is allowed to continue<br>        ↓<br>ECR stores the approved image<br>        ↓<br>The ECS task definition points to that specific image<br>        ↓<br>The ECS service maintains the desired deployment<br>        ↓<br>Fargate runs the task</pre><p>And the two failure tests reinforced two different responsibilities:</p><pre>RUNNING TASK FAILS<br>        ↓<br>ECS notices actual state != desired state<br>        ↓<br>ECS replaces the task</pre><p>versus:</p><pre>APPLICATION TEST FAILS<br>        ↓<br>Jenkins stops the pipeline<br>        ↓<br>Image is not pushed<br>        ↓<br>ECS is never updated<br>        ↓<br>Healthy deployment stays healthy</pre><p>That difference might be my favorite takeaway from the entire project.</p><h3>🔗 Following the Artifact All the Way Through</h3><p>Another concept that became much clearer was artifact traceability.</p><p>The final deployment wasn’t just “version 4.”</p><p>I could trace it:</p><pre>Git commit<br>   ↓<br>Jenkins Build #15<br>   ↓<br>Docker image :15<br>   ↓<br>ECR image :15<br>   ↓<br>ECS task definition revision :4<br>   ↓<br>Running Fargate task</pre><p>That makes troubleshooting much more concrete.</p><p>If I need to know what is running, I can follow the references backward.</p><p>If I need to know what Jenkins produced, I can follow them forward.</p><p>The build number becomes part of the deployment story.</p><h3>🌱 What I’d Improve Next</h3><p>If I rebuilt this as a more production-oriented platform, one improvement stands out immediately:</p><p><strong>Infrastructure as Code.</strong></p><p>The application deployment was automated.</p><p>The infrastructure bootstrap was not.</p><p>The pipeline expected resources such as the ECR repository, ECS cluster, ECS service, IAM role, task definition, and security group to already exist.</p><p>A natural next evolution would be:</p><pre>Terraform<br>   ↓<br>Create AWS infrastructure<br>   ↓<br>Bootstrap ECS service<br>   ↓</pre><pre>GitHub<br>   ↓<br>Jenkins<br>   ↓<br>Build + Test<br>   ↓<br>ECR<br>   ↓<br>Deploy new task revisions</pre><p>Then:</p><pre>terraform destroy</pre><p>could tear the environment down.</p><p>And:</p><pre>terraform apply</pre><p>could resurrect it.</p><p>That would turn this from an automated <strong>application deployment pipeline</strong> into something much closer to a reproducible <strong>CI/CD platform</strong>.</p><p>And yes…</p><p>The idea that I could destroy the entire environment and then resurrect it with Terraform is already extremely tempting. 💀😂</p><h3>💚 Final Takeaway</h3><p>This project started with a simple goal:</p><p><strong>Automatically deploy a Docker application to AWS.</strong></p><p>It ended up teaching me much more.</p><p>I built a custom Jenkins agent.</p><p>I connected GitHub changes to automated builds.</p><p>I built and tested Docker images.</p><p>I created a quality gate.</p><p>I authenticated Jenkins to AWS.</p><p>I pushed versioned images to ECR.</p><p>I learned how Jenkins could modify ECS task definitions.</p><p>I automated Fargate deployments.</p><p>I killed a running task and watched ECS replace it.</p><p>I intentionally broke the application and watched Jenkins protect the healthy deployment.</p><p>I fixed it.</p><p>I deployed again.</p><p>I chased down a folder named assests.</p><p>I cleaned up Windows metadata.</p><p>I removed every project-created AWS resource.</p><p>And finally, I refreshed the old application endpoint just to make sure I had actually killed it.</p><p>I had.</p><p>💀</p><p>The workflow that stuck with me was the same one I keep coming back to:</p><pre>BUILD<br>   ↓<br>UNDERSTAND<br>   ↓<br>BREAK<br>   ↓<br>TROUBLESHOOT<br>   ↓<br>FIX<br>   ↓<br>VALIDATE<br>   ↓<br>CLEAN UP</pre><p>Because getting a green deployment is useful.</p><p>Understanding <strong>why it is green, what happens when it turns red, and how the system responds</strong> is where the real learning happens.</p><p>And apparently my preferred way to learn cloud engineering continues to be:</p><p><strong>Build something healthy and then immediately ask what happens if I kill it.</strong> 💚💀</p><h3>🔗 Project Links</h3><p><strong>GitHub:</strong><br><a href="https://github.com/mandyreed223/jenkins-cicd-aws-pipeline">https://github.com/mandyreed223/jenkins-cicd-aws-pipeline</a></p><p><strong>Portfolio:</strong><br><a href="https://mandyreed.com/">https://mandyreed.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2397aae6bc7b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ I Built a Highly Available AWS Architecture. Then I Started Killing EC2 Instances. ]]></title>
            <link>https://medium.com/@mandymreed/i-built-a-highly-available-aws-architecture-then-i-started-killing-ec2-instances-6f6996657256?source=rss-8e7c70fd4f14------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f6996657256</guid>
            <dc:creator><![CDATA[Mandy Reed]]></dc:creator>
            <pubDate>Sun, 25 Oct 2026 23:20:25 GMT</pubDate>
            <atom:updated>2026-10-26T12:43:09.815Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Building a production-inspired 2-tier AWS architecture with Terraform, Auto Scaling, private EC2, Multi-AZ RDS, SSM, and CloudWatch, then breaking it on purpose to see what survived.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zBFlgF_R7TdailME7jFSqA.png" /><figcaption>Image created using ChatGPT</figcaption></figure><h3>🎃 One Last Big Build Before Halloween</h3><p>I sat down to build a highly available AWS architecture.</p><p>Before AWS could fail, Windows volunteered as tribute. 💀</p><p>Halfway through the project, my computer crashed with a lovely CRITICAL_PROCESS_DIED blue screen.</p><p>Thankfully, VS Code recovered my work, Terraform survived, and after Windows finished being dramatic, I got back to the actual goal:</p><p>Build an AWS environment designed to handle failure.</p><p>And then cause some failure.</p><p>On purpose. 😈</p><p>This project started as a 2-tier Terraform build, but I wanted to take it further than simply proving that Terraform could create the resources.</p><p>I wanted to understand how the pieces connected.</p><p>I wanted the application servers private.</p><p>I wanted high availability across two Availability Zones.</p><p>I wanted database persistence.</p><p>I wanted secure management without SSH.</p><p>And most importantly, I wanted to see what happened when something actually died.</p><p>By the end, the architecture included:</p><pre>Terraform<br>   ↓<br>VPC<br>   ├── Public Subnet A<br>   ├── Public Subnet B<br>   ├── Private App Subnet A<br>   ├── Private App Subnet B<br>   ├── Private DB Subnet A<br>   └── Private DB Subnet B</pre><pre>Internet<br>   ↓<br>Internet Gateway<br>   ↓<br>Application Load Balancer<br>   ↓<br>Auto Scaling Group<br>   ↓<br>Private EC2 Instances<br>   ↓<br>RDS MySQL Multi-AZ</pre><p>Alongside:</p><pre>NAT Gateways<br>AWS Systems Manager Session Manager<br>IAM Roles<br>Security Groups<br>CloudWatch Metrics<br>CloudWatch Alarm<br>Automated EC2 Bootstrapping</pre><p>And because apparently building things isn’t enough for me anymore…</p><p>I started killing them. 😂</p><h3>🏗️ The Architecture</h3><p>The environment spans two Availability Zones in us-east-1.</p><p>I created six subnets:</p><pre>VPC: 10.0.0.0/16</pre><pre>us-east-1a<br>├── Public A:      10.0.1.0/24<br>├── Private App A: 10.0.3.0/24<br>└── Private DB A:  10.0.5.0/24</pre><pre>us-east-1b<br>├── Public B:      10.0.2.0/24<br>├── Private App B: 10.0.4.0/24<br>└── Private DB B:  10.0.6.0/24</pre><p>The public subnets contain the internet-facing components.</p><p>The application EC2 instances live in private subnets with no public IP addresses.</p><p>The database lives even deeper in dedicated private database subnets.</p><p>The resulting request path looks like this:</p><pre>User<br> ↓<br>Internet<br> ↓<br>Internet Gateway<br> ↓<br>Application Load Balancer<br> ↓<br>Private EC2<br> ↓<br>RDS MySQL</pre><p>And private EC2 outbound traffic follows a completely different path:</p><pre>Private EC2<br> ↓<br>NAT Gateway<br> ↓<br>Internet Gateway<br> ↓<br>Internet</pre><p>That distinction became one of my favorite lessons from this build.</p><p>The NAT Gateway is <strong>not</strong> part of the incoming application request path.</p><p>It exists so resources in private subnets can initiate outbound connections while remaining unreachable directly from the internet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0dicgf_lhnahV3ig3fOOVg.png" /><figcaption><em>Highly available AWS architecture spanning two Availability Zones.</em></figcaption></figure><h3>🌐 Building the Network with Terraform</h3><p>Instead of manually creating the infrastructure in AWS, the environment was defined with Terraform.</p><p>The VPC became the foundation:</p><pre>resource &quot;aws_vpc&quot; &quot;main&quot; {<br>  cidr_block           = var.vpc_cidr<br>  enable_dns_support   = true<br>  enable_dns_hostnames = true<br>}</pre><p>From there, other resources reference values Terraform receives from AWS.</p><p>For example:</p><pre>vpc_id = aws_vpc.main.id</pre><p>This is one of the Terraform concepts I’ve been intentionally working on understanding better.</p><p>aws_vpc.main.id isn&#39;t a value I manually type.</p><p>Terraform creates the VPC, AWS assigns its ID, and Terraform passes that value to the resources that depend on it.</p><p>The same pattern appears throughout the architecture:</p><pre>aws_vpc.main.id<br>        ↓<br>Subnets / Security Groups / Route Tables</pre><pre>aws_eip.nat_a.allocation_id<br>        ↓<br>NAT Gateway A</pre><pre>aws_lb.web.arn<br>        ↓<br>ALB Listener</pre><pre>data.aws_ami.amazon_linux.id<br>        ↓<br>EC2 Launch Template</pre><p>Before deployment, many of those values appear in terraform plan as:</p><pre>(known after apply)</pre><p>Terraform already understands the dependency.</p><p>It just doesn’t know the AWS-generated value yet.</p><p>That little phrase makes a lot more sense to me now than it did when I first started learning Terraform.</p><h3>🌎 Public Where It Needs to Be, Private Where It Doesn’t</h3><p>The Application Load Balancer spans both public subnets.</p><p>The EC2 instances do not.</p><p>They live inside the private application subnets and are managed by the same Auto Scaling Group.</p><p>That gives the architecture a flow like:</p><pre>Internet<br>   ↓<br>Public ALB<br>   ↓<br>Private EC2 instances</pre><p>The user never connects directly to EC2.</p><p>The load balancer receives the request and forwards it only to healthy registered targets.</p><p>When I loaded the application repeatedly, I could see traffic reaching instances in both Availability Zones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OeuOjqo5BHfEAsu8qTrIyg.png" /><figcaption><em>Application request served from an EC2 instance in Availability Zone A.</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wISKmtgZpnYp1485BR89uA.png" /><figcaption><em>Application request served from an EC2 instance in Availability Zone B.</em></figcaption></figure><p>That was the first moment the architecture stopped feeling like a collection of AWS resources and started feeling like a system.</p><h3>🔐 No Port 22 Required</h3><p>Another goal was avoiding public SSH access entirely.</p><p>The EC2 instances have:</p><pre>No public IP address<br>No inbound SSH rule<br>No port 22 exposed</pre><p>Instead, I used AWS Systems Manager Session Manager.</p><p>Terraform creates the IAM pieces EC2 needs:</p><pre>IAM Role<br>   ↓<br>AmazonSSMManagedInstanceCore<br>   ↓<br>Instance Profile<br>   ↓<br>EC2 Launch Template</pre><p>This also helped reinforce another IAM concept.</p><p>The <strong>trust policy</strong> answers:</p><pre>WHO can assume this role?</pre><p>In this case:</p><pre>EC2</pre><p>The attached permissions answer:</p><pre>WHAT can the role do?</pre><p>And the instance profile gives EC2 a way to actually consume that role.</p><p>Once the instances registered with Systems Manager, I could open a shell directly from AWS without opening SSH to the internet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lG6x44ea3ccoUTlsPE44Fw.png" /><figcaption><em>Connecting securely to a private EC2 instance using AWS Systems Manager Session Manager.</em></figcaption></figure><p>Much better than:</p><pre>0.0.0.0/0 → port 22</pre><p>😬</p><h3>🔒 Following the Security Group Chain</h3><p>Instead of allowing broad network access, I built the security groups around the actual application flow.</p><pre>Internet<br>   ↓ TCP 80<br>ALB Security Group<br>   ↓ TCP 80<br>EC2 Security Group<br>   ↓ TCP 3306<br>RDS Security Group</pre><p>The important part is that EC2 doesn’t simply allow HTTP from everywhere.</p><p>It trusts traffic from the <strong>ALB security group</strong>.</p><p>RDS doesn’t accept MySQL traffic from everywhere either.</p><p>It trusts the <strong>EC2 security group</strong>.</p><p>So the security relationship follows the architecture itself.</p><pre>Internet → ALB → EC2 → RDS</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9c36jy9Smy4B05eb9d60rg.png" /><figcaption><em>Private EC2 successfully reaching the RDS database through the intended security path.</em></figcaption></figure><h3>🗄️ Giving the Application a Database</h3><p>For the database tier, I deployed Amazon RDS for MySQL using a Multi-AZ configuration.</p><p>The database subnet group spans:</p><pre>Private DB Subnet A<br>Private DB Subnet B</pre><p>RDS manages the Multi-AZ deployment while exposing a single database endpoint to the application.</p><p>Conceptually:</p><pre>RDS Multi-AZ Deployment<br>        ↓<br>Primary DB<br>        ⇄<br>Synchronous Standby<br>        ↓<br>Single RDS Endpoint</pre><p>The application doesn’t need to know which underlying database instance is active.</p><p>It connects to the endpoint.</p><p>RDS handles the availability architecture behind it.</p><p>And importantly:</p><pre>Publicly accessible = false</pre><p>The database stays private.</p><h3>🧪 Okay, But Can I Actually Put Data in It?</h3><p>Infrastructure existing is nice.</p><p>Actually using it is better.</p><p>So I connected to one of the private EC2 instances through Session Manager and used the MariaDB client to connect to the RDS MySQL endpoint.</p><p>The first connection attempt failed.</p><p>Why?</p><p>I had typed the endpoint incorrectly. 😂</p><p>After checking the Terraform output and comparing it with the actual RDS endpoint, I corrected the hostname and connected successfully.</p><p>Then:</p><pre>SHOW DATABASES;</pre><p>There it was:</p><pre>mandyapp</pre><p>I selected it:</p><pre>USE mandyapp;</pre><p>Then checked for tables:</p><pre>SHOW TABLES;</pre><p>Nothing.</p><p>Fine.</p><p>We’ll make one. 😈</p><pre>CREATE TABLE tickets (<br>    ticket_id INT AUTO_INCREMENT PRIMARY KEY,<br>    employee_name VARCHAR(100),<br>    issue VARCHAR(255),<br>    status VARCHAR(50)<br>);</pre><p>And because after 18 years in IT support, apparently my fake database also needed tickets:</p><pre>INSERT INTO tickets (employee_name, issue, status)<br>VALUES<br>(&#39;Tracy Gill&#39;, &#39;Outlook not responding&#39;, &#39;Active&#39;),<br>(&#39;Ben Smith&#39;, &#39;VPN not connecting&#39;, &#39;Active&#39;);</pre><p>Then I updated one:</p><pre>UPDATE tickets<br>SET status = &#39;Resolved&#39;<br>WHERE ticket_id = 1;</pre><p>And verified the records:</p><pre>SELECT * FROM tickets;</pre><p>The database now had actual persistent application data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*yL2KsBf3AZ4Jv6jPNp74KA.png" /><figcaption><em>MySQL ticket records stored in the RDS database.</em></figcaption></figure><p>Now things were about to get considerably less friendly.</p><h3>💀 Terraform Built It. I Broke It. Auto Scaling Brought It Back From the Dead.</h3><p>This was the part I had been waiting for.</p><p>The Auto Scaling Group was configured with:</p><pre>Minimum capacity: 2<br>Desired capacity: 2<br>Maximum capacity: 4</pre><p>Two healthy instances existed.</p><p>The target group was happy.</p><p>The application worked.</p><p>So naturally…</p><p>I terminated one of the EC2 instances.</p><p>Manually.</p><p>On purpose.</p><p>WHAHAHA. 💀</p><p>The Auto Scaling Group basically responded:</p><pre>Excuse me.</pre><pre>I was told there should be TWO.</pre><p>Because desired capacity was still 2, Auto Scaling detected that the actual state no longer matched the desired state.</p><p>Then it did exactly what it was supposed to do.</p><pre>Instance terminated<br>        ↓<br>ASG detects capacity loss<br>        ↓<br>Replacement instance launches<br>        ↓<br>Launch template applied<br>        ↓<br>User data runs<br>        ↓<br>Apache installed/configured<br>        ↓<br>Instance registers with target group<br>        ↓<br>Health checks pass<br>        ↓<br>Traffic resumes across two healthy targets</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yw1x0PB4cIigYgXy8NAwWw.png" /><figcaption><em>Auto Scaling activity showing the terminated instance and automatic replacement.</em></figcaption></figure><p>This is where “desired state” became something more than terminology.</p><p>I wasn’t telling AWS:</p><pre>Please create EC2 instance abc123.</pre><p>I was telling it:</p><pre>I want two healthy application instances.</pre><p>I removed one.</p><p>AWS created another.</p><p>Rude, honestly. 😂</p><h3>🧟 The Replacement Came Back With Everything It Needed</h3><p>The replacement instance wasn’t manually configured.</p><p>The launch template referenced my user data script:</p><pre>user_data = filebase64(&quot;${path.module}/user-data.sh&quot;)</pre><p>That value flow is:</p><pre>user-data.sh<br>      ↓<br>filebase64()<br>      ↓<br>Launch Template<br>      ↓<br>Every new EC2 instance</pre><p>The script installs and configures what each replacement needs, including Apache and the MariaDB client.</p><p>It also retrieves instance metadata using IMDSv2 so the webpage can display the current instance ID and Availability Zone.</p><p>So when Auto Scaling launched the replacement, the new server wasn’t an empty machine waiting for me to fix it.</p><p>It bootstrapped itself.</p><p>That matters because Auto Scaling isn’t very useful if every replacement server requires manual setup afterward.</p><h3>🗄️ EC2 Was Disposable. The Data Wasn’t.</h3><p>This may have been my favorite test in the entire project.</p><p>The original EC2 instance was gone.</p><p>Completely terminated.</p><p>A brand-new replacement had taken its place.</p><p>So I connected to the replacement using Session Manager.</p><p>The MariaDB client was already there because user data had installed it automatically.</p><p>I connected back to the same RDS endpoint.</p><p>Then, in true learning fashion, I immediately ran:</p><pre>SELECT * FROM tickets;</pre><p>And MySQL replied:</p><pre>ERROR 1046 (3D000): No database selected</pre><p>😂</p><p>Right.</p><p>New session.</p><p>So:</p><pre>USE mandyapp;<br>SELECT * FROM tickets;</pre><p>And there they were.</p><pre>Tracy Gill | Outlook not responding | Resolved<br>Ben Smith  | VPN not connecting     | Active</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gTO3kNL2iAtzzFcqptA_9A.png" /><figcaption><em>The replacement EC2 instance retrieving the same persistent ticket records from RDS.</em></figcaption></figure><p>That one test demonstrated something incredibly important:</p><pre>EC2 compute = disposable</pre><pre>RDS data = persistent</pre><p>The application server can disappear.</p><p>The replacement doesn’t need the old server’s local disk to recover the application’s database records.</p><p>It reconnects to the persistent data tier.</p><p>That separation between compute and data suddenly felt very real.</p><h3>💚 GREEN MEANS GO</h3><p>Once the replacement instance registered successfully, the target group returned to:</p><pre>Healthy targets: 2<br>Unhealthy targets: 0</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4mumt-Dc73KKKEZ2C0S1yQ.png" /><figcaption><em>Both application targets healthy again after Auto Scaling recovery.</em></figcaption></figure><p>GMG.</p><p><strong>GREEN MEANS GO.</strong> 💚</p><p>The architecture had taken a failure and returned itself to the desired state.</p><h3>📊 Watching the Failure in CloudWatch</h3><p>Breaking something is much more useful when you can observe what happened.</p><p>CloudWatch showed the target health change during the failure.</p><p>The UnHealthyHostCount metric temporarily increased while the instance disappeared and the replacement came online.</p><p>Then it returned to normal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jUondAnWUUNmOnLx8Vbkuw.png" /><figcaption><em>CloudWatch showing the temporary unhealthy target during the failure test.</em></figcaption></figure><p>That gave me the monitoring side of the story:</p><pre>Failure occurs<br>     ↓<br>Metric changes<br>     ↓<br>CloudWatch records it<br>     ↓<br>Infrastructure recovers<br>     ↓<br>Metric returns to normal</pre><p>But I wanted one more thing.</p><p>An alarm.</p><h3>🚨 Fine. I’ll Kill Another One.</h3><p>I created a CloudWatch alarm for unhealthy ALB targets.</p><p>The condition was essentially:</p><pre>Metric: UnHealthyHostCount<br>Threshold: &gt;= 1<br>Evaluation: 1 datapoint within 1 minute</pre><p>Once enough metric data existed, the alarm settled into:</p><pre>OK</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tSjEzpXC5jf9OlelrbsM9Q.png" /><figcaption><em>CloudWatch alarm back in the OK state after the target group recovered.</em></figcaption></figure><p>At this point, a reasonable person might have said:</p><p>“Excellent. The alarm is configured.”</p><p>I am apparently not that person.</p><p>I killed another EC2 instance.</p><p>😂💀</p><p>CloudWatch saw the unhealthy target.</p><p>The metric spiked.</p><p>Auto Scaling launched another replacement.</p><p>The target became healthy.</p><p>The alarm returned to OK.</p><p>And yes, the application came back again.</p><p>At this point the Auto Scaling Group had probably developed trust issues.</p><h3>🔗 Terraform Was Connecting Everything the Whole Time</h3><p>One of my bigger goals with recent Terraform projects has been learning to recognize how resources pass values to one another instead of seeing every resource block as an isolated piece of code.</p><p>This project was full of examples.</p><h3>VPC → Subnets</h3><pre>vpc_id = aws_vpc.main.id</pre><p>Terraform takes the ID generated for the VPC and passes it into the subnet configuration.</p><h3>EIP → NAT Gateway</h3><pre>allocation_id = aws_eip.nat_a.id</pre><p>The Elastic IP created for the NAT Gateway becomes an input to the NAT Gateway resource.</p><h3>Subnet → NAT Gateway</h3><pre>subnet_id = aws_subnet.public_a.id</pre><p>The NAT Gateway receives the ID of the public subnet where it should live.</p><h3>AMI Data Source → Launch Template</h3><pre>image_id = data.aws_ami.amazon_linux.id</pre><p>Terraform looks up the appropriate Amazon Linux AMI and passes the resulting AMI ID into the launch template.</p><h3>User Data File → Launch Template</h3><pre>user_data = filebase64(&quot;${path.module}/user-data.sh&quot;)</pre><p>The local script is read, Base64 encoded, and supplied to every EC2 instance created from the template.</p><h3>Load Balancer → Listener</h3><pre>load_balancer_arn = aws_lb.web.arn</pre><p>The listener receives the ARN of the load balancer Terraform just created.</p><p>This is Terraform’s dependency graph in action.</p><pre>Resource creates value<br>        ↓<br>Terraform tracks value<br>        ↓<br>Another resource references value<br>        ↓<br>Dependency established automatically</pre><p>That’s a much better mental model than memorizing blocks of HCL.</p><h3>⚙️ Build Once, Recreate Automatically</h3><p>The combination of Terraform, a launch template, Auto Scaling, IAM, and user data meant the application tier wasn’t dependent on one specific EC2 instance.</p><p>That is the bigger lesson.</p><p>The server itself wasn’t precious.</p><p>Its configuration was defined elsewhere.</p><pre>Terraform<br>   ↓<br>Launch Template<br>   ↓<br>IAM Instance Profile<br>   ↓<br>User Data<br>   ↓<br>EC2</pre><p>If EC2 dies:</p><pre>Launch another one.</pre><p>If the new one gets the same infrastructure definition and bootstrap configuration:</p><pre>It becomes another application server.</pre><p>That is a very different mindset from manually configuring a server and then desperately trying to keep that particular machine alive forever.</p><h3>🧹 And Then I Destroyed Everything</h3><p>Once the architecture had been built, tested, broken, recovered, queried, monitored, and broken again…</p><p>There was only one thing left to do.</p><p>Destroy it.</p><p>First:</p><pre>terraform plan -destroy</pre><p>Terraform responded:</p><pre>Plan: 0 to add, 0 to change, 36 to destroy.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*BbZhxYYJSGKqnh_6PMXGbg.png" /><figcaption><em>Terraform identifying all 36 managed resources for destruction.</em></figcaption></figure><p>Gone.</p><p>I ran:</p><pre>terraform destroy</pre><p>And watched Terraform unwind the environment.</p><p>Eventually, I refreshed the ALB DNS name that had been serving the application all day.</p><p>Chrome responded:</p><pre>DNS_PROBE_FINISHED_NXDOMAIN</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vO-4liQdCoiPQbMJO1byFQ.png" /><figcaption><em>The former ALB DNS name no longer resolving after the infrastructure was destroyed.</em></figcaption></figure><p>I’m not going to lie.</p><p>That one was almost sad. 😂</p><p>Then Terraform delivered the final verdict:</p><pre>Destroy complete! Resources: 36 destroyed.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*7m2I6I1Ue_oyET2T_svDxQ.png" /><figcaption><em>Terraform successfully destroying all 36 resources.</em></figcaption></figure><p>Built with code.</p><p>Destroyed with code.</p><p>And nothing left sitting in AWS quietly charging me money.</p><p>Beautiful. 💚</p><h3>🧠 What This Project Actually Taught Me</h3><p>This project covered a lot of AWS services, but the biggest lessons weren’t individual service definitions.</p><p>They were about how everything works together.</p><h3>High availability is a system</h3><p>An Auto Scaling Group by itself isn’t high availability.</p><p>Neither is an ALB.</p><p>Neither is Multi-AZ RDS.</p><p>The architecture becomes resilient because multiple components work together:</p><pre>Multiple Availability Zones<br>        +<br>Load Balancing<br>        +<br>Health Checks<br>        +<br>Auto Scaling<br>        +<br>Private Networking<br>        +<br>Persistent Database<br>        +<br>Monitoring</pre><h3>Desired state changes how you think about servers</h3><p>I terminated an instance.</p><p>The Auto Scaling Group didn’t care about preserving that particular server.</p><p>It cared that:</p><pre>Desired = 2<br>Actual = 1</pre><p>So it fixed the difference.</p><h3>Private doesn’t mean disconnected</h3><p>The EC2 instances had no public IP addresses.</p><p>They could still:</p><pre>Receive application traffic from the ALB<br>Reach RDS inside the VPC<br>Reach AWS management services through SSM<br>Reach the internet outbound through NAT</pre><p>Private networking is about controlling the path, not isolating everything from everything.</p><h3>Security groups can describe relationships</h3><p>Instead of thinking only in IP addresses:</p><pre>ALB SG → EC2 SG<br>EC2 SG → RDS SG</pre><p>The permissions follow the application’s architecture.</p><h3>Compute and data should have different lifecycles</h3><p>I destroyed an EC2 instance.</p><p>The database records remained.</p><p>A replacement instance connected to RDS and picked up exactly where the previous server left off.</p><p>That was probably the clearest lesson of the entire build.</p><h3>Observability matters</h3><p>It wasn’t enough to know that Auto Scaling recovered.</p><p>CloudWatch let me <strong>see the failure happen</strong>.</p><p>The metric changed.</p><p>The alarm reacted.</p><p>The environment recovered.</p><p>The metric returned to normal.</p><p>That’s a much better troubleshooting story than:</p><pre>It broke.</pre><pre>Then somehow it worked again.</pre><p>😂</p><h3>🎃 Final Thoughts</h3><p>This project started with Terraform.</p><p>Then Windows crashed.</p><p>Then I built six subnets.</p><p>Then I deployed an ALB.</p><p>Then private EC2 instances came online.</p><p>Then RDS started storing fake IT tickets.</p><p>Then I killed EC2.</p><p>Auto Scaling resurrected it.</p><p>Then I checked the database.</p><p>The data survived.</p><p>Then I created an alarm.</p><p>Then I killed EC2 again because apparently I needed confirmation. 💀</p><p>Finally, Terraform destroyed all 36 resources.</p><p>It was chaotic.</p><p>It was extremely fun.</p><p>And somewhere between:</p><pre>terraform plan</pre><p>and:</p><pre>Destroy complete! Resources: 36 destroyed.</pre><p>a lot of AWS concepts that I’ve studied individually started connecting into one architecture.</p><p>That’s exactly why I keep building these projects.</p><p>Reading about high availability tells me what it’s supposed to do.</p><p>Building it shows me how the pieces connect.</p><p>Breaking it shows me whether I actually understand it.</p><p>And watching Auto Scaling casually replace the server I just murdered?</p><p>That part was just fun. 😈🎃</p><p><strong>Terraform built it.<br>I broke it.<br>AWS brought it back from the dead. 💀☁️</strong></p><p><a href="https://github.com/mandyreed223/terraform-ha-2tier-aws">🔗 <strong>GitHub Repository</strong></a></p><p><a href="https://mandyreed.com/">🌐 <strong>Cloud Portfolio</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f6996657256" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[☁️ I Built an Auto Scaling Architecture with Terraform. Then One Tiny Space Broke Everything. ]]></title>
            <link>https://medium.com/@mandymreed/%EF%B8%8F-i-built-an-auto-scaling-architecture-with-terraform-then-one-tiny-space-broke-everything-c1f29147dcd5?source=rss-8e7c70fd4f14------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1f29147dcd5</guid>
            <dc:creator><![CDATA[Mandy Reed]]></dc:creator>
            <pubDate>Mon, 19 Oct 2026 03:03:22 GMT</pubDate>
            <atom:updated>2026-10-19T03:06:39.264Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Building a multi-AZ AWS application with an ALB, private EC2 instances, Auto Scaling, SSM, and remote Terraform state, then troubleshooting the failure that kept taking every new instance down with it.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eVE7ffXJdVA4jUqzLJTvFA.png" /><figcaption>Image created by ChatGPT</figcaption></figure><h3>☁️ This Was Supposed to Be an Auto Scaling Project</h3><p>The plan sounded simple enough.</p><p>Build an AWS web architecture with Terraform that could:</p><p>✅ Run EC2 instances across multiple Availability Zones<br>✅ Keep those instances private<br>✅ Put an Application Load Balancer in front of them<br>✅ Maintain capacity with an Auto Scaling Group<br>✅ Replace an instance if one failed<br>✅ Store Terraform state remotely in S3</p><p>Build it. Test it. Break something on purpose. Watch AWS fix it.</p><p>Easy, right?</p><p>Well…</p><p>Terraform built the infrastructure.</p><p>The Auto Scaling Group launched the instances.</p><p>The load balancer came online.</p><p>And my application was completely unhealthy. 😂</p><p>That turned what was supposed to be an Auto Scaling project into one of my favorite troubleshooting labs yet.</p><p>Because eventually, the problem came down to something ridiculously small:</p><p><strong>one tiny space.</strong></p><p>But first, I had to find it.</p><h3>🏗️ What I Built</h3><p>I wanted this project to go beyond launching a couple of public EC2 instances in the default VPC.</p><p>So I built a custom AWS environment with Terraform:</p><ul><li>Custom VPC: 10.0.0.0/16</li><li>Two Availability Zones</li><li>Two public subnets</li><li>Two private subnets</li><li>Internet Gateway</li><li>NAT Gateway</li><li>Public and private route tables</li><li>Application Load Balancer</li><li>Target Group</li><li>Auto Scaling Group</li><li>EC2 Launch Template</li><li>Private Amazon Linux 2023 instances</li><li>Apache web servers</li><li>IAM role and instance profile</li><li>AWS Systems Manager Session Manager</li><li>S3 remote Terraform state</li></ul><p>The application path looked like this:</p><pre>Internet<br>   ↓<br>Application Load Balancer<br>   ↓<br>Target Group<br>   ↓<br>Auto Scaling Group<br>   ↓<br>Private EC2 Instances<br>   ↓<br>Apache</pre><p>The ALB lived in the public subnets while the EC2 instances stayed safely tucked away in private subnets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ogTsWbhjOU8wLsYKwrAqWg.png" /><figcaption><em>Architecture for the completed Terraform deployment.</em></figcaption></figure><h3>🔗 Terraform Was Starting to Click Differently</h3><p>One of my biggest goals with this project wasn’t simply getting Terraform to say:</p><pre>Apply complete!</pre><p>I wanted to understand how the pieces were actually connected.</p><p>Instead of seeing something like this as just Terraform syntax:</p><pre>vpc_id = aws_vpc.main.id</pre><p>I started thinking about it as a value moving through the infrastructure:</p><pre>aws_vpc.main<br>      ↓<br>AWS creates the VPC<br>      ↓<br>Terraform gets its .id<br>      ↓<br>aws_vpc.main.id<br>      ↓<br>Another resource consumes that value</pre><p>The same pattern showed up everywhere.</p><p>The subnets needed the VPC ID.</p><p>The NAT Gateway needed the public subnet ID.</p><p>The private route needed the NAT Gateway ID.</p><p>The ALB needed the public subnet IDs.</p><p>The Target Group needed the VPC ID.</p><p>The Auto Scaling Group needed the private subnet IDs.</p><p>The Launch Template needed the EC2 security group and IAM instance profile.</p><p>Suddenly Terraform felt less like a giant configuration file and more like a web of relationships.</p><p>That was a big lightbulb moment for me. 💡</p><h3>🔐 Keeping the EC2 Instances Private</h3><p>I also wanted the security model to make sense.</p><p>The Application Load Balancer security group accepts HTTP traffic on port 80 from the internet.</p><p>But the EC2 security group does <strong>not</strong> accept port 80 from:</p><pre>0.0.0.0/0</pre><p>Instead, its source is the <strong>ALB security group</strong>.</p><p>So the intended path is:</p><pre>Internet<br>   ↓<br>ALB Security Group<br>   ↓<br>Application Load Balancer<br>   ↓<br>EC2 Security Group<br>   ↓<br>Apache</pre><p>The EC2 instances don’t need public IP addresses.</p><p>And eventually, they wouldn’t need inbound SSH either.</p><p>That last part became rather important.</p><p>Because I was about to need access to those instances. 😂</p><h3>🚨 Green Did NOT Mean Go</h3><p>Terraform successfully created the infrastructure.</p><p>The Auto Scaling Group had instances.</p><p>Everything initially looked promising.</p><p>Then I checked the Target Group.</p><p><strong>Unhealthy.</strong></p><p>The ALB was reporting:</p><pre>Target.FailedHealthChecks</pre><p>My beautiful new architecture existed…</p><p>but the application wasn’t answering.</p><p>This is where the project became much more useful than if everything had worked on the first try.</p><p>Instead of immediately changing things, I started following the path.</p><h3>🔎 Start at the Request Path</h3><p>If the ALB couldn’t successfully reach the application, somewhere along this path something had to be wrong:</p><pre>ALB<br> ↓<br>Target Group<br> ↓<br>EC2 Security Group<br> ↓<br>EC2<br> ↓<br>Apache</pre><p>First I checked the security groups.</p><p>The ALB could send HTTP traffic to the EC2 instances.</p><p>That looked right.</p><p>Then I checked the networking.</p><p>The instances were in the correct private subnets.</p><p>The private route table sent outbound traffic through the NAT Gateway.</p><p>The NAT Gateway was in a public subnet.</p><p>The public subnet had a route through the Internet Gateway.</p><p>That looked right too.</p><p>So why were the health checks failing?</p><h3>♻️ Then Auto Scaling Started Doing Its Job</h3><p>While I was troubleshooting, something interesting happened.</p><p>The Auto Scaling Group started replacing the unhealthy instances.</p><p>At first glance, that sounds like exactly what I wanted.</p><p>And it was.</p><p>The problem was that every replacement instance was also unhealthy.</p><p>So AWS effectively kept doing this:</p><pre>Launch EC2<br>   ↓<br>Health check fails<br>   ↓<br>Mark instance unhealthy<br>   ↓<br>Terminate instance<br>   ↓<br>Launch replacement<br>   ↓<br>Health check fails again</pre><p>That gave me an important clue.</p><p><strong>Auto Scaling wasn’t broken.</strong></p><p>Auto Scaling was doing exactly what I told it to do.</p><p>The problem was that every new instance received the <strong>same broken configuration</strong>.</p><p>Replacing a broken instance doesn’t help when the replacement is built from the same broken instructions.</p><p>That distinction became one of my favorite lessons from this project.</p><h3>🔐 Time to Get Inside the Instance</h3><p>My instances were private, and I hadn’t opened SSH.</p><p>I could have added port 22 and started dealing with SSH keys.</p><p>But that would have weakened the design just to troubleshoot it.</p><p>Instead, I added <strong>AWS Systems Manager Session Manager</strong>.</p><p>Through Terraform, I created an IAM role, attached:</p><pre>AmazonSSMManagedInstanceCore</pre><p>created an instance profile, and connected that profile to the Launch Template.</p><p>The relationship looked like this:</p><pre>IAM Role<br>   ↓<br>SSM Managed Policy<br>   ↓<br>Instance Profile<br>   ↓<br>Launch Template<br>   ↓<br>EC2</pre><p>Now I could securely access the private instances through SSM without:</p><p>❌ Public IP addresses<br> ❌ Opening port 22<br> ❌ SSH keys</p><p>Much better.</p><p>And now I could finally ask the EC2 instance what was actually happening.</p><h3>🕵️ Apache… Where Are You?</h3><p>Once I had a Session Manager shell, one of the first things I checked was Apache:</p><pre>sudo systemctl status httpd --no-pager</pre><p>I expected to see a failed or stopped service.</p><p>Instead:</p><pre>Unit httpd.service could not be found.</pre><p>Wait.</p><p><strong>Couldn’t be found?</strong></p><p>That changed the question.</p><p>Apache wasn’t failing to start.</p><p>Apache <strong>wasn’t installed at all.</strong></p><p>My user data script was supposed to install it.</p><p>So now the troubleshooting path became:</p><pre>ALB health check fails<br>        ↓<br>Nothing answers on port 80<br>        ↓<br>Apache isn&#39;t installed<br>        ↓<br>Why didn&#39;t user data install Apache?</pre><p>Now we were getting somewhere. 🔎</p><h3>💥 scripts-user Failed</h3><p>Next stop: cloud-init.</p><p>The logs gave me another clue:</p><pre>Failed to run module scripts-user</pre><p>There it was.</p><p>My networking wasn’t the problem.</p><p>The ALB wasn’t the problem.</p><p>The security groups weren’t the problem.</p><p>The Auto Scaling Group wasn’t the problem.</p><p><strong>The EC2 bootstrap script had failed.</strong></p><p>So I inspected the actual script cloud-init had received:</p><pre>sudo head -5 /var/lib/cloud/instance/scripts/part-001 | cat -A</pre><p>And there it was.</p><p>My script effectively looked like this:</p><pre>#!/bin/bash<br>    dnf update -y<br>    dnf install -y httpd</pre><p>See it?</p><p>That little space before:</p><pre>#!/bin/bash</pre><p>😑</p><h3>🤏 One. Tiny. Space.</h3><p>The shebang needed to start at the beginning of the file:</p><pre>#!/bin/bash</pre><p>Instead, the embedded Terraform heredoc had introduced whitespace before it.</p><p>That tiny formatting problem caused the user data script to fail.</p><p>Which meant Apache never installed.</p><p>Which meant nothing listened on port 80.</p><p>Which meant the ALB health checks failed.</p><p>Which meant the Auto Scaling Group replaced the instance.</p><p>Which meant the replacement received the same broken user data.</p><p>Which meant…</p><p>💀 <strong>here we go again.</strong></p><p>The entire failure chain was:</p><pre>One tiny space<br>      ↓<br>User data fails<br>      ↓<br>Apache never installs<br>      ↓<br>Port 80 has nothing listening<br>      ↓<br>ALB health check fails<br>      ↓<br>EC2 becomes unhealthy<br>      ↓<br>ASG replaces EC2<br>      ↓<br>Same bad configuration<br>      ↓<br>Repeat forever</pre><p>Infrastructure troubleshooting is humbling sometimes. 😂</p><h3>🛠️ Fix the Configuration, Not the Symptoms</h3><p>Instead of trying to patch the running instances, I fixed the source of truth.</p><p>I moved the bootstrap script out of the Terraform heredoc and into its own file:</p><pre>user_data.sh</pre><p>Now the file starts exactly where it should:</p><pre>#!/bin/bash<br>dnf update -y<br>dnf install -y httpd<br>systemctl enable httpd<br>systemctl start httpd</pre><p>And Terraform loads it with:</p><pre>user_data = base64encode(file(&quot;${path.module}/user_data.sh&quot;))</pre><p>That gave me a cleaner Terraform configuration and made the shell script much easier to inspect independently.</p><p>The updated configuration created <strong>Launch Template version 3</strong>.</p><p>But there was another lesson waiting for me.</p><p>Updating a Launch Template doesn’t magically replace every instance that’s already running.</p><p>So I initiated an <strong>Auto Scaling Instance Refresh</strong>.</p><p>That rolled the corrected Launch Template through the Auto Scaling Group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*RHVDaW95fZo5IyrwpkI3JQ.png" /><figcaption><em>Launch Template version 3 successfully rolled through the Auto Scaling Group using Instance Refresh.</em></figcaption></figure><h3>🟢 GREEN MEANS GO!</h3><p>And then…</p><p><strong>healthy.</strong></p><p>Both targets passed the ALB health checks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*yDDvp_NyOrte8fO8TVB3BQ.png" /><figcaption><em>Both EC2 targets healthy behind the Application Load Balancer.</em></figcaption></figure><p>Then I opened the ALB DNS name.</p><p>And there it was.</p><p>My Apache page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AJZ6r5SYORu4ve9bxWuOUg.png" /><figcaption><em>After all that troubleshooting… GREEN MEANS GO. 🟢</em></figcaption></figure><p>There is something particularly satisfying about seeing a web page load after you’ve spent entirely too long chasing one tiny space through AWS. 😂</p><h3>🌎 Two Availability Zones, Two Healthy Instances</h3><p>With the bootstrap problem fixed, the Auto Scaling Group settled at the desired capacity of two instances.</p><p>One instance ran in us-east-1a.</p><p>The other ran in us-east-1b.</p><pre>Minimum: 2<br>Desired: 2<br>Maximum: 5</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*XEqDKqO6ZECMj510a6gqIQ.png" /><figcaption><em>Two healthy Auto Scaling instances distributed across Availability Zones.</em></figcaption></figure><p>But I wasn’t done.</p><p>Because seeing two healthy instances isn’t the same as proving self-healing works.</p><p>And apparently I enjoy deleting perfectly healthy infrastructure now. 😈</p><h3>😈 So Naturally, I Killed One</h3><p>I intentionally terminated one of the healthy EC2 instances.</p><p>Then I watched.</p><p>The Auto Scaling Group detected that it had fallen below its desired capacity.</p><p>AWS marked the old instance for termination and launched a replacement.</p><pre>Desired capacity: 2</pre><pre>Terminate one instance<br>        ↓<br>Capacity drops<br>        ↓<br>ASG detects the difference<br>        ↓<br>Replacement launches<br>        ↓<br>New instance enters InService<br>        ↓<br>ALB health checks pass<br>        ↓<br>Back to 2 healthy instances</pre><p>The scaling activity showed AWS doing exactly what I wanted it to do.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*gEHVWfudcAEyJpIOxylKtw.png" /><figcaption><em>Auto Scaling activity showing the terminated instance and its automatic replacement.</em></figcaption></figure><p>The replacement then registered with the Target Group and became healthy.</p><p>No manual server rebuild.</p><p>No logging in to install Apache.</p><p>No manually attaching anything to the load balancer.</p><p>The infrastructure returned itself to the desired state.</p><p><strong>That was the moment Auto Scaling really clicked for me.</strong></p><h3>🪣 One More Upgrade: Remote Terraform State</h3><p>At this point the infrastructure worked, but my Terraform state was still local.</p><p>For a more production-aligned workflow, I wanted to move it into an S3 backend.</p><p>I created a dedicated S3 bucket and configured:</p><p>🔒 Public access blocking<br> 🔐 Server-side encryption<br> 📚 Versioning<br> 🔏 Terraform state locking</p><p>Then I configured the backend:</p><pre>backend &quot;s3&quot; {<br>  bucket       = &quot;mandy-terraform-asg-state-2026&quot;<br>  key          = &quot;terraform-asg/terraform.tfstate&quot;<br>  region       = &quot;us-east-1&quot;<br>  encrypt      = true<br>  use_lockfile = true<br>}</pre><p>And migrated the existing state:</p><pre>terraform init -migrate-state</pre><p>The state was now stored remotely in S3 instead of relying on my local machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/573/1*h5yoy64ci52MYz6B6rTkqA.png" /><figcaption><em>Terraform state successfully migrated to the S3 backend.</em></figcaption></figure><h3>🔒 Protecting the State</h3><p>Terraform state deserves protection because it contains detailed information about managed infrastructure and can potentially contain sensitive values.</p><p>So I verified that public access was completely blocked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*nXoRa7Iog-PilCgk5Ld2Vw.png" /><figcaption><em>All four S3 public access block settings enabled.</em></figcaption></figure><p>I also verified server-side encryption using AES256.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/1*NlWPLmMVxRJKNXI6EpIEfA.png" /><figcaption><em>Server-side encryption enabled for the Terraform state bucket.</em></figcaption></figure><p>Versioning gives me additional recovery protection for the state object, while use_lockfile = true provides state locking to help prevent simultaneous Terraform operations from modifying the same state.</p><h3>⚖️ One Design Tradeoff Worth Calling Out</h3><p>There is one deliberate compromise in this architecture.</p><p>I used <strong>one NAT Gateway</strong> in Public Subnet 1.</p><p>Both private subnets use it for outbound internet connectivity.</p><p>For a learning environment, that keeps costs lower while still letting me practice private subnet routing and NAT-based outbound access.</p><p>But I wouldn’t describe that outbound path as fully multi-AZ resilient.</p><p>If the Availability Zone containing that NAT Gateway became unavailable, the private subnet in the other AZ would lose that outbound path too.</p><p>For a production environment where that resilience mattered, I’d use:</p><pre>Private Subnet AZ 1 → NAT Gateway AZ 1<br>Private Subnet AZ 2 → NAT Gateway AZ 2</pre><p>That costs more, but removes the single-AZ NAT dependency.</p><p>This was another useful reminder that <strong>“multi-AZ” isn’t something you can determine just by counting EC2 instances.</strong></p><p>You have to follow the dependencies through the architecture.</p><h3>✅ One Last Terraform Check</h3><p>After migrating the state, I ran:</p><pre>terraform plan</pre><p>Terraform read the remote state, refreshed the AWS resources, compared reality with my configuration…</p><p>and returned:</p><pre>No changes. Your infrastructure matches the configuration.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*atis0tDRfcg0ylXZFn6nZg.png" /><figcaption><em>Configuration, remote state, and deployed AWS infrastructure all aligned.</em></figcaption></figure><p>🟢 <strong>GMG.</strong></p><h3>🧠 What This Project Actually Taught Me</h3><p>I started this project expecting to learn more about Terraform and Auto Scaling.</p><p>I did.</p><p>But the troubleshooting taught me more.</p><p>I got more comfortable following a problem through multiple layers instead of randomly changing things:</p><pre>ALB unhealthy<br>    ↓<br>Check security<br>    ↓<br>Check networking<br>    ↓<br>Check EC2<br>    ↓<br>Apache missing<br>    ↓<br>Check cloud-init<br>    ↓<br>scripts-user failed<br>    ↓<br>Inspect user data<br>    ↓<br>Find the tiny space<br>    ↓<br>Fix the source<br>    ↓<br>Refresh instances<br>    ↓<br>Healthy</pre><p>I also came away with a much better understanding of:</p><p>☁️ Terraform resource linkage<br>🌐 Public vs. private subnet design<br>🔐 Security group references<br>🚪 NAT Gateway routing<br>⚖️ Cost vs. availability tradeoffs<br>🔑 IAM roles and instance profiles<br>🖥️ Secure administration with SSM<br>⚙️ Launch Template versioning<br>♻️ Auto Scaling self-healing<br>🔄 Instance Refresh<br>🪣 S3 remote state<br>🔒 Terraform state protection<br>🔎 Layer-by-layer troubleshooting</p><p>But maybe my favorite lesson was this:</p><p><strong>Successful infrastructure deployment does not automatically mean a healthy application.</strong></p><p>Terraform had done its job.</p><p>AWS Auto Scaling was doing its job.</p><p>The ALB health checks were doing their job.</p><p>The failure was somewhere else.</p><p>I just had to keep following the evidence until I found it.</p><h3>💚 Build It. Explain It. Break It. Fix It.</h3><p>That’s becoming one of my favorite ways to learn cloud engineering.</p><p>It’s one thing to run:</p><pre>terraform apply</pre><p>and watch resources appear.</p><p>It’s another thing to understand <strong>why they’re connected</strong>, intentionally test what happens when something fails, and be able to troubleshoot the result.</p><p>This project gave me all four:</p><p><strong>BUILD</strong> 🏗️<br><strong>EXPLAIN</strong> 🧠<br><strong>BREAK</strong> 😈<br><strong>FIX</strong> 🔧</p><p>And apparently sometimes…</p><p><strong>CHECK FOR ONE TINY SPACE.</strong> 😂</p><h3>🔗 Project</h3><p>The complete Terraform configuration, architecture diagram, screenshots, and technical documentation are available in my GitHub repository:</p><p><strong>🔗 GitHub Repository:</strong><br> <a href="https://github.com/mandyreed223/terraform-asg-deployment"><strong>Terraform Auto Scaling Deployment on AWS</strong></a></p><h3>☁️ Keep Building</h3><p>Every project seems to leave me with a few more AWS services I understand, a few more troubleshooting commands in my toolbox, and at least one new way to accidentally break something. 😂</p><p>And I’m starting to think that last part might be where some of the best learning happens.</p><p><strong>Until the next project… 🟢 Green Means GO!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1f29147dcd5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Put Kubernetes on AWS. Then I Started Deleting Pods. ☸️]]></title>
            <link>https://medium.com/@mandymreed/i-put-kubernetes-on-aws-then-i-started-deleting-pods-%EF%B8%8F-6b5d9898773a?source=rss-8e7c70fd4f14------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b5d9898773a</guid>
            <dc:creator><![CDATA[Mandy Reed]]></dc:creator>
            <pubDate>Sun, 11 Oct 2026 22:02:29 GMT</pubDate>
            <atom:updated>2026-10-11T22:07:42.531Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Building my first Amazon EKS deployment with ECR, self-healing, autoscaling, CloudWatch, and a rolling update.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CXIZLAADtJ9b8lVoqGIwzA.png" /><figcaption>Image created using ChatGPT</figcaption></figure><p>I’ve been spending a lot of time with Kubernetes lately.</p><p>First, I learned the fundamentals.</p><p>Then I deployed WordPress and MySQL together.</p><p>Then I deliberately broke a Kubernetes application just so I could troubleshoot it.</p><p>Apparently the next logical step was:</p><p><strong>“Okay…but what happens when I put all of this on AWS?”</strong> ☁️</p><p>Up until now, most of my Kubernetes work had been local. That was great for learning Deployments, ReplicaSets, Services, persistent storage, troubleshooting, and the whole <em>desired state</em> concept.</p><p>But I wanted to see what happened when Kubernetes stopped living comfortably on my machine and started interacting with actual cloud infrastructure.</p><p>So this week’s project became my first deployment on <strong>Amazon Elastic Kubernetes Service (EKS)</strong>.</p><p>The plan sounded reasonable:</p><p>☸️ Build an EKS cluster<br>🐳 Build my own Docker image<br>📦 Store it in Amazon ECR<br>🌎 Expose the application externally<br>💥 Delete something on purpose<br>📈 Make Kubernetes scale it<br>👀 Send EKS logs to CloudWatch<br>🔄 Push a new version with a rolling update<br>🧹 Clean up everything before AWS developed expensive feelings</p><p>Simple enough.</p><p>Captain Kube had concerns. 🦉</p><h3>🏗️ First, What Was I Actually Building?</h3><p>Before I started deploying things, I wanted to understand the complete path instead of treating EKS like a mysterious AWS button labeled <strong>“Kubernetes happens here.”</strong></p><p>This was the basic journey:</p><pre>Source Code → Docker Image → Amazon ECR → EKS Deployment → ReplicaSet → <br>Pods → Kubernetes Service → AWS Load Balancer → User</pre><p>And behind those pods were real EC2 worker nodes spread across multiple Availability Zones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oLP2gWQ--bgaQfSOcibgbA.png" /></figure><p>This was one of my biggest goals for the project.</p><p>I didn’t want to memorize a series of commands that resulted in a website.</p><p>I wanted to understand <strong>what each layer was doing and how the pieces connected.</strong></p><h3>☁️ Time to Build an Actual EKS Cluster</h3><p>I used eksctl to define the cluster rather than clicking through the AWS console.</p><p>My configuration included:</p><p>☸️ Kubernetes 1.36<br>🌎 us-east-1<br>🏢 Two Availability Zones<br>🖥️ Two t3.medium EC2 worker nodes<br>🔒 Private worker networking<br>📊 Managed node group capacity of 2 to 3 nodes</p><p>Then came the familiar cloud-engineering experience:</p><p><strong>Run command.</strong></p><p><strong>Wait.</strong></p><p><strong>Watch many things happen.</strong></p><p><strong>Question every life decision while CloudFormation works.</strong> 😂</p><p>Eventually…</p><p>The cluster came alive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*rw6myJqMdD_C6SZYSUM_Jg.png" /></figure><p>Two EC2 worker nodes.</p><p>Both Ready.</p><p>And suddenly Kubernetes wasn’t just something running locally anymore.</p><p>My pods were going to be scheduled onto actual AWS infrastructure.</p><p>That felt like a pretty big step.</p><h3>☸️ Deployment → ReplicaSet → Pods</h3><p>Next came the application.</p><p>I started with three nginx pods.</p><p>Once deployed, I could see the Kubernetes hierarchy I’d been learning about:</p><p><strong>Deployment → ReplicaSet → Pods</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1qKj2ZarKp_E-XtECA0e6w.png" /></figure><p>This is one of those concepts that makes much more sense once you stop looking at diagrams and actually watch it happen.</p><p>I wasn’t individually managing three containers.</p><p>I told Kubernetes:</p><p><strong>“I want three replicas of this application.”</strong></p><p>The Deployment managed the ReplicaSet.</p><p>The ReplicaSet made sure three pods existed.</p><p>And Kubernetes continuously worked to keep reality matching what I had declared.</p><p>That distinction was about to become important. 😈</p><h3>🌎 Okay Kubernetes, Meet the Internet</h3><p>Running pods was nice.</p><p>But I wanted to actually reach the application.</p><p>So I created a Kubernetes Service using:</p><pre>type: LoadBalancer</pre><p>That connected my Kubernetes workload to AWS load-balancing infrastructure and gave the application an externally reachable endpoint.</p><p>Now the path looked like this:</p><pre>Browser → AWS Load Balancer → Kubernetes Service → Application Pods</pre><p>And then…</p><p>I opened the endpoint in my browser.</p><p>It worked. 🎉</p><p>There is still something deeply satisfying about reaching a webpage that exists because a ridiculous number of cloud and networking pieces all agreed to cooperate.</p><h3>🐳 But Default nginx Wasn’t Good Enough</h3><p>Of course I couldn’t leave the default nginx page sitting there.</p><p>Where’s the fun in that?</p><p>I created my own HTML application and packaged it into a Docker image.</p><p>The Dockerfile was intentionally simple:</p><pre>FROM nginx:1.27-alpine<br><br>COPY index.html /usr/share/nginx/html/index.html<br><br>EXPOSE 80</pre><p>Then I built the image locally.</p><p>But now I had another problem.</p><p>My EKS deployment needed somewhere to get that image.</p><p>Enter <strong>Amazon Elastic Container Registry (ECR).</strong> 📦</p><h3>📦 Docker, Meet ECR</h3><p>I created a private ECR repository and pushed my application image into it.</p><p>Now my deployment workflow looked much more like something I’d expect in an actual cloud environment:</p><pre>Code → Docker Build → Image → ECR → EKS</pre><p>This was a cool connection for me because Docker and Kubernetes stopped feeling like separate topics.</p><p>Docker packaged the application.</p><p>ECR stored the versioned image.</p><p>EKS ran it.</p><p>Kubernetes managed its desired state.</p><p>Each technology had a specific job.</p><p>And then I decided it was time to start causing problems. 😈</p><h3>😈 So…I Deleted a Pod</h3><p>This might have been my favorite part of the entire project.</p><p>Everything was healthy.</p><p>Three pods were running.</p><p>The website worked.</p><p>So naturally…</p><p>I deleted one.</p><pre>kubectl delete pod &lt;pod-name&gt;</pre><p>Goodbye, little pod. 👋</p><p>Except Kubernetes was basically like:</p><p><strong>“Absolutely not.”</strong></p><p>Almost immediately, the ReplicaSet noticed that reality no longer matched the desired state.</p><p>I said:</p><p><strong>Three pods.</strong></p><p>There were now:</p><p><strong>Two pods.</strong></p><p>Kubernetes created another one.</p><p>Back to three.</p><p>The application stayed available.</p><p>I didn’t recreate anything.</p><p>I didn’t restart anything.</p><p>I didn’t repair anything.</p><p>Kubernetes did exactly what I had told it to do in the first place.</p><p><strong>Maintain the desired state.</strong></p><p>Captain Kube remained unimpressed. 🦉</p><p>I, however, was delighted.</p><p>This was the moment where Kubernetes self-healing stopped being a definition and became something I had actually watched happen.</p><h3>📈 Fine. What If I Want MORE Pods?</h3><p>Once I knew Kubernetes could replace a failed pod, I wanted to see how the workload behaved when I increased the replica count.</p><p>So I manually scaled the application:</p><p><strong>3 pods → 6 pods</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1aUlkd8b5drjL-kdERIPbA.png" /></figure><p>And this was where another important distinction clicked.</p><p>The number of EC2 worker nodes stayed at <strong>two</strong>.</p><p>Kubernetes simply scheduled the additional pods across the available workers.</p><p>That gave me a much clearer picture of two different layers:</p><p><strong>Pod scaling ≠ Node scaling</strong></p><p>The application can scale inside the cluster without automatically adding another EC2 instance.</p><p>My managed node group had minimum, desired, and maximum capacity settings, but I had <strong>not</strong> installed Cluster Autoscaler or Karpenter.</p><p>So node-level workload-driven autoscaling wasn’t part of this project.</p><p>That distinction matters.</p><p>And I definitely understand it better now than I did before this lab.</p><h3>📊 Before Autoscaling, I Needed Metrics</h3><p>Before Kubernetes could make scaling decisions based on CPU usage, it needed metrics.</p><p>Using Metrics Server and kubectl top, I checked both the EC2 worker nodes and the application pods.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*_7gO30NlfaQH2ZujliD1gw.png" /></figure><p>And my application was basically…</p><p>Doing nothing. 😂</p><p>The workers were sitting around 1% CPU.</p><p>The pods were barely using anything.</p><p>Which was good for efficiency.</p><p>Not so good for demonstrating autoscaling.</p><p>So naturally…</p><p>I needed to make things worse.</p><h3>⚙️ Enter the Horizontal Pod Autoscaler</h3><p>I configured an HPA with:</p><pre>Minimum pods: 3<br>Maximum pods: 6<br>CPU target: 50%</pre><p>Under normal conditions, the application stayed at three replicas.</p><p>Exactly what I expected.</p><p>Then I generated artificial CPU load against the application.</p><p>And watched.</p><p>CPU utilization climbed.</p><p>Eventually it hit approximately <strong>60%</strong>, crossing my 50% target.</p><p>And Kubernetes reacted.</p><p><strong>3 pods → 4 pods</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*obAGsgHAioyEldUoroijmQ.png" /></figure><p>YES. 🙌</p><p>This wasn’t me running another scale command.</p><p>The HPA looked at the metrics, compared current utilization with the target, and changed the desired replica count.</p><p>Kubernetes created another pod.</p><p>That was the first time in this project where the application actually <strong>scaled itself based on demand.</strong></p><h3>📉 But Would It Scale Back Down?</h3><p>Scaling up is fun.</p><p>Scaling back down is arguably more important.</p><p>Otherwise I’d eventually have 847 pods sitting around doing absolutely nothing. 😂</p><p>So I removed the artificial load.</p><p>CPU usage dropped.</p><p>And after the HPA stabilization period…</p><p><strong>4 pods → 3 pods</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*iKWSx59EFVxrEEzgijnqog.png" /></figure><p>Back to baseline.</p><p>That whole cycle made HPA much easier to understand:</p><pre>Demand increases → CPU rises → HPA increases desired replicas → <br>Kubernetes creates pods</pre><p>Then:</p><pre>Demand decreases → CPU falls → HPA lowers desired replicas → <br>Kubernetes removes unnecessary pods</pre><p>Now autoscaling wasn’t just something I’d read about.</p><p>I’d pushed it hard enough to watch the entire lifecycle happen.</p><h3>👀 Okay…But What Is EKS Doing Behind the Scenes?</h3><p>Next I wanted better visibility into the control plane.</p><p>So I enabled Amazon EKS logging for:</p><p>🔎 Kubernetes API logs<br>📋 Kubernetes audit logs</p><p>Those logs started appearing in Amazon CloudWatch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/1*LeYGgoytsujdiAZhuN6pjA.png" /></figure><p>Then I verified the individual API server and audit log streams.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/1*521ieCPEN3bnytTMBdeoiw.png" /></figure><p>This was another useful distinction.</p><p>Metrics told me things like:</p><p><strong>How much CPU is this pod using?</strong></p><p>CloudWatch control-plane logs could help answer different questions about:</p><p><strong>What is happening inside the Kubernetes API and control plane?</strong></p><p>Observability isn’t one giant bucket called <em>logs</em>.</p><p>Different layers answer different troubleshooting questions.</p><p>That’s something I’m starting to appreciate more and more as these projects get larger.</p><h3>🔄 Then I Changed the Application</h3><p>At this point, the application worked.</p><p>Which obviously meant it was time to change it. 😂</p><p>I updated the page and created a second container image:</p><pre>v2</pre><p>Then:</p><p>🐳 Built the new Docker image<br>📦 Tagged it as v2<br>☁️ Pushed it to Amazon ECR<br>☸️ Updated the EKS Deployment<br>👀 Watched Kubernetes perform a rolling update</p><p>And this part was REALLY cool.</p><p>Kubernetes didn’t simply kill the entire application and replace everything at once.</p><p>A new ReplicaSet appeared.</p><p>New v2 pods came online.</p><p>The old ReplicaSets scaled down.</p><p>Eventually, all active pods were running the new image.</p><p>And the external endpoint continued working during the rollout.</p><p>The final application looked like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AkUtqstYOJcpid4LtkhXXg.png" /></figure><p>My little nginx page had officially turned into a tiny dashboard celebrating the infrastructure underneath it. 😂💚</p><h3>🔁 And Suddenly This Looked A Lot Like CI/CD</h3><p>I didn’t build a complete automated CI/CD pipeline in this project.</p><p>But I absolutely saw the workflow:</p><pre>Change Code → Build Image → Tag Version → Push to Registry → Update <br>Deployment → Roll Out → Validate</pre><p>That’s essentially the path automation would take over.</p><p>Instead of me manually building and pushing v2, a future pipeline could do it automatically after a successful commit or merge.</p><p>That’s one of my favorite things about these projects.</p><p>Something I learn in one project suddenly connects to Jenkins, GitHub Actions, Docker, Terraform, or something else I’ve already worked with.</p><p>The pieces are starting to feel less isolated.</p><h3>🧹 And Then Came the Least Glamorous Important Part</h3><p>Cleanup.</p><p>Amazon EKS isn’t exactly the kind of lab environment I wanted to accidentally leave running for three weeks. 😂💸</p><p>And deleting the EKS cluster wasn’t enough for me.</p><p>I wanted to verify everything.</p><p>So I worked backward through the infrastructure:</p><pre>Kubernetes LoadBalancer Service<br>↓<br>AWS Load Balancer<br>↓<br>HPA + Application Deployment<br>↓<br>EKS Cluster + Managed Node Group<br>↓<br>VPC + NAT Infrastructure<br>↓<br>ECR Repository<br>↓<br>CloudWatch Log Group</pre><p>Then I checked.</p><p>No EKS cluster.</p><p>No load balancer.</p><p>No NAT gateway.</p><p>No leftover eksctl CloudFormation stacks.</p><p>ECR repository gone.</p><p>CloudWatch log group gone.</p><p><strong>Only then did I consider the project finished.</strong> 🧹✅</p><p>Cloud cleanup is part of cloud engineering too.</p><p>Sometimes the most financially responsible command is the last one you run. 😂</p><h3>🧠 What Actually Clicked for Me</h3><p>This project ended up teaching me much more than simply <strong>“how to deploy something to EKS.”</strong></p><h3>☸️ Desired state is the heart of Kubernetes</h3><p>Deleting that pod was probably the simplest experiment in the project, but it demonstrated one of the biggest Kubernetes concepts.</p><p>I didn’t tell Kubernetes how to fix the problem.</p><p>I told Kubernetes what I wanted reality to look like.</p><p>Kubernetes handled the difference.</p><h3>📈 Pods and nodes are separate scaling layers</h3><p>HPA scaled my application pods.</p><p>It did not automatically add EC2 worker nodes.</p><p>Those are two different scaling problems with different solutions.</p><h3>📦 ECR completed the container story</h3><p>Before this project, I understood Docker images and Kubernetes deployments individually.</p><p>ECR connected them into an actual release path.</p><h3>🔄 Rolling updates made Deployments feel much more powerful</h3><p>Seeing the new ReplicaSet come online while the old one disappeared made Kubernetes Deployments feel much more real than simply reading about rollout strategies.</p><h3>👀 Observability depends on the question</h3><p>CPU metrics, pod status, Kubernetes events, API logs, and audit logs all tell different parts of the story.</p><p>Troubleshooting means knowing <strong>which layer to inspect next</strong>.</p><h3>🧹 Cleanup deserves verification</h3><p>delete does not mean:</p><p><strong>“Assume everything is gone and close the laptop.”</strong></p><p>Especially in AWS. 😂</p><h3>💚 The Biggest Win</h3><p>When I started learning Kubernetes, I was mostly focused on commands.</p><pre>kubectl get pods<br><br>kubectl describe<br><br>kubectl logs</pre><p>Those commands still matter.</p><p>But I’m starting to think much more in terms of systems:</p><p><strong>Where does traffic enter?</strong></p><p><strong>Which component owns this pod?</strong></p><p><strong>What happens if it dies?</strong></p><p><strong>Where does the image come from?</strong></p><p><strong>What metric causes scaling?</strong></p><p><strong>What happens during an update?</strong></p><p><strong>Where would I look if something broke?</strong></p><p><strong>What AWS resource exists because of this Kubernetes object?</strong></p><p>That’s the part I’m enjoying most.</p><p>The more layers I add, the more my troubleshooting background starts to feel useful rather than separate from cloud engineering.</p><p>Because whether it’s an enterprise application, a container, or an EKS cluster…</p><p>Something will eventually break.</p><p>And apparently my response is still:</p><p><strong>“Okay…but why?”</strong> 🔎😂</p><h3>☁️ What’s Next?</h3><p>This project gave me a solid first look at running Kubernetes in AWS, but there’s plenty I intentionally left for future projects.</p><p>A few directions I’d like to explore:</p><p>🔧 Managing EKS infrastructure with Terraform<br>⚙️ Automating the build and deployment with GitHub Actions<br>📈 Cluster Autoscaler or Karpenter for node-level scaling<br>❤️ Readiness and liveness probes<br>🔐 Deeper IAM and secrets management<br>🌐 Ingress and HTTPS<br>📊 Prometheus and Grafana<br>📝 Centralized application logging</p><p>For now, though?</p><p>The cluster is gone.</p><p>The AWS resources are cleaned up.</p><p>The pods have stopped multiplying.</p><p>And Captain Kube can finally stop judging me. 🦉☸️</p><p>Probably.</p><h3>🔗 Project</h3><p>The complete project, Kubernetes manifests, Dockerfile, architecture diagram, screenshots, and documentation are available in my GitHub repository:</p><p><a href="https://github.com/mandyreed223/amazon-eks-deployment">Amazon EKS Deployment ☸️ →</a></p><p><strong>Built. Deployed. Scaled. Monitored. Updated. Deleted a pod just to see what would happen. 😈</strong></p><p><em>I’d call that a productive Sunday. ☁️☸️💚</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b5d9898773a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Put WordPress and MySQL on Kubernetes. Then MySQL Fought Back. ☸️]]></title>
            <link>https://medium.com/@mandymreed/i-put-wordpress-and-mysql-on-kubernetes-then-mysql-fought-back-%EF%B8%8F-05a6370e0926?source=rss-8e7c70fd4f14------2</link>
            <guid isPermaLink="false">https://medium.com/p/05a6370e0926</guid>
            <dc:creator><![CDATA[Mandy Reed]]></dc:creator>
            <pubDate>Sun, 04 Oct 2026 19:37:14 GMT</pubDate>
            <atom:updated>2026-10-04T19:37:14.199Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Building a multi-tier application with Services, persistent storage, health probes, and self-healing, then troubleshooting the database failure I definitely didn’t plan for.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8d7I78NscuwJN4pPjek_0Q.png" /><figcaption>Image created using ChatGPT</figcaption></figure><p>I went into this project wanting to take the Kubernetes fundamentals I had been learning and actually make them work together.</p><p>Pods? Got it.</p><p>Deployments? Got it.</p><p>Services? Starting to make sense.</p><p>Self-healing? Already tested it.</p><p>But understanding those pieces individually and using them to run a real multi-tier application are two very different things.</p><p>So this time, I gave Kubernetes something a little more interesting:</p><pre>☸️ WordPress<br>🐬 MySQL<br>🌐 Services<br>🔐 Secrets<br>⚙️ ConfigMaps<br>💾 Persistent storage<br>❤️ Health probes<br>🩹 Self-healing</pre><p>The goal was simple enough.</p><p>Build a WordPress and MySQL application on Kubernetes, make the two tiers communicate, preserve the database when Pods disappear, and compare the experience with the Docker Swarm projects I had already built.</p><p>And because apparently I can’t just deploy something and leave it alone anymore, I also wanted to break things on purpose.</p><p>Kubernetes eventually decided to help with that last part. 😂</p><h3>☸️ From Kubernetes Fundamentals to an Actual Application</h3><p>My previous Kubernetes project focused on the fundamentals.</p><p>I created Pods and Deployments, watched ReplicaSets maintain desired state, exposed workloads through Services, scaled replicas, performed rolling updates, deleted Pods, and watched Kubernetes replace them.</p><p>That taught me what the individual pieces did.</p><p>This project was about connecting them.</p><p>My architecture looked like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vPRxbR57uk8bB1ZqqlR-AQ.png" /></figure><p>The application ran on a local single-node MicroK8s cluster inside WSL2.</p><p>A Windows browser accessed WordPress through a NodePort Service.</p><p>WordPress communicated with MySQL through an internal ClusterIP Service.</p><p>MySQL stored its database files on persistent storage.</p><p>Simple diagram.</p><p>Quite a few moving parts. 😅</p><h3>🧩 Building the Application One Kubernetes Object at a Time</h3><p>One thing that became much clearer during this project is just how explicit Kubernetes can be.</p><p>Instead of thinking about “the WordPress application” as one thing, I was creating several different Kubernetes objects:</p><pre>📦 Deployments controlled the application workloads.<br>🌐 Services provided stable networking.<br>⚙️ A ConfigMap stored non-sensitive configuration.<br>🔐 A Secret supplied database credentials.<br>💾 A PersistentVolumeClaim requested storage for MySQL.<br>❤️ Probes determined whether MySQL was actually healthy.</pre><p>Each object had its own job.</p><p>I kept the manifests separated too:</p><pre>namespace.yaml<br>mysql-configmap.yaml<br>mysql-pvc.yaml<br>mysql-deployment.yaml<br>mysql-service.yaml<br>wordpress-deployment.yaml<br>wordpress-service.yaml</pre><p>I also created a mysql-secret.yaml locally, but that file would NOT be going to GitHub.</p><p>More on that later. 🔐</p><h3>🔐 ConfigMaps and Secrets Finally Felt Practical</h3><p>I had worked with configuration concepts before, but using them inside an application made the separation click.</p><p>My ConfigMap held values that weren’t sensitive, including the WordPress database name and the hostname WordPress should use to find MySQL.</p><p>The important hostname was beautifully simple:</p><pre>mysql</pre><p>Not a Pod IP.</p><p>Not a manually configured server address.</p><p>Just:</p><pre>mysql</pre><p>Credentials were handled separately with a Kubernetes Secret.</p><p>That meant the application configuration could effectively say:</p><p>“Connect to the database called wordpress at mysql.”</p><p>While the sensitive username and passwords came from the Secret.</p><p>That separation made much more sense when I could see an application actually consuming both.</p><h3>💾 Then Came Persistent Storage</h3><p>Containers and Pods are replaceable.</p><p>Databases are a little less enthusiastic about that philosophy. 😂</p><p>MySQL stores its data in:</p><pre>/var/lib/mysql</pre><p>If that data only existed inside the container filesystem, replacing the MySQL Pod could also mean replacing my database.</p><p>That was definitely not the experiment I wanted.</p><p>So I created a PersistentVolumeClaim requesting:</p><pre>2 GiB<br>ReadWriteOnce</pre><p>At first, the PVC stayed:</p><pre>Pending<br><br>Time to troubleshoot.</pre><p>The problem was that my MicroK8s cluster didn’t yet have an available StorageClass.</p><p>After enabling MicroK8s hostpath storage, the cluster gained the default:</p><pre>microk8s-hostpath</pre><p>Once MySQL consumed the claim, Kubernetes dynamically provisioned the storage and the PVC changed to:</p><pre>Bound</pre><p>That little status change felt much more exciting than it probably should have. 😂</p><h3>🌐 Kubernetes DNS Did the Networking Magic</h3><p>Once WordPress and MySQL were running, I wanted to prove that they could actually find each other.</p><p>The MySQL Service was a ClusterIP Service, which meant it stayed internal to the cluster.</p><p>WordPress didn’t need to know the MySQL Pod’s IP address.</p><p>Instead, it used:</p><pre>mysql:3306</pre><p>I tested DNS resolution from inside the WordPress Pod.</p><p>Kubernetes resolved mysql to:</p><pre>mysql.wordpress-app.svc.cluster.local</pre><p>Then I tested TCP connectivity from WordPress to MySQL on port 3306.</p><p>Success. 🎉</p><p>That proved the path:</p><pre>WordPress Pod<br>⬇️<br>Kubernetes DNS<br>⬇️<br>MySQL Service<br>⬇️<br>MySQL Pod</pre><p>This was one of those moments where Services stopped feeling like another Kubernetes definition I needed to memorize and started feeling like something I actually understood.</p><h3>🌎 Getting WordPress Into My Browser</h3><p>The database was supposed to stay internal.</p><p>WordPress wasn’t.</p><p>I exposed WordPress through a NodePort Service.</p><p>Kubernetes assigned:</p><p><strong>31964</strong></p><p>Inside WSL, I could curl the application and get an HTTP response.</p><p>But Chrome on Windows?</p><p>Connection refused.</p><p>Of course. 😂</p><p>The important detail was that MicroK8s was running inside WSL2.</p><p>localhost from my Linux environment and localhost from Windows were not giving me the same path into the application.</p><p>I grabbed the WSL2 IP address and accessed WordPress using:</p><pre>WSL2-IP:31964</pre><p>And there it was.</p><p>The WordPress installation screen. 🎉</p><h3>😈 Time to Break Something on Purpose</h3><p>Getting the application working wasn’t enough.</p><p>I wanted to know whether the persistent storage was actually doing its job.</p><p>So I created a WordPress post called:</p><pre>Kubernetes Persistence Test</pre><p>And inside it:</p><pre>“If you can read this after I kill the MySQL Pod, the PVC did its job. 😈”</pre><p>Then I deleted the MySQL Pod.</p><p>Kubernetes immediately noticed that the Deployment wanted one MySQL replica but now had zero.</p><p>So it created another one.</p><p>New Pod name.</p><p>New Pod.</p><p>Same database.</p><p>I refreshed WordPress.</p><p>My post was still there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XKSKJnywv50dE-vWxR6x2Q.png" /></figure><p>That experiment gave me one of my favorite takeaways from this project:</p><p>The Pod didn’t survive.</p><p>The data did.</p><p>The Deployment restored the compute.</p><p>The PersistentVolumeClaim preserved the state.</p><p>That distinction is incredibly important when working with stateful applications.</p><h3>❤️ Running Does NOT Mean Ready</h3><p>Next, I wanted better health management.</p><p>I added three probes to MySQL:</p><pre>🚦 Startup probe<br>✅ Readiness probe<br>❤️ Liveness probe</pre><p>The startup probe gives MySQL time to initialize.</p><p>The readiness probe determines whether the Pod should receive traffic.</p><p>The liveness probe determines whether Kubernetes should restart the container if it becomes unhealthy.</p><p>Then I applied the updated Deployment.</p><p>A new MySQL Pod appeared.</p><p>Its status?</p><p>Running.</p><p>Its readiness?</p><p>0/1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*2d-e897xoAW-VJvukLjsjQ.png" /></figure><p>That was a fantastic visual lesson.</p><p>Running does not mean Ready.</p><p>The container had started, but Kubernetes did not consider the application healthy enough to receive traffic.</p><p>At first, I thought I knew what was wrong.</p><h3>🤔 Maybe My Probes Were Too Aggressive?</h3><p>My first suspicion was probe timing.</p><p>Maybe MySQL simply needed more time to initialize before Kubernetes started checking it.</p><p>That seemed reasonable.</p><p>So I added a startup probe that could give MySQL roughly two minutes to initialize before the readiness and liveness probes took over.</p><p>Problem solved?</p><p>Nope. 😂</p><p>The new MySQL Pod still wasn’t becoming healthy.</p><p>This is where the project stopped being a deployment exercise and became a troubleshooting exercise.</p><h3>🔎 Follow the Evidence</h3><p>Instead of continuing to change settings, I started gathering information.</p><p>I checked the Pods.</p><p>I described the failing Pod.</p><p>I reviewed Kubernetes events.</p><p>I checked the MySQL logs.</p><p>And there it was:</p><pre>[InnoDB] Unable to lock ./ibdata1 error: 11</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*-KNx4s4F0iFWhvqhp3gKoA.png" /></figure><p>Well, hello there. 👀</p><p>This wasn’t simply a probe problem.</p><p>The probe was reporting the symptom.</p><p>The actual failure was happening inside MySQL.</p><h3>💥 The Real Problem: Two MySQL Pods, One Database</h3><p>Kubernetes Deployments use a RollingUpdate strategy by default.</p><p>For a typical stateless application, that’s great.</p><p>Kubernetes can start a replacement Pod before removing the old one, helping keep the application available during an update.</p><p>But MySQL wasn’t stateless.</p><p>Both MySQL Pods were trying to work with the same persistent database files.</p><p>The PersistentVolumeClaim used ReadWriteOnce.</p><p>Something important clicked here too:</p><p>ReadWriteOnce doesn’t necessarily mean “only one Pod can ever touch this.”</p><p>It means the volume can be mounted read-write by a single node.</p><p>This was a single-node MicroK8s cluster.</p><p>Both Pods were on the same node.</p><p>The storage could be mounted.</p><p>MySQL itself was the one saying:</p><p>Absolutely not. 😂</p><p>The existing MySQL process already had the InnoDB files locked.</p><p>The replacement MySQL process couldn’t acquire the same lock.</p><p>So it failed.</p><p>And suddenly the whole sequence made sense:</p><pre>0/1 Ready<br>⬇️<br>Probe failures<br>⬇️<br>Container restarts<br>⬇️<br>MySQL logs<br>⬇️<br>ibdata1 lock<br>⬇️<br>Two overlapping MySQL Pods<br>⬇️<br>Shared database files</pre><h3>🛠️ Fixing the Deployment Strategy</h3><p>For this lab, I didn’t need a highly available production database cluster.</p><p>I needed one MySQL instance using one persistent data directory.</p><p>So instead of the default RollingUpdate behavior, I changed the MySQL Deployment strategy to:</p><p>Recreate</p><p>That tells Kubernetes to terminate the existing Pod before creating its replacement.</p><p>No overlap.</p><p>No two MySQL processes fighting over the same database files.</p><p>There is a tradeoff.</p><p>The database experiences brief downtime during an update.</p><p>For this local learning environment, that was completely acceptable.</p><p>For production, I would use a more appropriate architecture, such as a managed database service, database replication, or a Kubernetes architecture specifically designed for stateful workloads.</p><h3>🎉 And MySQL Came Back</h3><p>After changing the Deployment strategy, I watched the rollout.</p><p>MySQL moved through its startup process.</p><p>Then:</p><p>Running 0/1</p><p>And finally:</p><p>Running 1/1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*I5Kmu8H5Vcmv5OEk0gZdAg.png" /></figure><p>The Deployment successfully rolled out.</p><p>Kubernetes registered the new MySQL Pod as the Service endpoint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*Yk-98FzwExJwa1IQvIRfBg.png" /></figure><p>And then came the test I really cared about.</p><p>I opened WordPress again.</p><p>My persistence-test post was still there.</p><p>After deleting the original database Pod…</p><p>After creating replacement Pods…</p><p>After probe failures…</p><p>After CrashLoopBackOff…</p><p>After discovering the InnoDB lock…</p><p>After changing the Deployment strategy…</p><p>My data was still there.</p><p>Now THAT was satisfying. 😁</p><h3>🔐 One More Test Before GitHub</h3><p>Before publishing the project, there was one more thing I wanted to verify.</p><p>Secrets.</p><p>My real mysql-secret.yaml contained credentials used by my local application.</p><p>That file did not belong in GitHub.</p><p>So I added it to .gitignore and created:</p><pre>mysql-secret.example.yaml</pre><p>The example contains placeholders that show how the Secret should be structured without exposing the actual values.</p><p>Before committing anything, I explicitly checked that Git was ignoring the real Secret.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*OL3u1bk0fhHJheSQTBVX5A.png" /></figure><p>Only after confirming that did I stage the project.</p><p>This is a small step, but it’s one I want to keep building into my normal workflow:</p><p>Check what you’re actually about to publish.</p><h3>🧪 Validate Before You Celebrate</h3><p>I also ran client-side dry-run validation against the publishable Kubernetes manifests before committing them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*LT_pfqqph1uYgXh9b4ggLg.png" /></figure><p>Everything passed.</p><p>Then I performed one final look at the Kubernetes environment.</p><pre>WordPress: healthy. ✅<br><br>MySQL: healthy. ✅<br><br>Services: working. ✅<br><br>PVC: Bound. ✅<br><br>ConfigMap: present. ✅<br><br>Persistent data: still there. ✅</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*NCx_SOvJheFs0DG6d1tegQ.png" /></figure><p>At that point, I was finally willing to stop touching it.</p><p>Mostly. 😂</p><h3>🐳 Docker Swarm vs Kubernetes</h3><p>One reason I wanted to build this particular project was because I had already deployed WordPress and MySQL using Docker Swarm.</p><p>That gave me something familiar to compare against.</p><p>Swarm felt more abstracted.</p><p>Kubernetes made more of the individual orchestration pieces visible.</p><p>With Kubernetes, I was explicitly working with:</p><pre>Deployments<br><br>ReplicaSets<br><br>Pods<br><br>Services<br><br>Selectors<br>DNS<br><br>ConfigMaps<br><br>Secrets<br><br>PersistentVolumeClaims<br><br>StorageClasses<br><br>Health probes</pre><p>At first, that can feel like Kubernetes is making everything more complicated.</p><p>But during this project, I started appreciating why those pieces exist.</p><p>They gave me much more visibility into what Kubernetes was doing and much more control over workload behavior.</p><p>And when something broke, those individual pieces gave me places to investigate.</p><h3>🧠 The Biggest Lesson Wasn’t Kubernetes YAML</h3><p>Yes, I learned more Kubernetes.</p><p>I understand Services better.</p><p>DNS makes more sense.</p><p>Persistent storage makes more sense.</p><p>Health probes make MUCH more sense now.</p><p>And I definitely understand why blindly using RollingUpdate for a single-instance MySQL database backed by shared persistent files can be a problem. 😂</p><p>But my favorite lesson from this project was troubleshooting.</p><p>My first theory was reasonable:</p><p>“The probes are probably too aggressive.”</p><p>But reasonable isn’t the same thing as correct.</p><p>The actual path looked more like this:</p><pre>0/1 Ready<br>⬇️<br>Probe failures<br>⬇️<br>Check events<br>⬇️<br>Check logs<br>⬇️<br>Find ibdata1 lock<br>⬇️<br>Ask WHY the file is locked<br>⬇️<br>Notice overlapping MySQL Pods<br>⬇️<br>Understand RollingUpdate behavior<br>⬇️<br>Change the strategy<br>⬇️<br>Validate recovery</pre><p>The probe wasn’t the problem.</p><p>It was telling me there was a problem.</p><p>That’s an important distinction.</p><h3>🏗️ What I’d Change for Production</h3><p>This was intentionally a local learning environment, not a production architecture.</p><p>If I were designing the next version for production, I’d start thinking about:</p><pre>🌐 Ingress or a cloud LoadBalancer instead of exposing NodePort directly<br><br>🔒 TLS and DNS<br><br>☁️ A managed database service such as Amazon RDS, or an appropriately designed stateful Kubernetes database architecture<br><br>💾 Production-grade persistent storage<br><br>🔑 External secret management<br><br>📊 Monitoring and alerting<br><br>📏 Resource requests and limits<br><br>🛡️ NetworkPolicies<br><br>💿 Database backups and restore testing<br><br>🚀 CI/CD-based deployment<br><br>🖥️ Multiple worker nodes for workload availability</pre><p>There is always another layer to learn.</p><p>Which is probably why I keep finding more projects to build. 😂</p><h3>💚 From “What Is a Pod?” to Troubleshooting MySQL on Kubernetes</h3><p>This project felt like a noticeable step forward for me.</p><p>Not because it was the biggest environment I’ve built.</p><p>Not because it used the most services.</p><p>But because I wasn’t just following a path where everything worked.</p><p>I had to understand what Kubernetes was doing well enough to figure out why it wasn’t doing what I expected.</p><pre>I built it.<br><br>I tested it.<br><br>I broke it.<br><br>I blamed the probes. 😂<br><br>I checked the evidence.<br><br>I found the real problem.<br><br>I fixed it.</pre><p>And then I understood Kubernetes a little better than I did when I started.</p><p>That’s exactly what I want these projects to do.</p><h3>☸️ What’s Next?</h3><p>I’m still building my Cloud and DevOps skills one project at a time, and Kubernetes is officially staying in the toolbox.</p><p>This project connected a lot of concepts that previously lived in separate boxes in my head.</p><p>Services weren’t just definitions anymore.</p><p>PersistentVolumes weren’t just storage vocabulary.</p><p>Health probes weren’t just YAML fields.</p><p>Desired state wasn’t just a Kubernetes phrase.</p><p>I watched all of them interact inside one application.</p><p>And occasionally fight with each other. 😈</p><p>That made the lesson stick.</p><p><strong>GitHub:</strong><br> <a href="https://github.com/mandyreed223/kubernetes-multitier-application?utm_source=chatgpt.com">https://github.com/mandyreed223/kubernetes-multitier-application</a></p><p>If you’re learning Kubernetes too, I’d love to hear about the first problem that made everything suddenly click for you. ☸️💚</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=05a6370e0926" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes Said “Desired State.” I Said “Prove It.” ☸️]]></title>
            <link>https://medium.com/@mandymreed/kubernetes-said-desired-state-i-said-prove-it-%EF%B8%8F-e8fbe1469ec3?source=rss-8e7c70fd4f14------2</link>
            <guid isPermaLink="false">https://medium.com/p/e8fbe1469ec3</guid>
            <dc:creator><![CDATA[Mandy Reed]]></dc:creator>
            <pubDate>Sun, 27 Sep 2026 20:23:52 GMT</pubDate>
            <atom:updated>2026-09-27T20:23:52.571Z</atom:updated>
            <content:encoded><![CDATA[<p><em>So I scaled Pods, deleted them, changed images, broke a selector, and watched Kubernetes put everything back together.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sHTsi55cpDroNkRJnQJ5Iw.png" /><figcaption>Image created using ChatGPT</figcaption></figure><p>I’ve spent a lot of time lately working with containers.</p><p>Docker taught me how to build them.</p><p>Docker Swarm taught me how to orchestrate them.</p><p>I built services. I scaled replicas. I killed containers just to see what would happen. I even put WordPress and MySQL on a Swarm and added persistent storage.</p><p>So naturally, there was another name sitting on my learning roadmap staring at me:</p><p>☸️ <strong>Kubernetes.</strong></p><p>I could have jumped straight into Amazon EKS.</p><p>But I didn’t want AWS doing all the interesting stuff behind the scenes before I understood what the interesting stuff actually was.</p><p>I wanted to understand Kubernetes first.</p><p>And apparently my preferred learning method continues to be:</p><p>👉 Build it.<br>👉 Make sure it works.<br>👉 Mess with it.<br>👉 See what breaks.<br>👉 Figure out why.<br>👉 Fix it.<br>👉 Document everything. 😂</p><p>So I installed MicroK8s locally using Ubuntu on WSL2 and started with the smallest possible thing.</p><p>One lonely nginx Pod.</p><p>It did not stay lonely for long.</p><h3>☸️ First Things First: What Exactly Am I Managing?</h3><p>One of the first things Kubernetes forced me to straighten out was the terminology.</p><p>Coming from Docker, my brain naturally wanted to think:</p><p><strong>Container = application</strong></p><p>Kubernetes adds another layer.</p><p>The basic relationship is:</p><p><strong>Node → Pod → Container</strong></p><p>A Pod is the smallest deployable unit Kubernetes manages, and one or more containers can live inside that Pod.</p><p>So I started simple:</p><p>microk8s kubectl run nginx-pod --image=nginx</p><p>Then:</p><p>microk8s kubectl get pods</p><p>And there it was.</p><p>🎉 My first Kubernetes Pod.</p><p>Nothing particularly dramatic had happened yet.</p><p>Clearly, that needed to change.</p><h3>💀 So…What Happens If I Delete It?</h3><p>This was my first real test.</p><p>I had created a standalone Pod.</p><p>What would Kubernetes do if I deleted it?</p><p>My prediction was:</p><p><strong>Nothing.</strong></p><p>There was no Deployment or ReplicaSet telling Kubernetes that this Pod needed to exist.</p><p>So I deleted it.</p><p>microk8s kubectl delete pod nginx-pod</p><p>Then checked:</p><p>microk8s kubectl get pods</p><p>And…</p><p>Nothing.</p><p>The Pod was gone.</p><p>💀 RIP little nginx Pod.</p><p>That was actually important.</p><p>Kubernetes isn’t magically recreating everything that disappears.</p><p>Something has to define the <strong>desired state</strong>.</p><p>And that’s where things started getting much more interesting.</p><h3>🚀 Enter the Deployment</h3><p>Instead of creating another standalone Pod, I created a Deployment:</p><p>microk8s kubectl create deployment nginx-deployment --image=nginx</p><p>Then I started looking at what Kubernetes had actually created.</p><p>microk8s kubectl get deployments</p><p>microk8s kubectl get replicasets</p><p>microk8s kubectl get pods</p><p>Now I had a hierarchy:</p><p>☸️ <strong>Deployment</strong><br> ⬇️<br> 🔁 <strong>ReplicaSet</strong><br> ⬇️<br> 📦 <strong>Pod</strong><br> ⬇️<br> 🐳 <strong>Container</strong></p><p>This was one of the first Kubernetes concepts that really clicked for me.</p><p>The Deployment manages how I want the application deployed and handles changes over time.</p><p>The ReplicaSet makes sure the desired number of matching Pods exists.</p><p>The Pods run the actual containers.</p><p>Okay.</p><p>Now that I had something responsible for maintaining state…</p><p>It was time to make it prove it.</p><h3>📈 One Pod Is Nice. How About Three?</h3><p>I scaled the Deployment:</p><p>microk8s kubectl scale deployment nginx-deployment --replicas=3</p><p>Then checked the ReplicaSet.</p><p>It reported:</p><p>✅ Desired: 3<br> ✅ Current: 3<br> ✅ Ready: 3</p><p>Now I had three nginx Pods.</p><p>They shared part of their names because they belonged to the same ReplicaSet, but each Pod had its own unique suffix.</p><p>And that gave me an idea.</p><p>You probably know where this is going. 😂</p><h3>🔥 Delete a Pod. I Dare You.</h3><p>I manually deleted one of my three running Pods.</p><p>At that moment:</p><p><strong>Desired state:</strong> 3 Pods<br> <strong>Actual state:</strong> 2 Pods</p><p>Kubernetes had a problem.</p><p>The ReplicaSet noticed the difference.</p><p>And almost immediately, a new Pod appeared.</p><p>I actually caught it during startup:</p><p><strong>0/1 ContainerCreating</strong></p><p>And a few seconds later:</p><p><strong>1/1 Running</strong></p><p>Back to three.</p><p>There it was.</p><p>✨ <strong>Reconciliation.</strong></p><p>The ReplicaSet wasn’t emotionally attached to the Pod I murdered.</p><p>It didn’t care about its name.</p><p>It cared about this:</p><p><strong>I was told there should be three Pods. There are only two. Make another one.</strong></p><p>And honestly?</p><p>That might have been the moment Kubernetes started making sense.</p><p>The important thing isn’t preserving an individual Pod.</p><p>The important thing is preserving the <strong>desired state of the application</strong>.</p><h3>🏷️ Then Came Labels</h3><p>Once I had multiple Pods running, I looked at their labels:</p><p>microk8s kubectl get pods --show-labels</p><p>This introduced another piece of the puzzle.</p><p>Kubernetes resources don’t have to memorize the names of individual Pods.</p><p>They can find them using labels.</p><p>Something like:</p><p><strong>app=nginx</strong></p><p>can essentially say:</p><p>👉 These Pods belong to this application.</p><p>That becomes especially useful when the Pod names and IP addresses can change at any time.</p><p>Which brings us to networking.</p><h3>🌐 A Stable Front Door for Disposable Pods</h3><p>Pods are replaceable.</p><p>Their IP addresses can change.</p><p>That’s great for self-healing.</p><p>It’s not so great if another application is trying to communicate with them.</p><p>So I created a Kubernetes Service:</p><p>microk8s kubectl expose deployment nginx-deployment --port=80 --type=ClusterIP</p><p>Now I had a stable ClusterIP in front of my Pods.</p><p>The relationship started looking like this:</p><p>🌐 <strong>Service</strong><br> ⬇️<br> 🔗 <strong>EndpointSlice</strong><br> ⬇️<br> 📦 Pod<br> 📦 Pod<br> 📦 Pod</p><p>The Service uses labels to find the appropriate Pods.</p><p>I checked the EndpointSlice and could see the three Pod IP addresses sitting behind the Service.</p><p>Then came the test that actually matters.</p><p>Not:</p><p>“Does Kubernetes say everything is running?”</p><p>But:</p><p><strong>Can I actually reach the application?</strong></p><p>I ran:</p><p>curl http://&lt;service-cluster-ip&gt;</p><p>And nginx answered.</p><p>🎉 <strong>Welcome to nginx!</strong></p><p>Running is nice.</p><p>Reachable is better.</p><h3>🔄 Okay Kubernetes, Let’s Change Something While It’s Running</h3><p>Next I wanted to see how Kubernetes handled an application update.</p><p>My Deployment was running three nginx Pods.</p><p>I changed the image to:</p><p><strong>nginx:1.28</strong></p><p>using:</p><p>microk8s kubectl set image deployment/nginx-deployment nginx=nginx:1.28</p><p>And then I watched.</p><p>This was probably my favorite part of the entire lab.</p><p>Instead of killing all three existing Pods and then starting three new ones, Kubernetes began performing a <strong>rolling update</strong>.</p><p>A new ReplicaSet appeared.</p><p>New Pods started coming online.</p><p>Old Pods remained available.</p><p>Then Kubernetes gradually shifted from the old ReplicaSet to the new one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*_PQijeF9EJkD2Xa2jEjqkg.png" /><figcaption><em>Caught Kubernetes in the act: new Pods coming online while the old ReplicaSet was still serving the application.</em></figcaption></figure><p>This was no longer just:</p><p>“Cool, Kubernetes updated nginx.”</p><p>I could actually see the controller behavior happening.</p><p>The Deployment was managing the transition between application revisions.</p><p>The ReplicaSets were managing the Pods belonging to those revisions.</p><p>That distinction suddenly became much clearer.</p><h3>🔎 Kubernetes Left Receipts</h3><p>After the rollout finished, I verified that the Deployment was running nginx 1.28.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*7hsYVX2YE11X2KxVyxiBoA.png" /><figcaption><em>Rollout complete: three replicas running the updated nginx 1.28 image.</em></figcaption></figure><p>Then I ran:</p><p>microk8s kubectl describe deployment nginx-deployment</p><p>And Kubernetes basically handed me the play-by-play.</p><p>The Deployment events showed the new ReplicaSet scaling up while the old ReplicaSet scaled down.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NrkWkBXUu0TteVEAsl53gg.png" /><figcaption><em>The Deployment events showed exactly how Kubernetes moved from the old ReplicaSet to the new one.</em></figcaption></figure><p>That was a great troubleshooting lesson too.</p><p>kubectl get tells me <strong>what things look like now</strong>.</p><p>kubectl describe can help tell me <strong>what Kubernetes has been doing and why</strong>.</p><p>That is exactly the kind of information I want when something isn’t behaving the way I expect.</p><h3>🌐 Meanwhile, the Service Didn’t Care</h3><p>Here’s where another concept really clicked.</p><p>The rolling update replaced my Pods.</p><p>That meant the backend Pod IP addresses changed.</p><p>I checked the EndpointSlice again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*0Uo-_ISChUwZdcZOrSx28A.png" /><figcaption><em>New Pods, new backend IP addresses. The Service endpoint stayed the same.</em></figcaption></figure><p>Then I hit the same Service again:</p><p>curl http://&lt;service-cluster-ip&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*pBU5lPFrcihoeKJY7pzwsQ.png" /><figcaption><em>Different Pods behind the scenes. Same stable Service. nginx still answering.</em></figcaption></figure><p>And nginx was still there.</p><p>That gave me a much clearer mental model:</p><p>📦 Pods can disappear.</p><p>🔢 Pod IPs can change.</p><p>🔁 ReplicaSets can change.</p><p>🌐 The Service gives the application a stable network endpoint.</p><p>That’s the abstraction.</p><p>Clients don’t need to chase individual Pods around the cluster.</p><h3>📄 Then I Took Away My Own Commands</h3><p>Up until this point, I had deliberately used commands to build and manipulate the environment.</p><p>Create this.</p><p>Scale that.</p><p>Expose this.</p><p>Change the image.</p><p>That was useful while learning what each Kubernetes object actually did.</p><p>But I didn’t want the finished project to depend on me remembering a pile of commands.</p><p>So it was time for YAML.</p><p>I created:</p><p>📄 deployment.yaml</p><p>📄 service.yaml</p><p>My Deployment now declared the state I wanted:</p><p>• Three replicas<br>• nginx 1.28<br>• Container port 80<br>• Pods labeled app: nginx</p><p>And my Service declared:</p><p>• ClusterIP<br>• Port 80<br>• Target port 80<br>• Selector app: nginx</p><p>The connection between them wasn’t based on a Pod name.</p><p>It was based on:</p><p><strong>app: nginx</strong></p><p>And this became one of my favorite little Kubernetes lightbulb moments.</p><p>The Deployment selector matches the Pod labels.</p><p>The Service selector also matches the Pod labels.</p><p>So:</p><p>☸️ Deployment<br>⬇️<br>🏷️ app: nginx<br>⬆️<br>🌐 Service</p><p>Those labels are doing a lot more work than they first appear to be doing.</p><h3>😈 And Then My YAML Broke</h3><p>Of course it did.</p><p>It wouldn’t be one of my projects otherwise. 😂</p><p>Before applying my new YAML, I did something I’m very glad I did:</p><p>microk8s kubectl apply --dry-run=server -f deployment.yaml</p><p>Instead of immediately changing the environment, I asked the Kubernetes API server to validate what I was trying to do.</p><p>And Kubernetes said:</p><p>Nope.</p><p><strong>field is immutable</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R56PvHX8_oHvRqM2Ck56nA.png" /><figcaption><em>And there it is. The part where the lab becomes more interesting. 😂</em></figcaption></figure><p>What happened?</p><p>My original Deployment had been created imperatively and used a selector based on:</p><p><strong>app=nginx-deployment</strong></p><p>My new YAML used:</p><p><strong>app=nginx</strong></p><p>The selector determines which Pods belong to the Deployment.</p><p>And Kubernetes does not allow me to casually change that selector on an existing Deployment.</p><p>At first glance, this looked like:</p><p>“Something is wrong with my YAML.”</p><p>But that wasn’t really the problem.</p><p>The YAML described a valid Deployment.</p><p>It conflicted with an <strong>immutable property of the resource that already existed</strong>.</p><p>That distinction matters.</p><p>And this is exactly why I like testing and troubleshooting these projects instead of stopping the second I get a successful deployment.</p><h3>🧪 Dry Run for the Win</h3><p>My Service YAML passed server-side validation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*GUBAevJ0BFY0Be9cIP-PCw.png" /><figcaption><em>Service YAML passed validation without changing the live environment.</em></figcaption></figure><p>So instead of trying to force my new configuration onto the old learning environment, I cleaned up the resources I’d created manually.</p><p>Then I rebuilt everything from the YAML.</p><p>This time:</p><p>microk8s kubectl apply -f deployment.yaml</p><p>microk8s kubectl apply -f service.yaml</p><p>And…</p><p>🎉 Deployment created.</p><p>🎉 ReplicaSet created.</p><p>🎉 Three Pods created.</p><p>🎉 Service created.</p><p>All from declarative configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*vPIAEbCFZuyqHWSEQ0KUSQ.png" /><figcaption><em>The application rebuilt from YAML: Deployment, ReplicaSet, three Pods, and the Service.</em></figcaption></figure><p>That felt different from simply typing commands until I had three Pods running.</p><p>Now I had files that described what the environment was supposed to look like.</p><h3>🧪 But Does the YAML-Built Version Actually Work?</h3><p>You already know my answer to this one.</p><p>Seeing:</p><p><strong>Running</strong></p><p>is not enough. 😂</p><p>I checked the EndpointSlice.</p><p>Then I curled the Service again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*H0SIVoR5ckVJTcGoTHCFmw.png" /><figcaption><em>Declaratively rebuilt and validated end-to-end through the Service.</em></figcaption></figure><p>There were my three Pod endpoints.</p><p>And there was nginx responding through the Service.</p><p>Now I knew the whole path worked:</p><p>📄 YAML<br> ⬇️<br> ☸️ Deployment<br> ⬇️<br> 🔁 ReplicaSet<br> ⬇️<br> 📦 Pods<br> ⬇️<br> 🏷️ Labels<br> ⬇️<br> 🌐 Service<br> ⬇️<br> 🔗 EndpointSlice<br> ⬇️<br> 🐳 nginx<br> ⬇️<br> ✅ HTTP response</p><p>That is much more satisfying than “kubectl said Running.”</p><h3>📉 Time for Kubernetes to Prove Desired State One More Time</h3><p>Now that YAML controlled the environment, I wanted to test something else.</p><p>My Deployment said:</p><p><strong>replicas: 3</strong></p><p>I changed it to:</p><p><strong>replicas: 2</strong></p><p>Then ran:</p><p>microk8s kubectl apply -f deployment.yaml</p><p>I didn’t delete a Pod.</p><p>I didn’t tell Kubernetes which Pod to remove.</p><p>I didn’t manually scale the Deployment.</p><p>I simply changed the desired state.</p><p>Kubernetes handled the rest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*y7UrDNfW4CoVrkD7a1olNg.png" /><figcaption><em>Changed one number in YAML. Kubernetes reconciled three running Pods down to two.</em></figcaption></figure><p>Then I changed it back to:</p><p><strong>replicas: 3</strong></p><p>Applied the file again…</p><p>And a new Pod appeared.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*UdJpVBcWB6oFsmABjVp-8Q.png" /><figcaption><em>Back to three. Notice the newest Pod is only a few seconds old while the other two stayed running.</em></figcaption></figure><p>And there was the entire lesson again:</p><p><strong>Desired: 3</strong></p><p><strong>Actual: 2</strong></p><p>Kubernetes:</p><p><em>Fine. I’ll make another one.</em> 😂</p><h3>🧠 Imperative vs. Declarative Finally Clicked</h3><p>This lab also helped me better understand something that comes up constantly in DevOps.</p><p>There is a big difference between saying:</p><p>👉 “Scale this Deployment to three Pods.”</p><p>and saying:</p><p>👉 “This application should have three Pods.”</p><p>The first is an action.</p><p>The second is a declaration of state.</p><p>Imperatively, I could run:</p><p>kubectl scale deployment nginx-deployment --replicas=3</p><p>Declaratively, my YAML says:</p><p><strong>replicas: 3</strong></p><p>Then:</p><p>kubectl apply -f deployment.yaml</p><p>Kubernetes figures out what needs to change.</p><p>That felt very familiar after working with Terraform.</p><p>The syntax and platforms are different, but the mindset has similarities:</p><p>💚 Describe what you want.</p><p>🔍 Compare it with what exists.</p><p>🔧 Determine what needs to change.</p><p>♻️ Reconcile reality with the desired state.</p><h3>🔎 My Troubleshooting Brain Likes Kubernetes</h3><p>One of the things I’ve been deliberately working on in my cloud and DevOps projects is understanding the <strong>whole path</strong> instead of memorizing isolated commands.</p><p>Kubernetes gave me another set of layers and relationships to inspect:</p><p>🐳 <strong>Application</strong></p><p>⬇️</p><p>📦 <strong>Container</strong></p><p>⬇️</p><p>☸️ <strong>Pod</strong></p><p>⬇️</p><p>🔁 <strong>ReplicaSet</strong></p><p>⬇️</p><p>🚀 <strong>Deployment</strong></p><p>⬇️</p><p>🏷️ <strong>Labels and Selectors</strong></p><p>⬇️</p><p>🌐 <strong>Service</strong></p><p>⬇️</p><p>🔗 <strong>EndpointSlice</strong></p><p>⬇️</p><p>🌎 <strong>Network Path</strong></p><p>If nginx isn’t responding, “the Pod says Running” isn’t the end of the investigation.</p><p>Is the application actually listening?</p><p>Is the Pod healthy?</p><p>Does the Service selector match the Pod labels?</p><p>Did Kubernetes create endpoints?</p><p>Is the Service targeting the correct port?</p><p>Can I curl the Service?</p><p>Where does the path stop working?</p><p>That part of Kubernetes feels very familiar.</p><p>Different technology.</p><p>Same question:</p><p>🔎 <strong>Where exactly did the expected behavior stop?</strong></p><h3>💡 What Actually Stuck With Me</h3><p>By the end of the lab, Kubernetes didn’t feel nearly as mysterious as it did at the beginning.</p><p>A few things especially stuck.</p><p>☸️ <strong>Deployments manage how I want the application deployed and how changes roll out.</strong></p><p>🔁 <strong>ReplicaSets make sure the desired number of matching Pods exists.</strong></p><p>📦 <strong>Pods are disposable.</strong></p><p>🏷️ <strong>Labels and selectors connect resources without depending on specific Pod names.</strong></p><p>🌐 <strong>Services provide stable networking while the Pods behind them change.</strong></p><p>🔗 <strong>EndpointSlices show which Pod endpoints are actually backing the Service.</strong></p><p>📄 <strong>YAML lets me declare what the environment should look like instead of manually recreating it.</strong></p><p>♻️ <strong>Reconciliation is the magic sauce.</strong></p><p>And maybe my favorite lesson:</p><p><strong>Running doesn’t automatically mean reachable. Test the actual path.</strong></p><h3>🐳 Docker Swarm Definitely Helped</h3><p>I also realized how much my previous Docker work helped prepare me for this.</p><p>Docker taught me containers.</p><p>Docker Swarm introduced me to:</p><p>🐳 Services<br>📦 Replicas<br>♻️ Self-healing<br>📈 Scaling<br>🔄 Rescheduling<br>🎯 Desired state</p><p>Kubernetes didn’t make those ideas disappear.</p><p>It gave me a new set of abstractions around them:</p><p><strong>Deployment → ReplicaSet → Pod → Container</strong></p><p>That made Kubernetes feel less like:</p><p>“Here’s an entirely new universe. Good luck.”</p><p>And more like:</p><p>“Okay…I know some of these ideas. Now let’s learn how Kubernetes implements them.”</p><p>That was a much easier bridge to cross.</p><h3>☸️ So…Did Kubernetes Prove It?</h3><p>I’d say yes. 😂</p><p>I gave it Pods.</p><p>I scaled them.</p><p>I deleted one.</p><p>It replaced it.</p><p>I changed the application image.</p><p>It rolled out the new version without simply dropping everything at once.</p><p>I changed the backend Pods.</p><p>The Service kept working.</p><p>I broke a selector.</p><p>Kubernetes told me exactly why it wasn’t going to accept that.</p><p>I rebuilt the application from YAML.</p><p>Then I changed the desired state from three Pods to two and back to three.</p><p>And Kubernetes kept doing exactly what I was finally beginning to understand it was designed to do:</p><p><strong>Make actual state match desired state.</strong></p><p>My biggest takeaway?</p><p>💚 <strong>With Kubernetes, I’m not trying to protect individual Pods. I’m defining the application state I want, and Kubernetes continuously works to keep the environment there.</strong></p><p>And yes…</p><p>I fully intend to keep breaking things until I understand the next layer too. 😈☸️</p><h3>🚀 What’s Next?</h3><p>This was intentionally a Kubernetes fundamentals project.</p><p>No EKS yet.</p><p>No Helm yet.</p><p>No giant production cluster pretending I know things I haven’t learned yet. 😂</p><p>Next, I want to build on this foundation with things like:</p><p>🔹 ConfigMaps<br>🔹 Secrets<br>🔹 Liveness and readiness probes<br>🔹 Resource requests and limits<br>🔹 Persistent storage<br>🔹 Ingress<br>🔹 Helm<br>🔹 Monitoring and observability<br>🔹 Eventually, Amazon EKS</p><p>But now when those pieces show up, they have somewhere to attach in my brain.</p><p>And that was the whole point.</p><p><a href="https://github.com/mandyreed223/kubernetes-fundamentals">☸️ Kubernetes Fundamentals — View on GitHub</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8fbe1469ec3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Put WordPress on Docker Swarm. Then Things Got Real. ]]></title>
            <link>https://medium.com/@mandymreed/i-put-wordpress-on-docker-swarm-then-things-got-real-438cbb166861?source=rss-8e7c70fd4f14------2</link>
            <guid isPermaLink="false">https://medium.com/p/438cbb166861</guid>
            <dc:creator><![CDATA[Mandy Reed]]></dc:creator>
            <pubDate>Sun, 13 Sep 2026 23:19:59 GMT</pubDate>
            <atom:updated>2026-09-13T23:19:59.950Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Three EC2 servers. One WordPress site. A Docker Swarm. A few failures. Amazon EFS. And a monkey that refused to stay gone.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MC8_sIJqUPsse2XpmCAaSQ.png" /><figcaption>Image created using ChatGPT</figcaption></figure><p>I thought I knew what this project was going to be.</p><p>Build a Docker Swarm.</p><p>Deploy WordPress.</p><p>Add MySQL.</p><p>Scale WordPress across multiple nodes.</p><p>Learn some things.</p><p>Call it a day.</p><p>Cute. Simple. Very optimistic of me. 😂</p><p>Instead, I ended up troubleshooting Swarm networking, watching one of my workers repeatedly decide she was done participating, learning firsthand why container storage is ephemeral, adding Amazon EFS, killing containers on purpose, rebuilding the application from YAML, and using a monkey picture to prove that persistent storage actually worked.</p><p>So… slightly more eventful than planned.</p><p>And honestly?</p><p>That made it a much better project.</p><h3>🏗️ What I Wanted to Build</h3><p>My starting architecture was a three-node Docker Swarm running on AWS EC2:</p><p>☁️ 1 Swarm manager<br>☁️ 2 Swarm workers<br>🐳 3 WordPress replicas<br>🗄️ 1 MySQL service<br>🌐 Docker overlay networks<br>🔐 Docker Secrets<br>💾 Persistent MySQL storage<br>🚦 Docker Swarm routing mesh</p><p>The goal was to have WordPress distributed across the cluster while MySQL remained on a specific worker with persistent storage.</p><p>I wasn’t just trying to run a few containers.</p><p>I wanted to see what orchestration actually looked like when multiple machines, networking, storage, and application services all had to work together.</p><p>And initially?</p><p>Things were looking pretty good.</p><h3>🐳 Three Nodes, Three WordPress Replicas</h3><p>I created three Ubuntu EC2 instances:</p><p>swarm-manager</p><p>swarm-worker-1</p><p>swarm-worker-2</p><p>I initialized Docker Swarm on the manager, joined both workers, and eventually had WordPress running with three replicas distributed across the cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*JIaXqQrOFuRMpdm3RzUbjA.png" /></figure><p>Three nodes.</p><p>Three WordPress tasks.</p><p>One happy little Swarm.</p><p>What could possibly go wrong?</p><p>Please don’t answer that. 😂</p><h3>🌐 Containers Need Friends Too</h3><p>I created two Docker overlay networks:</p><p>frontend-net</p><p>backend-net</p><p>WordPress connected to both.</p><p>MySQL connected only to the backend network.</p><p>That meant WordPress could communicate with the database internally without me publishing MySQL’s port to the internet.</p><p>WordPress connected to:</p><p>mysql:3306</p><p>instead of a hardcoded container or EC2 IP address.</p><p>Docker Swarm’s internal service discovery could resolve the service called “mysql.”</p><p>That was one of those small moments where orchestration started making more sense to me.</p><p>A container can disappear.</p><p>A replacement container can get a completely different IP.</p><p>The service is the stable piece that the application can depend on.</p><h3>🔐 Passwords Do Not Belong in GitHub</h3><p>Next came database credentials.</p><p>I created Docker Secrets for:</p><p>mysql_root_password</p><p>wordpress_db_password</p><p>The containers could access those values through /run/secrets/ rather than having the actual passwords sitting in my stack file or GitHub repository.</p><p>MySQL could read its password from:</p><p>/run/secrets/mysql_root_password</p><p>and WordPress could read its database password from:</p><p>/run/secrets/wordpress_db_password</p><p>Much better.</p><p>🔒 Secrets belong in Secrets.</p><p>Revolutionary concept, I know. 😂</p><h3>🚧 And Then Swarm Networking Said Nope</h3><p>At one point, the cluster wasn’t behaving correctly.</p><p>The nodes existed.</p><p>The services existed.</p><p>But communication between them wasn’t working the way it should.</p><p>So I started troubleshooting.</p><p>Eventually, I found the problem in my AWS security group.</p><p>Docker Swarm needed TCP and UDP port:</p><p>7946</p><p>I had configured:</p><p>7947</p><p>🤦‍♀️</p><p>One number.</p><p>One tiny typo.</p><p>One very unhappy Swarm.</p><p>After correcting the security group rule, communication between the nodes and the overlay networking started behaving properly.</p><p>That was a great reminder that when something breaks in a cloud environment, staring at the application isn’t always going to find the problem.</p><p>The failure path could be anywhere:</p><p>Application → Container → Docker Service → Overlay Network → Linux Host → AWS Security Group → Network</p><p>Sometimes Docker is innocent. 😂</p><h3>🗄️ MySQL Needed Somewhere to Live</h3><p>MySQL obviously couldn’t lose the WordPress database every time its container restarted.</p><p>So I created a Docker volume called:</p><p>mysql-data</p><p>and mounted it at:</p><p>/var/lib/mysql</p><p>But this introduced something important.</p><p>That Docker volume was local to the node.</p><p>MySQL was running on Worker 1, and Worker 1 had the database volume.</p><p>If Swarm moved MySQL to another node, that new node wouldn’t magically have Worker 1’s local database files.</p><p>So I labeled Worker 1:</p><p>database=true</p><p>Then I added a placement constraint so MySQL would only run on the node with that label.</p><p>Worker 1 was officially the database worker.</p><p>This would later become important.</p><p>Very important.</p><p>Because Worker 1 had… opinions. 😂</p><h3>😴 Worker 1 Would Like to Take Another Break</h3><p>Worker 1 and I developed a special relationship during this project.</p><p>Mostly because Worker 1 repeatedly decided she was finished working.</p><p>She would go Down in Swarm.</p><p>I’d investigate.</p><p>I’d reboot her.</p><p>She’d come back.</p><p>We’d continue.</p><p>Then apparently her break time would roll around again. 😂</p><p>While troubleshooting, I checked things like:</p><p>free -h</p><p>docker stats</p><p>dmesg</p><p>docker node ls</p><p>systemctl status docker</p><p>These were small EC2 instances with around 1 GB of RAM, and MySQL alone could consume a significant portion of Worker 1’s memory.</p><p>There was also no swap configured.</p><p>Memory pressure was definitely suspicious.</p><p>But here’s something important I learned from that troubleshooting:</p><p>I never found definitive evidence of the Linux OOM killer taking down the workload.</p><p>So I couldn’t honestly say:</p><p>“MySQL definitely caused an out-of-memory failure.”</p><p>What I could say was:</p><p>“Worker 1 had very little memory headroom, and resource pressure was a plausible contributor, but I did not confirm an OOM event.”</p><p>That’s a lesson I want to carry into future troubleshooting.</p><p>🔎 Evidence first. Root cause second.</p><p>A theory doesn’t become a fact just because it sounds really convincing.</p><p>Although Worker 1 was definitely guilty of ruining my afternoon.</p><p>I’m comfortable making that accusation. 😂</p><h3>🐒 And Then There Was Monkey #1</h3><p>Once WordPress was working, I uploaded an image.</p><p>A monkey.</p><p>Because apparently the internationally recognized way to validate distributed infrastructure is with a cute monkey picture. 😂</p><p>The image appeared.</p><p>Success!</p><p>Except…</p><p>Not everywhere.</p><p>One WordPress container had the uploaded image.</p><p>Another didn’t.</p><p>Another didn’t.</p><p>And eventually, when the container containing the image disappeared…</p><p>So did the monkey.</p><p>🐒💀</p><p>This was the moment the project got REALLY interesting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*jqoEi9nW3DI59uX8fQEO0Q.png" /></figure><h3>🤔 Wait… Where Did My File Go?</h3><p>My WordPress replicas were storing uploaded media under:</p><p>/var/www/html/wp-content/uploads</p><p>The problem was that the directory existed inside each individual container.</p><p>So if WordPress Replica 1 handled my upload, the file existed there.</p><p>Replica 2 didn’t automatically receive it.</p><p>Replica 3 didn’t either.</p><p>Even worse, containers are supposed to be replaceable.</p><p>When the container containing the uploaded image disappeared, its local file disappeared too.</p><p>The WordPress database could still know the media existed.</p><p>The actual file?</p><p>Gone.</p><p>Monkey #1 had taught me an extremely useful lesson:</p><p>💡 Scaling an application is NOT the same thing as scaling its storage.</p><p>Three WordPress replicas weren’t really sharing the same application state if every replica had its own independent collection of uploaded files.</p><p>I needed shared storage.</p><h3>☁️ Enter Amazon EFS</h3><p>This is where Amazon Elastic File System joined the adventure.</p><p>I created an EFS filesystem that could be mounted by all three EC2 instances.</p><p>Each node mounted the filesystem at:</p><p>/mnt/efs</p><p>Then I created a shared directory for WordPress:</p><p>/mnt/efs/wordpress-uploads</p><p>Now, instead of every WordPress replica owning a completely separate uploads directory, they could all point to the same shared filesystem.</p><p>Before trusting it, though, I wanted proof.</p><p>I created a test file from one node.</p><p>Then I checked another node.</p><p>There it was.</p><p>Checked the third.</p><p>Still there.</p><p>🎉</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*GzVW-AmElFBvG3RwwnNwbw.png" /></figure><p>That was the moment I knew the EC2 instances were actually accessing the same shared filesystem.</p><h3>🔒 EFS Didn’t Need the Whole Internet Either</h3><p>EFS uses NFS on TCP port 2049.</p><p>I created a dedicated security group for EFS and allowed NFS access from the security group associated with my Swarm EC2 instances.</p><p>I did NOT open NFS to:</p><p>0.0.0.0/0</p><p>Nope. 😂</p><p>The relationship was essentially:</p><p>Swarm EC2 Security Group → TCP 2049 → EFS Security Group → Amazon EFS</p><p>Only the systems that actually needed access were allowed to communicate with the filesystem.</p><h3>🔄 Worker 1 Accidentally Taught Me Another Lesson</h3><p>Then Worker 1 took another break.</p><p>Of course she did.</p><p>After rebooting her, I realized my EFS mount had another weakness.</p><p>I had mounted it manually.</p><p>Because I had mounted EFS manually, the mount wasn’t configured to return automatically after a host reboot.</p><p>So I added the EFS filesystem to /etc/fstab on all three nodes and tested it with:</p><p>sudo mount -a</p><p>Then I verified the mount again.</p><p>Now the hosts had a way to restore the EFS mount after reboot instead of relying on me to remember a manual command.</p><p>So technically Worker 1 helped improve the architecture.</p><p>I don’t intend to tell her that. 😂</p><h3>🐒 Monkey #2 Has Entered the Chat</h3><p>Now it was time for another highly scientific test.</p><p>I changed WordPress so:</p><p>/var/www/html/wp-content/uploads</p><p>was backed by:</p><p>/mnt/efs/wordpress-uploads</p><p>Then I uploaded another monkey.</p><p>🐒</p><p>The image appeared in WordPress.</p><p>I checked EFS.</p><p>There it was.</p><p>WordPress had even generated its different thumbnail sizes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*l2GoL9tRR6KwepZUTy2nTg.png" /></figure><p>Then I accessed the WordPress site through another Swarm node.</p><p>Still there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vtdXGN9FGMWrjv-holzx3w.png" /></figure><p>Monkey #2 was already doing much better than Monkey #1.</p><p>But simply seeing the image wasn’t enough.</p><p>We needed violence.</p><p>😂</p><h3>💀 Let’s Kill a Container</h3><p>This is probably becoming a theme in my projects.</p><p>Once something works, apparently my next question is:</p><p>“What happens if I kill it?”</p><p>So I intentionally killed one of the running WordPress containers.</p><p>Swarm had a desired state of:</p><p>3 WordPress replicas</p><p>After I killed one, the actual state became:</p><p>2 WordPress replicas</p><p>Docker Swarm basically looked at that and said:</p><p>Absolutely not.</p><p>😂</p><p>It created a replacement task and brought the service back to three replicas.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*Lc7Sj9fHvsB53yY6FMPYNg.png" /></figure><p>That was a great visual demonstration of desired-state orchestration.</p><p>But I had one question.</p><p>Did Monkey #2 survive?</p><p>I refreshed WordPress.</p><p>🐒</p><p>There she was.</p><p>The original container was gone.</p><p>A replacement container was running.</p><p>But the new container mounted the same EFS-backed uploads directory.</p><p>The application instance was disposable.</p><p>The important data wasn’t.</p><p>That was the point where the concept of persistent shared storage really clicked.</p><h3>📦 Time to Turn This Into YAML</h3><p>Up to this point, I had intentionally built a lot of the environment manually.</p><p>I wanted to understand the commands and the relationships before abstracting everything into a configuration file.</p><p>But once the environment worked, I wanted a reproducible deployment.</p><p>So I created:</p><p>stack.yml</p><p>The stack described:</p><p>🐳 MySQL<br>🐳 WordPress<br>🐳 Three WordPress replicas<br>🔐 Docker Secrets<br>🌐 Frontend and backend overlay networks<br>💾 MySQL persistent storage<br>📍 MySQL placement constraints<br>☁️ EFS-backed WordPress uploads<br>🚦 Published HTTP traffic<br>🔄 Restart policies<br>🧠 Memory reservations and limits</p><p>I also pinned my application versions rather than leaving WordPress on a floating “latest” tag.</p><p>My final images included:</p><p>mysql:8.4</p><p>wordpress:7.1</p><p>Now the application deployment configuration existed as code instead of only as a collection of commands I had typed manually.</p><h3>😬 And Then My YAML Broke</h3><p>Because apparently this project hadn’t taught me enough yet.</p><p>At one point, I attempted to pin the container images using image digests.</p><p>One of the digests was copied incorrectly.</p><p>Docker responded with:</p><p>invalid image reference for service mysql: invalid checksum digest length</p><p>Well.</p><p>That’s not ideal. 😂</p><p>I went back to the configuration, corrected the image references, validated the YAML again, and eventually used explicit version tags.</p><p>Before deploying, I validated the stack configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*SFMKzf3WoR5qUdWmbZlU7Q.png" /></figure><p>Then came the test that actually mattered.</p><h3>🚀 Delete the Working Services and Trust the YAML</h3><p>I already knew the manually built environment worked.</p><p>But that didn’t prove my stack file could recreate it.</p><p>There was really only one way to test that.</p><p>Delete the manually created services.</p><p>😬</p><p>So I removed WordPress and MySQL.</p><p>Then deployed the application using:</p><p>docker stack deploy -c stack.yml wordpress</p><p>And waited.</p><p>Docker Swarm created:</p><p>wordpress_mysql — 1/1</p><p>wordpress_wordpress — 3/3</p><p>MySQL landed on Worker 1 because of its placement constraint.</p><p>The WordPress replicas were distributed across all three Swarm nodes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*TQZm1jGqsnRbPCG6DnTBPw.png" /></figure><p>The YAML had successfully rebuilt the application architecture.</p><p>But I wasn’t celebrating yet.</p><p>There was still one final test.</p><h3>🐒 DID. THE. MONKEY. SURVIVE?</h3><p>I opened WordPress.</p><p>The original post was there.</p><p>That told me MySQL had successfully reconnected to the existing mysql-data volume.</p><p>Then I looked at the image.</p><p>🐒</p><p>STILL.</p><p>THERE.</p><p>😂🎉</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bnR-_RQBWpw2ARHgjx_prA.png" /></figure><p>The manually created services were gone.</p><p>New services had been created from stack.yml.</p><p>New WordPress containers were running.</p><p>But the application data survived.</p><p>MySQL reconnected to its persistent volume.</p><p>WordPress reconnected to EFS.</p><p>And Monkey #2 lived to tell the story.</p><p>At that moment, the entire project came together.</p><h3>🧠 What This Project Actually Taught Me</h3><p>I started this project thinking I was learning Docker Swarm.</p><p>And I did.</p><p>But I learned a lot more than that.</p><p>🐳 Containers are disposable.</p><p>If important data exists only inside a container, I need to assume that data can disappear when the container does.</p><p>☁️ Scaled applications need a storage strategy.</p><p>Running three WordPress replicas wasn’t enough. All three replicas needed access to the same media.</p><p>🗄️ Stateful services change the architecture.</p><p>Once WordPress uploads were moved to EFS, WordPress tasks could be replaced much more easily.</p><p>MySQL was different.</p><p>Its database remained on Worker 1’s local Docker volume.</p><p>That meant the database still had a single-node dependency.</p><p>For a more production-oriented AWS architecture, I would likely move that database to Amazon RDS instead of trying to make a Dockerized database on one small EC2 worker highly available.</p><p>🌐 Troubleshoot the whole path.</p><p>My 7946/7947 mistake was a perfect example.</p><p>The application can look broken when the actual problem is several layers underneath it.</p><p>Application → Container → Docker → Linux → Network → AWS</p><p>🔎 Don’t claim what you haven’t proven.</p><p>Worker 1 had low memory headroom.</p><p>Memory pressure was suspicious.</p><p>But I didn’t prove an OOM event.</p><p>So I didn’t call it one.</p><p>📄 Writing YAML isn’t enough.</p><p>The real validation came when I removed the manually created services and successfully reconstructed the application from stack.yml.</p><p>And perhaps most importantly…</p><p>🐒 Always have a test monkey.</p><p>Okay, maybe that one is project-specific. 😂</p><h3>🏭 What Would I Do Differently in Production?</h3><p>This was a learning lab, not a production WordPress architecture.</p><p>If I were taking the concepts further, I’d look at:</p><p>☁️ Amazon RDS for the database</p><p>🔒 HTTPS/TLS</p><p>🌐 DNS and a production load-balancing strategy</p><p>🏗️ Infrastructure as Code for the AWS infrastructure itself</p><p>📊 Centralized monitoring and alerting</p><p>❤️ Application and infrastructure health checks</p><p>💾 Automated backup and restore processes</p><p>🖥️ More appropriately sized compute</p><p>🔐 Stronger host-level security controls</p><p>🔄 Automated provisioning and EFS mounting</p><p>📦 Controlled image versioning and upgrade strategies</p><p>And I probably wouldn’t give Worker 1 responsibility for the production database.</p><p>She has lost that privilege.</p><p>😂</p><h3>💚 My Favorite Part of the Project</h3><p>My favorite part wasn’t getting WordPress to load.</p><p>It wasn’t seeing three replicas running.</p><p>And it wasn’t even seeing the final Docker Stack deployment succeed.</p><p>It was watching things break.</p><p>Every failure exposed another piece of the architecture I didn’t fully understand yet.</p><p>Why can’t these nodes communicate?</p><p>Why does one WordPress replica have my image but another doesn’t?</p><p>Where did the file go when the container disappeared?</p><p>Why can’t MySQL simply move to another worker?</p><p>Why didn’t my EFS mount survive a reboot?</p><p>Why is Docker rejecting my image reference?</p><p>Each question pushed me one layer deeper.</p><p>That’s exactly what I want from these projects.</p><p>Not:</p><p>“I typed the commands and it worked.”</p><p>But:</p><p>“I built it. I broke it. I figured out why. I changed it. Then I proved the fix worked.”</p><p>That feels a whole lot closer to the troubleshooting I actually enjoy doing.</p><h3>🐒 One Final Lesson</h3><p>Monkey #1 taught me about ephemeral container storage.</p><p>Monkey #2 taught me about persistent shared storage.</p><p>Worker 1 taught me patience.</p><p>A LOT of patience.</p><p>😂</p><p>And Docker Swarm taught me something bigger:</p><p>Self-healing only works when the rest of your architecture gives the replacement workload what it needs to succeed.</p><p>Docker can replace the container.</p><p>But the application still needs its network.</p><p>It still needs its secrets.</p><p>It still needs its database.</p><p>And it still needs its data.</p><p>The container can come back.</p><p>The important stuff needs somewhere safe to live.</p><p>🐳 + ☁️ + 🐒 = lesson learned.</p><p>💚</p><p><a href="https://github.com/mandyreed223/wordpress-docker-swarm-aws"><strong><em>GitHub Repositor</em></strong></a><strong><em>y</em></strong></p><p><a href="https://mandyreed.com/"><strong><em>Cloud Engineering Portfolio</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=438cbb166861" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>