<?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 Vitalii Vostotskyi on Medium]]></title>
        <description><![CDATA[Stories by Vitalii Vostotskyi on Medium]]></description>
        <link>https://medium.com/@vostotskiy?source=rss-c4d6c55fa81b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*FibR8HK_NFx8v7SdkZvxqQ.jpeg</url>
            <title>Stories by Vitalii Vostotskyi on Medium</title>
            <link>https://medium.com/@vostotskiy?source=rss-c4d6c55fa81b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 21:50:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vostotskiy/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[When EKS ‘Works’ but Observability Doesn’t: A Routing Failure Story]]></title>
            <link>https://aws.plainenglish.io/when-eks-works-but-observability-doesn-t-a-routing-failure-story-fcf7788d5dc1?source=rss-c4d6c55fa81b------2</link>
            <guid isPermaLink="false">https://medium.com/p/fcf7788d5dc1</guid>
            <category><![CDATA[observability]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Vitalii Vostotskyi]]></dc:creator>
            <pubDate>Tue, 03 Mar 2026 09:42:29 GMT</pubDate>
            <atom:updated>2026-03-03T09:42:29.225Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Observability didn’t slow us down.<br> It showed us where we already were.</em></p><h3>Prologue: What This Incident Actually Taught Me</h3><p>This case is a perfect example of how a “two-click”, trivial EKS setup can lead to non-trivial consequences. What started as a routine deployment turned into deep troubleshooting that showcased how much broken networking can impact business goals. That’s why routing decisions made weeks earlier can break services deployed today.</p><p>Long story short: on a newly created cluster intended for a fresh business feature, we found it impossible to install critical addons, specifically those required for <strong>ContainerInsights</strong>.</p><p>In our case, ContainerInsights (and the CloudWatch Agent) was essential. We needed those host-level metrics to validate the performance of the new workload. I started debugging and investigating. At first glance, it looked like a broken observability config.</p><p><em>But in the end, it wasn’t observability at all. One small network design flaw — and it surfaced all the way at the cluster level.</em></p><blockquote>Some infrastructure details were adjusted for confidentiality.</blockquote><h3>Troubleshooting Flow</h3><h4>The Symptoms</h4><p>The cluster looked healthy. Cluster infrastructure pods were running. Nodes were Ready. But something was off.</p><p>CloudWatch Observability addon: not failed, not running — Degraded. That specific state matters. Not a clean error. Not complete silence. Something in between: the addon was trying to work, and couldn&#39;t.</p><pre>Status:   Update failed → Degraded<br>Health:   InsufficientNumberOfReplicas: 0/2 pods available</pre><p>The pods told the rest of the story:</p><pre>cloudwatch-agent   0/1   ImagePullBackOff<br>fluent-bit         0/1   ImagePullBackOff</pre><p>Not Error. Not CrashLoopBackOff. ImagePullBackOff is a pretty common situation in the “Kubernetes world” — Kubernetes gave up retrying the image pull.</p><p>The actual error from the console:</p><pre>Back-off pulling image &quot;602401143452.dkr.ecr.us-east-1.amazonaws.com/...&quot;:<br>dial tcp 34.198.77.233:443: i/o timeout</pre><p>Connection timeout. Not an auth failure. Not image not found. The nodes couldn’t reach ECR at all.</p><p>That’s when the debugging started.</p><h4>Hypothesis 1: IAM</h4><blockquote>All the world’s a stage, and all the men and women are merely players</blockquote><p>Every action in AWS is an API call. No permissions — nothing moves forward. In most AWS troubleshooting (especially when permissions are either overlooked or over-engineered), getting IAM right is step one.</p><p>Networking comes after. So we started there.</p><blockquote><strong>Assumption</strong>: ECR pull failure is the result of missing/incorrect permissions<em>.</em></blockquote><p>A fresh node role was recreated from scratch. It included:</p><pre> - AmazonEKSWorkerNodePolicy<br> - AmazonEKS_CNI_Policy<br> - AmazonEC2ContainerRegistryReadOnly<br> - CloudWatchAgentServerPolicy</pre><p>We verified IRSA configuration for the CloudWatch addon — checked the service account annotation, confirmed the OIDC provider was set up, and made sure the IAM role trust policy referenced the correct service account.</p><p>Then tested ECR auth directly from the node:</p><pre>aws ecr get-authorization-token - region us-east-1<br># Success - token retrieved, credentials valid</pre><p>Auth worked. The node could talk to AWS APIs just fine!</p><p>But pulling the actual image? Still timing out. The credentials worked. Policies were attached. Trust relationships looked correct.</p><p>But still <em>ImagePullBackOff</em>.</p><p>Here’s what mattered: if IAM was the problem, we’d see “AccessDenied”. <br>Instead: “i/o timeout”.</p><p>The pods couldn’t reach ECR to even attempt authentication.</p><blockquote><strong>Conclusion</strong>: Not IAM. The problem was deeper — before authentication could happen.</blockquote><h3>Hypothesis 2: Addon Issue</h3><blockquote><strong>Assumption:</strong> Addon needs to be reinstalled.</blockquote><p>Often, the simplest way to recover a failed resource — including permission-related failures — is to recreate it. There are exceptions, of course. EC2, for example, will usually recover on its own once the role is fixed. But when a resource is already in a failed state, recreating it is usually the healthiest approach.</p><p>The usual way to do this:</p><pre>aws eks update-addon \<br>  --cluster-name &lt;cluster-name&gt; \<br>  --addon-name amazon-cloudwatch-observability \<br>  --resolve-conflicts OVERWRITE</pre><p>It takes some time update to be completed, then the status could be verified. Still Degraded. Same ImagePullBackOff. No miracle this time.</p><pre>kubectl get pods -n amazon-cloudwatch<br># cloudwatch-agent   0/1   ImagePullBackOff<br># fluent-bit         0/1   ImagePullBackOff</pre><p>Same errors appeared in the logs:</p><pre>ErrImagePull: dial tcp 34.198.77.233:443: i/o timeout</pre><blockquote><strong>Conclusion:</strong> <em>Not the addon configuration.</em></blockquote><p>At this point, the pattern was obvious. IAM: working. Addon: reinstalled. Error: identical.</p><p>The problem wasn’t in the Kubernetes configuration. It was happening before the pods could even attempt to pull the image.</p><p><strong>Which meant connectivity.</strong></p><h3>The Breakthrough: Network Testing</h3><blockquote>One question we hadn’t asked yet: <strong>can the nodes actually reach ECR?</strong></blockquote><h4>Basic Connectivity Test</h4><p>First, we needed to get on the node itself. No SSH key required — SSM Session Manager works out of the box on EKS worker nodes:</p><pre># Get node instance ID<br>kubectl get nodes -o wide<br># NAME                          STATUS   INTERNAL-IP<br># ip-10-0-2-xxx.ec2.internal    Ready    10.0.2.xxx<br><br># Connect via SSM Session Manager<br>aws ssm start-session --target i-xxxxxxxxxx</pre><p>Once on the node — test ECR connectivity directly:</p><pre># Basic connectivity check<br>curl -I https://602401143452.dkr.ecr.us-east-1.amazonaws.com<br># Result: timeout — no response at all<br><br># Confirm with ECR login attempt<br>aws ecr get-login-password --region us-east-1 | \<br>  docker login --username AWS --password-stdin \<br>  602401143452.dkr.ecr.us-east-1.amazonaws.com<br># Result: connection timeout</pre><p><strong>Result</strong>: connection timeout.</p><p>Not authentication. Not permissions. Pure connectivity failure. The nodes couldn’t reach ECR at all.</p><h4>VPC Infrastructure Check</h4><p>Before dive into routing, we verified the basic setup:</p><pre># VPC exists<br>aws ec2 describe-vpcs --vpc-ids &lt;vpc-id&gt;<br># Output: 10.0.0.0/16, DNS enabled ✓<br><br># Internet Gateway attached<br>aws ec2 describe-internet-gateways \<br>  --filters &quot;Name=attachment.vpc-id,Values=&lt;vpc-id&gt;&quot;<br># Output: attached ✓<br><br># NAT Gateway in public subnet<br>aws ec2 describe-nat-gateways \<br>  --filters &quot;Name=vpc-id,Values=&lt;vpc-id&gt;&quot;<br># Output:<br>#   State: available ✓<br>#   Subnet: public (10.0.1.0/24) ✓<br>#   Elastic IP: allocated ✓<br><br># Subnets configuration<br>aws ec2 describe-subnets \<br>  --filters &quot;Name=vpc-id,Values=&lt;vpc-id&gt;&quot;<br># Output: Public + Private subnets exist ✓</pre><p>Everything looked correct. IGW attached, NAT running, subnets configured.</p><p>So why couldn’t private subnets reach ECR?</p><h4>Route Table Analysis</h4><p>The result of the command used to get the route table properties</p><pre>aws ec2 describe-route-tables \<br>  --filters &quot;Name=association.subnet-id,Values=&lt;subnet-private-id&gt;&quot; \<br>  --query &#39;RouteTables[].Routes[]&#39;</pre><p>was output:</p><pre>Destination      Target              Status<br>-----------------------------------------------<br>0.0.0.0/24    →  tgw-xxxxxxxxxx     active  ❌<br>0.0.0.0/0     →  igw-xxxxxxxxxx     active  ⚠️<br>10.0.0.0/16   →  local              active  ✓</pre><p>There it was!</p><blockquote><strong>Two</strong> <strong>default</strong> routes: one pointing to Transit Gateway, one to Internet Gateway.</blockquote><h3>The Precedence Problem</h3><p>So here’s what we were looking at: one private subnet with two active default routes pointing to different gateways.</p><p>That’s already a design mistake. But the tricky part? The network still “worked” on the paper — no alarms, no obvious failures, nothing screaming that something was wrong.</p><p>When two routes compete for the same destination, AWS uses a simple rule: <strong>most specific CIDR wins</strong>. Always.</p><p>0.0.0.0/24 is more specific than 0.0.0.0/0.</p><p>So every packet destined for the internet — including ECR at 34.198.77.233—matched the /24 route first. Got sent to the Transit Gateway. Which had no path to the public internet.</p><p>What about the NAT Gateway? It never even got a chance to route the traffic.</p><p>Here’s the flow:</p><pre>EKS Node → Route Table<br>           ├─ Match 0.0.0.0/24? YES<br>           │  └─ Send to Transit Gateway<br>           │     └─ TGW routes: only internal VPCs ❌<br>           │<br>           └─ Match 0.0.0.0/0? Never evaluated</pre><p>We checked the Transit Gateway route table to confirm:</p><pre>aws ec2 describe-transit-gateway-route-tables \<br>  --transit-gateway-id &lt;tgw-id&gt;</pre><p>Routes only pointed to other VPCs. No internet egress. No path to ECR.</p><p>Transit Gateway was set up for inter-VPC communication, as I clarified later, not internet access. That’s fine for its intended purpose. But the /24 route in the subnet&#39;s route table hijacked all outbound traffic—including traffic that needed to reach the public internet.</p><blockquote>This is why “patch” is not the best approach in the networking architecture — it can break the existing setup easily.</blockquote><p><strong>Summing up: </strong><br>The NAT Gateway existed. The Internet Gateway worked. DNS was configured correctly. But routing precedence sent ECR traffic into a dead end before any of that mattered.</p><p><strong>IAM, as initially thought, was a good candidate- but not the issue.</strong> Two routes- one direction turned into the wrong destination.</p><p>The diagram below shows how the resources were configured:</p><figure><img alt="EKS node routes outbound traffic to Transit Gateway — /24 takes precedence. NAT Gateway exists, but never gets evaluated." src="https://cdn-images-1.medium.com/max/1024/1*oOTP_TNKTvZzvIreu53EBA.png" /><figcaption>EKS node routes outbound traffic to Transit Gateway — /24 takes precedence. NAT Gateway exists, but never gets evaluated.</figcaption></figure><h3>Root Cause</h3><p>This wasn’t an EKS problem. This wasn’t an addon problem.</p><p>The VPC networking was already broken before the cluster existed.</p><p>Here’s what actually happened:</p><p>Someone added a Transit Gateway to connect multiple VPCs. Standard multi-VPC setup. Nothing unusual. But along with it came a route: 0.0.0.0/24 → TGW.</p><p>That route was never meant to intercept internet traffic. It was meant for internal VPC-to-VPC routing. Nobody checked what else it would affect.</p><p>Route table precedence did the rest:</p><ul><li>/24 is more specific than /0</li><li>Every packet to an external IP matched /24 first</li><li>Went into TGW — which had no path to the public internet</li><li>Internet Gateway route: never reached</li></ul><p>ECR lives on the public internet. Our nodes were silently sending ECR traffic into a dead end.</p><p>Core cluster components were already running — bootstrapped before the routing conflict surfaced. Container Insights needed to pull fresh images from ECR. That’s when it surfaced.</p><p>The cluster wasn’t broken. The foundation it was running on was.</p><blockquote><strong>A note on VPC Endpoints:</strong> This could have been avoided entirely with VPC Endpoints for ECR. No internet egress needed — traffic stays within AWS network. We didn’t have them. Now we know exactly why they exist.</blockquote><h4>Why This Was Hard to Detect</h4><p>One more thing that made this non-obvious: the cluster was running in <strong>EKS Auto Mode</strong>.</p><p>We didn’t manually choose subnets. AWS did. Auto Mode automatically selects where to place nodes — and it picked the broken subnet without any warning.</p><pre>aws eks describe-cluster --name &lt;cluster-name&gt; \<br>  --query &#39;cluster.resourcesVpcConfig.subnetIds&#39;<br># Output: multiple subnets listed, including the broken one</pre><p>The subnet looked fine on paper. NAT Gateway associated, route table attached, state available. Nothing indicated a problem until we traced the node IP back to the subnet:</p><pre>kubectl get nodes -o wide<br># Node IP: 10.0.2.xxx → maps to broken subnet range</pre><p>Node IP → subnet → route table → conflicting routes. That’s the path we had to walk backwards.</p><p><strong>Consequence</strong>: Auto Mode hides subnet selection. You don’t always know which subnet your nodes landed in until something breaks. Auto Mode is only as good as the network it deploys into. Clean architecture — clean setup. Broken routing — broken cluster.</p><h3>The Fix: Rebuild, Don’t Patch</h3><p>Untangling us-east-1’s routing mess wasn’t worth it. Multiple overlapping CIDRs, undocumented TGW config, no clear ownership of route tables. Nobody knew what else might break if we touched it.</p><p>Decision: start fresh in us-east-2.</p><p>We rebuilt the VPC from scratch using standard AWS CLI — new CIDR, clean subnets, explicit route tables. No shortcuts.</p><p>New VPC Architecture:</p><pre>VPC: 10.70.0.0/16  ← unique CIDR, no conflicts<br>├── Public subnet:  10.70.24.0/24 (us-east-2a) → NAT Gateway + IGW<br>├── Private subnet: 10.70.25.0/24 (us-east-2a) → EKS nodes<br>└── Private subnet: 10.70.26.0/24 (us-east-2b) → EKS nodes</pre><p>Route Tables (Clean):</p><pre>Public RT:<br>10.70.0.0/16 → local<br>0.0.0.0/0    → igw-xxx  ✅<br><br>Private RT:<br>10.70.0.0/16 → local<br>0.0.0.0/0    → nat-xxx  ✅  ← single default route, no conflicts</pre><p>One public route table, one private route table. Both are shared across relevant subnets. No per-subnet route table overhead — that’s unnecessary complexity.</p><p>Public subnets → public RT. Private subnets → private RT (via NAT). Clean and predictable.</p><h4>EKS Setup</h4><ul><li><strong>Standard mode</strong> — not Auto Mode. Explicit subnet selection- for experienced drivers</li><li><strong>Managed node group</strong> with ASG — predictable scaling, no surprises</li><li><strong>Spot instances</strong> — t3.medium / t3a.medium / t2.medium. This was a setup used to test a business feature, with no SLA hard requirements, so Spot worked fine here. For production workloads, evaluate carefully — Spot interruptions are real.</li><li><strong>Scaling:</strong> min 1, max 3, desired 2</li><li><strong>Add-ons:</strong> VPC CNI, kube-proxy, CoreDNS, CloudWatch Observability v4.3.0</li></ul><p>IAM roles built from scratch with the minimum required policies:</p><pre>Cluster role: AmazonEKSClusterPolicy<br>Node role:    AmazonEKSWorkerNodePolicy<br>              AmazonEKS_CNI_Policy<br>              AmazonEC2ContainerRegistryReadOnly<br>              CloudWatchAgentServerPolicy</pre><p>The setup of the EKS cluster with specified networking and clean rules is shown in the diagram below:</p><figure><img alt="Single default route per RT. EKS nodes in both AZs reach ECR through NAT — no ambiguity." src="https://cdn-images-1.medium.com/max/1024/1*K5KowU6CI3hv5STQgH-gRQ.png" /><figcaption>Single default route per RT. EKS nodes in both AZs reach ECR through NAT — no ambiguity.</figcaption></figure><p>Verification:</p><pre>kubectl get nodes<br># ip-10-70-25-xxx.us-east-2.compute.internal   Ready   5m<br># ip-10-70-26-xxx.us-east-2.compute.internal   Ready   5m<br><br>kubectl get pods -n amazon-cloudwatch<br># cloudwatch-agent-xxx   1/1   Running   5m<br># fluent-bit-xxx         1/1   Running   5m<br><br># ECR connectivity from node<br>aws ecr get-login-password --region us-east-2 | \<br>  docker login --username AWS --password-stdin \<br>  602401143452.dkr.ecr.us-east-2.amazonaws.com<br># Login Succeeded ✅</pre><p>1000 + active metrics. Full Container Insights. Finally!</p><h4>Before vs After</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sGNZcA_T0CI-YA4FjYQJsA.png" /></figure><blockquote>This wasn’t a free fix. The rebuild took a few days — and that delayed the feature rollout, which wasn’t great for the business side of things.</blockquote><blockquote>But the outcome was worth it. Clean network architecture, explicit subnet control, no legacy routing surprises. And since this was a validation setup, Spot instances kept the costs manageable — $134/month instead of $182 for a broken cluster with zero observability.</blockquote><blockquote>Sometimes the “quick fix” costs more in the long run than starting clean.</blockquote><h3>Troubleshooting Toolkit</h3><p>ImagePullBackOff on EKS system pods?</p><p>Test connectivity first.</p><p>curl the ECR endpoint from the node.</p><p>Timeout → network problem. AccessDenied → IAM.</p><p>Not the other way around.</p><pre>curl -I https://602401143452.dkr.ecr.us-east-1.amazonaws.com</pre><p>Then inspect route tables. Look for conflicting default routes — /24 taking precedence over /0, TGW without internet egress.</p><pre>aws ec2 describe-route-tables \<br>  --filters &quot;Name=association.subnet-id,Values=&lt;subnet-id&gt;&quot; \<br>  --query &#39;RouteTables[].Routes[]&#39; \<br>  --output table</pre><pre>✅ Private subnet → NAT → IGW → ECR<br>❌ Private subnet → Transit Gateway → dead end</pre><p>Only after connectivity is confirmed — open the IAM console.</p><h3>Key Lessons</h3><p>Route table precedence is silent. One wrong route kills ECR access without a single alarm. No AccessDenied, no obvious error — just a timeout that looks like a dozen other things.</p><p>“Working cluster” ≠ working infrastructure. The control plane was healthy. Pods were deploying. kubectl worked fine. Container Insights was the first honest signal that something underneath was broken.</p><h3><strong>Epilogue</strong></h3><p>This is one of those cases where observability did exactly what it’s supposed to do — not just show metrics, but expose a broken assumption in the infrastructure underneath.</p><h3><strong>Over to you</strong></h3><p>Have you hit non-obvious network issues in AWS — routing conflicts, TGW surprises, legacy infrastructure that broke something new?</p><p>Drop your scenario in the comments. I’d genuinely like to hear it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fcf7788d5dc1" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/when-eks-works-but-observability-doesn-t-a-routing-failure-story-fcf7788d5dc1">When EKS ‘Works’ but Observability Doesn’t: A Routing Failure Story</a> was originally published in <a href="https://aws.plainenglish.io/">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CIDR Conflicts in AWS: Why Your VPCs Won’t Connect]]></title>
            <link>https://aws.plainenglish.io/cidr-conflicts-in-aws-why-your-vpcs-wont-connect-5a7740f74ab2?source=rss-c4d6c55fa81b------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a7740f74ab2</guid>
            <category><![CDATA[vpc]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Vitalii Vostotskyi]]></dc:creator>
            <pubDate>Thu, 18 Sep 2025 15:30:29 GMT</pubDate>
            <atom:updated>2025-09-21T06:49:19.099Z</atom:updated>
            <content:encoded><![CDATA[<p><em>When overlapping IP ranges silently block your cloud growth.</em></p><figure><img alt="Diagram of AWS VPC-A and VPC-B with overlapping CIDR 10.30.0.0/16, causing internal routing conflicts. VPC peering, Transit Gateway, and PrivateLink connections fail, disrupting network traffic." src="https://cdn-images-1.medium.com/max/860/1*hgF7ayNLmdXNsHfLL6kZnA.png" /><figcaption>Overlapping CIDRs (10.30.0.0/16) disrupt VPC peering, Transit Gateway, and PrivateLink — AWS can’t decide where traffic goes</figcaption></figure><p>You set up VPC peering.<br> You configured a Transit Gateway.<br> You even opened all the right ports.<br>So why can’t your services talk to each other?</p><p>Welcome to the world of <strong>CIDR conflicts</strong> — the silent killers of AWS networking.</p><h3>Quick Refresher: What Are We Talking About?</h3><p>Think of AWS as a large corporation. Each <strong>VPC</strong> is like an isolated department — finance, R&amp;D, operations — with its own internal network where computers communicate using private IP addresses.</p><p><strong>CIDR notation</strong> is how we define address ranges. Examples:</p><ul><li>10.0.0.0/32 = one specific IP address</li><li>10.0.0.0/24 = 256 addresses (251 usable after AWS reserves 5)</li><li>10.0.0.0/16 = 65,536 addresses</li></ul><p><strong>CIDR conflicts</strong> happen when two “departments” use the same address range. Inside each VPC, everything works fine. But when you try to connect them — peering, Transit Gateway, VPN — routing becomes impossible. AWS can’t tell if 10.0.0.5 belongs to VPC A or VPC B.</p><p>CIDR conflicts show up in two flavors:</p><ul><li><strong>Internal: </strong>when your own VPCs can’t talk to each other</li><li><strong>External: </strong>when you try to bridge regions, partners, or on-prem</li></ul><p>On the surface, everything looks fine. But underneath, overlapping IP ranges make routing <strong>mathematically impossible</strong> — and the fix often means a painful VPC redesign.</p><h3>Problem 1 — Internal Conflicts (Within Your Account)</h3><h4>The Setup</h4><p>Bob, a senior engineer, creates <strong>VPC-A</strong> (10.30.0.0/16) for the company’s main app:</p><ul><li>Subnets: 10.30.10.0/24 (public/web), 10.30.20.0/24 (app tier), 10.30.30.0/24 (database)</li><li>Resources: ALB, EC2, RDS cluster</li></ul><p>Everything works smoothly.</p><p>Six months later, John, a junior engineer, spins up <strong>VPC-B</strong> — also 10.30.0.0/16 — for an analytics service (he didn’t check the registry/IPAM):</p><ul><li>Subnets: 10.30.40.0/24 (analytics), 10.30.50.0/24 (data lake)</li><li>Resources: EKS cluster, ElastiCache, S3 endpoints</li></ul><p>Again, everything works — in isolation.</p><h4>The Breaking Point</h4><p>Task: <em>“Connect analytics to the main database via PrivateLink.”</em></p><p>John sets up the endpoint, updates route tables, opens security groups. But nothing works:</p><ul><li>PrivateLink shows “available” but no traffic flows</li><li>DNS points to the wrong VPC</li><li>Routes can’t tell if 10.30.20.5 is in VPC-A or VPC-B</li></ul><p>That’s when John discovers the <strong>CIDR overlap</strong>.</p><h4>Options on the Table</h4><p><strong>Option 1 — Secondary CIDR (Incremental, safer but longer)</strong></p><ul><li>Add a non-overlapping secondary block to VPC-B, e.g. 10.31.0.0/16</li><li>Create new subnets in the secondary range (10.31.40.0/24, 10.31.50.0/24)</li><li>Migrate resources one by one</li><li>Update SGs and routing</li></ul><p><strong>Option 2 — Full Re-IP (Fast but Painful and possibly buggy)</strong></p><ul><li>Build new VPC-C with 10.31.0.0/16</li><li>Recreate subnets, SGs, NACLs using banded notation (10.31.10.0/24 = public, 10.31.20.0/24 = app, 10.31.30.0/24 = DB)</li><li>Blue/green migrate EKS and DB</li><li>Update Route53 records and Elastic IPs</li></ul><h4>The Real Cost</h4><ul><li><strong>~3 weeks</strong> of John’s time (≈75% of his sprint capacity)</li><li><strong>~1 week</strong> of senior engineer time for EKS migration</li><li><strong>Delayed release</strong> impacting quarterly goals</li><li><strong>Production change windows</strong> and associated risk</li></ul><h4>Quick Check — Do You Have This Problem?</h4><pre>aws ec2 describe-vpcs --query &#39;Vpcs[].{VPCId:VpcId,CIDR:CidrBlock}&#39;</pre><p>See duplicates or overlaps? You’ve got a <strong>John-and-Bob situation</strong> waiting to explode.</p><h3>Problem 2 — External Conflicts (Integration Nightmares)</h3><h4>The $2B Acquisition That Almost Failed</h4><p>TechCorp acquires StartupXYZ for $2B. Deadline: 6 months.<br> The plan: connect both AWS environments via Transit Gateway.</p><ul><li>TechCorp: “We use 10.30.0.0/16 across 20 VPCs.”</li><li>StartupXYZ: “Cool, we also use 10.30.0.0/16 across 15 VPCs.”</li></ul><p>Weeks later, TGW attachments are live — but traffic vanishes. Routes loop endlessly. Critical data can’t sync.<br> The cause? <strong>Identical CIDR blocks</strong>. Integration stalls before it begins.</p><h4>The Multi-Region Rollout That Stalled</h4><p>Sarah’s team mirrors their US architecture (10.40.0.0/12) in EU for compliance.<br> Everything deploys perfectly — until they try cross-region peering:</p><blockquote>Error: CIDR blocks overlap. A peering connection cannot be established.</blockquote><p>Result: a <strong>3-month delay</strong> and a painful re-IP of the entire EU environment.</p><h4>The Partner Integration From Hell</h4><p>Your API must connect to FinancePartner’s VPC via PrivateLink.<br>Your VPC: 10.31.0.0/16<br> Partner’s VPC: 10.31.0.0/16</p><p>Solution? A $500/month NAT Gateway translating traffic. Every call now adds ~50 ms latency. Finance complains about “slow APIs,” but the alternative — re-IPing production — is worse.</p><h4>The Hybrid Trap</h4><p>On-prem network: 10.50.0.0/16.<br> AWS VPC: 10.50.0.0/16.</p><p>VPN/Direct Connect setup fails instantly. There’s no way to route packets when both sides think 10.50.1.10 is “local.”</p><h4>The Real Cost</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OYBKsY7Ae7xSu_XitEtQIQ.png" /></figure><p>On paper, copy-pasting a familiar block feels harmless.<br> In reality, it creates <strong>strategic bottlenecks</strong> — delaying rollouts, adding cost, and turning integrations into fire drills.</p><h3>How to Dodge the Bullet — CIDR Planning</h3><h4>Global CIDR Strategy</h4><p>Reserve different blocks for different purposes from day one — don’t improvise later.</p><ul><li><strong>AWS Regions (global pool)</strong>: 10.0.0.0/8 — huge space to carve from.</li><li><strong>On-prem / legacy</strong>: 172.16.0.0/12 — many brownfield networks live here.</li><li><strong>Partners / Vendors</strong>: 192.168.0.0/16 — everyone loves this range; isolate it.</li><li><strong>M&amp;A / future expansion</strong>: 10.240.0.0/12 — keep a buffer for acquisitions or unexpected needs.</li></ul><blockquote>👉<strong>Tip:</strong> pick higher, less-common blocks for your cloud (e.g., 10.30.0.0/16 instead of 10.0.0.0/16). That reduces accidental overlap with on-prem and partner networks.</blockquote><h4>Per-Region Allocation (with headroom)</h4><p>If you expect ~10 VPCs per region, give the region a /12 and hand out /16 slots inside it. That gives capacity + buddy blocks.</p><p>Example layout:</p><p><strong>☁️ us-east-1 (region block)</strong>: 10.32.0.0/12 :</p><ul><li>VPC slots: 10.32.0.0/16, 10.33.0.0/16, …, 10.47.0.0/16 (16 slots)</li><li>Best practice: allocate even /16 values as active (e.g., 10.32.0.0/16, 10.34.0.0/16), keep odd ones free as <strong>buddy</strong> blocks.</li></ul><p><strong>☁️ eu-west-1 (region block)</strong>: 10.48.0.0/12 → 10.48.0.0/16 … 10.63.0.0/16</p><p><strong>☁️ ap-southeast-1 (region block)</strong>: 10.64.0.0/12 → 10.64.0.0/16 … 10.79.0.0/16</p><p><strong>🔑 Reserved pool</strong>: 10.240.0.0/12 (M&amp;A / new-region buffer)</p><blockquote><strong>Why </strong><strong>/12 → </strong><strong>/16 works:</strong> you get many /16 VPCs per region, easy route summarization, and room to grow without ripping stuff apart.</blockquote><h4>Pro tip — Buddy blocks &amp; gaps</h4><ul><li>When you assign 10.32.0.0/16 to a VPC, <strong>keep </strong><strong>10.33.0.0/16 free</strong> beside it. Later, you can merge them into a /15 if needed.</li><li>Leave small gaps between regions (skip one or two /16 slots) so you don’t run out of neat contiguous ranges for subnetting.</li><li>Use <strong>even/odd</strong> allocation convention: even = active, odd = buddy/reserve.</li></ul><h4>Subnet structuring — bands, not spaghetti</h4><p>Structure subnets in human-friendly bands (tens) so diagrams and automation are simple.</p><p>Example for VPC = 10.32.0.0/16, AZs a/b/c:</p><ul><li>🌐 10.32.10.0/24 → Public (ALB, NAT GW)</li><li>⚙️ 10.32.20.0/24 → App tier (private)</li><li>💾 10.32.30.0/24 → DB tier (private)</li><li>📊 10.32.40.0/24 → Analytics / batch</li><li>🛰️ 10.32.50.0/23 → Serverless / Fargate (larger block for ENIs)</li><li>🗂️ 10.32.60.0/24, 10.32.70.0/24 → Reserved bands</li></ul><blockquote>👉 <strong>Mirror the same bands across AZs</strong> (10.32.10.0/24, 10.32.11.0/24, 10.32.12.0/24) — easier for automation and runbooks.</blockquote><h4>Don’t make subnets too small (AWS reserved IPs)</h4><p>AWS reserves <strong>5 IPs per subnet</strong> for networking: network, router, DNS, AWS use, and broadcast-like. That changes usable counts:</p><ul><li>/24 → 256 total → ~251 usable — ✅ safe for most workloads</li><li>/28 → 16 total → ~11 usable — ⚠️ tight and risky</li><li>/29 or smaller → basically unusable in AWS</li></ul><blockquote><strong>Rule of thumb:</strong> use /24 or larger for production subnets. For Lambda, Fargate, and EKS with high ENI churn, prefer /23 or /22.</blockquote><h4>Enforcement — make it automatic, not manual</h4><p>Spreadsheets break. Humans forget. Automation checks and gates:</p><ul><li><strong>AWS VPC IPAM</strong> — central allocation, automatic conflict detection, and reporting.</li><li><strong>CloudFormation Guard</strong> — reject templates with bad CIDRs before deploy.</li><li><strong>Terraform validators</strong> — module-level checks to prevent bad inputs.</li><li><strong>AWS Config rules</strong> — scan existing infra and alert on overlaps.</li><li><strong>Ticketing + registry</strong> — every CIDR allocation must be recorded and approved (IPAM can hold this).</li></ul><blockquote><strong>Key mindset:</strong> treat CIDR planning like capacity planning. Over-allocate, enforce by code, and document everything.</blockquote><h4>Mini ASCII diagram (Region → VPC → Subnet)</h4><pre>Region (10.32.0.0/12)<br> ├─ VPC-A 10.32.0.0/16<br> │   ├─ Public   10.32.10.0/24<br> │   ├─ App      10.32.20.0/24<br> │   └─ DB       10.32.30.0/24<br> ├─ VPC-B 10.34.0.0/16   &lt;-- buddy 10.33.0.0/16 kept free for growth<br> └─ Reserved pool 10.240.0.0/12 (M&amp;A, new regions)</pre><h3>Observability — Catch Problems Before They Catch You</h3><p>Even with the best planning, overlaps slip through. Observability helps you catch them before they break production. Let’s consider some approaches we can utilize efficiently, considering SRE best practices ( preventive + reactive approaches):</p><h4><strong>AWS Config Rules (preventive)</strong></h4><p>Use the built-in rule to detect overlapping CIDRs:</p><pre>aws configservice put-config-rule --config-rule &#39;{<br>  &quot;ConfigRuleName&quot;: &quot;vpc-cidr-overlap-check&quot;,<br>  &quot;Source&quot;: { &quot;Owner&quot;: &quot;AWS&quot;, &quot;SourceIdentifier&quot;: &quot;VPC_CIDR_BLOCK_OVERLAP&quot; }<br>}&#39;</pre><h4><strong>CloudWatch Metrics (reactive)</strong></h4><p>Track signals that often point to CIDR conflicts:</p><ul><li>🚫 Transit Gateway attachment failures</li><li>❌ VPC peering “overlap detected” errors</li><li>🔌 PrivateLink connection failures</li><li>🌐 VPN/Direct Connect route conflicts</li></ul><h4><strong>Custom Audits (proactive)</strong></h4><p>Run a weekly Lambda to scan all accounts/regions for overlaps and push to Slack/Dynatrace/Datadog:</p><pre>overlaps = detect_cidr_overlaps(vpc_list)<br>if overlaps:<br>    send_slack_alert(f&quot;CIDR overlap detected: {overlaps}&quot;)</pre><h4><strong>Alerts That Matter</strong></h4><ul><li>A new VPC created with overlapping CIDR</li><li>Any failed peering or TGW attachment</li><li>Repeated PrivateLink connection errors</li></ul><blockquote>👉 The goal: know within <strong>hours</strong> of a conflict, not <strong>weeks</strong> later when an integration silently fails.</blockquote><h3>Solutions &amp; Workarounds — Fix It (or Avoid It)</h3><p>Even with the best planning, overlaps sometimes slip into production. Here’s how to handle them.</p><h4>Prevention (the boring but best option)</h4><ul><li><strong>Central IPAM (AWS VPC IPAM)</strong> — one source of truth for CIDRs</li><li><strong>Guardrails in code</strong> — CloudFormation Guard / Terraform validators to block bad ranges</li><li><strong>Naming + bands</strong> — standard notation (10.32.10.0/24 = Public, 10.32.20.0/24 = App, etc.)</li><li><strong>Change gates</strong> — any new VPC or secondary CIDR requires approval + registry entry</li></ul><blockquote>👉 Prevention is cheaper than migration. Treat CIDR planning like capacity planning.</blockquote><h4>Remediation (when it’s already broken)</h4><p><strong>Option A — Secondary CIDR (incremental, safer, but longer)</strong></p><ul><li>Add a non-overlapping block, e.g. 10.31.0.0/16</li><li>Create new subnets, migrate workloads gradually</li><li>✅ Less risky, can be phased</li><li>❌ Routing complexity, dual-CIDR headaches</li></ul><p><strong>Option B — NAT / Proxy (quick workaround)</strong></p><ul><li>Insert a NAT GW, proxy, or ALB/API GW between overlapping VPCs</li><li>✅ Fast, no re-IP</li><li>❌ Latency (10–50ms), egress $0.045/GB, not universal (HTTP/HTTPS only)</li></ul><p><strong>Option C — Full Re-IP (painful , fast, high possibility of bugs)</strong></p><ul><li>Build a new VPC with a safe CIDR (10.33.0.0/16)</li><li>Recreate subnets, SGs, NACLs</li><li>Blue/green migrate workloads (<strong>Route53 weighted routing</strong> for gradual cutover, <strong>AWS DMS</strong> for database migrations)</li><li>✅ Clean slate, future-proof</li><li>❌ 1–3 months effort, risk during cutover</li></ul><h4>Quick Decision Guide (TL;DR)</h4><ul><li>⏱ Need access <em>yesterday</em> → <strong>NAT/Proxy</strong></li><li>📆 Can migrate gradually → <strong>Secondary CIDR</strong></li><li>🧹 Too much mess, long-term view → <strong>Full Re-IP</strong></li></ul><p>This table demonstrates the pros and cons of each approach</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bBmqcH_cLPWPRS-GfD2AAQ.png" /></figure><blockquote>👉 <strong>Rule of thumb:</strong> NAT = patch, Secondary = band-aid, Re-IP = surgery.</blockquote><h4>ASCII Decision Tree (for the visual thinkers)</h4><pre>CIDR Conflict Detected<br>         |<br>    How urgent?<br>         |<br>    ┌────┴────┐<br>URGENT      CAN WAIT<br>    |           |<br>NAT/Proxy   How complex?<br>             |<br>        ┌────┴────┐<br>    SIMPLE    MESSY<br>        |         |<br>Secondary CIDR  Full Re-IP</pre><h3>Tools to Manage CIDRs</h3><h4>AWS Native</h4><ul><li><strong>VPC IPAM</strong> — allocates non-overlapping CIDRs, monitors utilization, and enforces policies.</li><li><strong>AWS Config Rules</strong> — detect overlaps automatically, trigger alerts.</li><li><strong>CloudFormation Guard</strong> — block bad templates at deployment.</li></ul><h4>Third-Party</h4><ul><li><strong>Terraform CIDR modules</strong> — with built-in validators.</li><li><strong>Network documentation tools</strong> — Lucidchart, Hava, or Visio for visibility.</li><li><strong>Enterprise IPAM</strong> — Infoblox, SolarWinds for complex orgs.</li></ul><h3>Wrap-Up: Your CIDR Survival Kit</h3><p>CIDR conflicts are AWS’s polite way of saying “no” when your networks try to talk.</p><p><strong>3-Step Survival Kit:</strong></p><ol><li><strong>Audit now</strong> — inventory all VPC CIDRs across accounts/regions.</li><li><strong>Reserve ruthlessly</strong> — plan buddy blocks and regional allocations.</li><li><strong>Automate everything</strong> — enforce policies in IPAM, Config, and IaC.</li></ol><p>CIDR planning isn’t a detail — it’s a growth guardrail.<br> Plan for connectivity from day one, or spend months untangling it later.</p><blockquote>👉 Remember: overlapping IPs don’t break your setup today. They break your <strong>future</strong>.</blockquote><p>📚 <strong>Related AWS Networking Traps</strong><br> If CIDR conflicts aren’t enough networking fun, check out 👉 <a href="https://aws.plainenglish.io/i-opened-port-443-why-is-my-app-still-broken-f965b89abef2"><strong>I Opened Port 443 — Why Is My App Still Broken?</strong></a><br> Another silent killer that trips up even experienced engineers.</p><h3>💬 <strong>Over to you</strong></h3><ul><li>Have you run into CIDR conflicts in your AWS projects?</li><li>What workarounds or best practices worked for you?</li><li>Did this article help you think about planning differently?</li></ul><p>If yes — drop your story in the comments 👇 I’d love to hear it.</p><p>And if you found this useful, hit <strong>Follow</strong> and give it a few <strong>claps</strong> 👏 so more engineers can avoid late-night CIDR nightmares.</p><h3>A message from our Founder</h3><p><strong>Hey, </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>Sunil</strong></a><strong> here.</strong> I wanted to take a moment to thank you for reading until the end and for being a part of this community.</p><p>Did you know that our team run these publications as a volunteer effort to over 3.5m monthly readers? <strong>We don’t receive any funding, we do this to support the community. ❤️</strong></p><p>If you want to show some love, please take a moment to <strong>follow me on </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>LinkedIn</strong></a><strong>, </strong><a href="https://tiktok.com/@messyfounder"><strong>TikTok</strong></a>, <a href="https://instagram.com/sunilsandhu"><strong>Instagram</strong></a>. You can also subscribe to our <a href="https://newsletter.plainenglish.io/"><strong>weekly newsletter</strong></a>.</p><p>And before you go, don’t forget to <strong>clap</strong> and <strong>follow</strong> the writer️!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a7740f74ab2" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/cidr-conflicts-in-aws-why-your-vpcs-wont-connect-5a7740f74ab2">CIDR Conflicts in AWS: Why Your VPCs Won’t Connect</a> was originally published in <a href="https://aws.plainenglish.io/">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Opened Port 443. Why Is My App Still Broken?]]></title>
            <link>https://aws.plainenglish.io/i-opened-port-443-why-is-my-app-still-broken-f965b89abef2?source=rss-c4d6c55fa81b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f965b89abef2</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-security]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws-ec2]]></category>
            <dc:creator><![CDATA[Vitalii Vostotskyi]]></dc:creator>
            <pubDate>Wed, 03 Sep 2025 18:08:47 GMT</pubDate>
            <atom:updated>2025-09-04T14:02:41.696Z</atom:updated>
            <content:encoded><![CDATA[<p>I opened port 443 in the security group. <br>I allowed inbound traffic in the NACL. <br>My app is listening on HTTPS. <br>So why am I still getting timeouts?</p><p>Have you also faced this pain? Welcome to the ephemeral port traps world :)</p><h3>Real-World Use Case: Startup’s API Launch Goes Wrong</h3><h4>The Story</h4><p>A small startup wants to launch its HTTPS API. They spin up a <strong>t3.medium</strong> in a public subnet with an Elastic IP. Everything works locally.</p><blockquote>“Let’s add some security?”</blockquote><p>As the first step, they decided to add a security group instead of the default:</p><pre>+-----------+----------+------+-------------+--------+---------------------------+<br>| Direction | Protocol | Port |   Source    | Action | Note                      |<br>+-----------+----------+------+-------------+--------+---------------------------+<br>| Inbound   | TCP      | 443  | 0.0.0.0/0   | Allow  | They added                |<br>| Outbound  | All      | All  | 0.0.0.0/0   | Allow  | Aready was there (default)|<br>+-----------+----------+------+-------------+--------+---------------------------+</pre><blockquote><em>“Looks good! Let’s add some NACL rules thеn?”</em></blockquote><pre>+--------+-----------+----------+------+-------------+--------+<br>| Rule # | Direction | Protocol | Port |   Source    | Action |<br>+--------+-----------+----------+------+-------------+--------+<br>| 100    | Inbound   | TCP      | 443  | 0.0.0.0/0   | ALLOW  |<br>+--------+-----------+----------+------+-------------+--------+</pre><h4>First test-something went wrong</h4><pre><br>curl https://api.startup.com/health<br># Connection timeout...</pre><blockquote>“Oh, we forgot to add an outbound rule, let’s fix it!”</blockquote><h4>Second Attempt — Add Outbound 443</h4><pre>+--------+-----------+----------+------+-------------+--------+<br>| Rule # | Direction | Protocol | Port | Destination | Action |<br>+--------+-----------+----------+------+-------------+--------+<br>| 100    | Inbound   | TCP      | 443  | 0.0.0.0/0   | ALLOW  |<br>| 120    | Outbound  | TCP      | 443  | 0.0.0.0/0   | ALLOW  |<br>+--------+-----------+----------+------+-------------+--------+</pre><blockquote>“Should work? Let’s check:”</blockquote><pre><br>curl https://api.startup.com/health<br># Still timeout...</pre><p><strong>Team:</strong> <em>“WTF? Port 443 is open both ways!”</em></p><h4>The Real Fix</h4><p>After troubleshooting and reviewing the setup, the correct configuration was applied, which looks like this:</p><pre>+--------+-----------+----------+-------------+-------------+--------+<br>| Rule # | Direction | Protocol | Port Range  | Destination | Action |<br>+--------+-----------+----------+-------------+-------------+--------+<br>| 100    | Inbound   | TCP      | 443         | 0.0.0.0/0   | ALLOW  |<br>| 130    | Outbound  | TCP      | 32768-65535 | 0.0.0.0/0   | ALLOW  |<br>+--------+-----------+----------+-------------+-------------+--------+</pre><p>And voila- it finally works! What is the difference from the previous version? A range of ports, which are called <strong>ephemeral</strong>, is used as an outbound rule. Weird range, right? But still good enough to break HTTPS connection.</p><p>The diagram below shows how the resources were configured:</p><figure><img alt="Diagram: HTTPS request reaches EC2, but the response is blocked by NACL" src="https://cdn-images-1.medium.com/max/941/1*K9LCBVWMEnslJ94Gp07ikg.jpeg" /><figcaption>Diagram: EC2 receives an HTTPS request — but NACL blocks the response due to a missing outbound ephemeral port rule.</figcaption></figure><h3>Long Story Short: Why It Broke</h3><p>Two simple mistakes broke HTTPS:</p><p><strong>Missing outbound NACL rule</strong><br> → NACLs deny everything by default. No outbound rule = responses can’t leave the subnet.</p><p><strong>Wrong outbound port (443)</strong><br> → HTTPS responses use random <strong>ephemeral ports</strong> (32768–65535), not 443. The server can&#39;t reply to the client&#39;s port — so the connection silently fails.</p><p>Let’s dive deeper into how these layers actually work:</p><ul><li>How NACLs and Security Groups actually work? How can we imagine them as something from our real life?</li><li>What are ephemeral ports — and why they matter</li><li>Default AWS behaviors you should never assume</li><li>Troubleshooting checklist for broken HTTPS on EC2 (and not only)</li></ul><h3>Two Security Layers. One Common Mistake</h3><p>When configuring network access in AWS, many engineers fall into the same traps:</p><ol><li><strong>They assume default Security Groups or NACLs are “secure enough.”</strong></li><li><strong>They forget how SGs and NACLs actually work — especially the difference between stateful and stateless behavior.</strong></li><li><strong>They don’t realize these layers interact — and one misconfigured rule can silently break everything.</strong></li></ol><p>Let’s break it down, step by step.</p><h4>What Are Security Groups and NACLs?</h4><p>Think of the network as a building with multiple levels of security:</p><ul><li><strong>Security Group</strong> is your hotel doorman — he checks who’s allowed in, and remembers who’s already inside.</li><li><strong>NACL</strong> is like airport security — no memory at all. Everyone is checked both when entering and leaving.</li></ul><p>Here’s how they differ technically:</p><pre>+---------------+----------------+-----------+---------+---------+<br>| Layer         | Acts On        | Stateful? | Inbound | Outbound|<br>+---------------+----------------+-----------+---------+---------+<br>| Security Group| EC2 instance   | ✅ Yes    | ✅ Yes  | ❌ No    |<br>| NACL          | Subnet         | ❌ No     | ✅ Yes  | ✅ Yes   |<br>+---------------+----------------+-----------+---------+---------+</pre><h4>AWS Defaults That Can Be Misleading</h4><p>Some of the most confusing behavior comes from AWS defaults — especially when switching to custom configurations:</p><pre>+----------------+--------------------------------+------------------+<br>| Component      | Default Inbound                | Default Outbound |<br>+----------------+--------------------------------+------------------+<br>| Security Group | ❌ Deny all (except from self) | ✅ Allow all      |<br>| Default NACL   | ✅ Allow all                   | ✅ Allow all      |<br>| Custom NACL    | ❌ Deny all                    | ❌ Deny all       |<br>+----------------+--------------------------------+------------------+</pre><blockquote>“Remember what happened to our startup? They replaced the default NACL with a custom one — and that broke their setup at step one.”</blockquote><p><em>No outbound rule → no HTTPS response → timeout.</em></p><p>Now let’s move to <strong>step two</strong> of their mistake — the part that’s less obvious:</p><p>Even when they added an outbound rule on port 443, <strong>it still didn’t work</strong>.</p><p>Why? Because HTTPS responses don’t go out on port 443 — they use <strong>ephemeral ports</strong>.</p><h4>What Are Ephemeral Ports — and Why They Matter</h4><p>Let’s go one level deeper.</p><p>When a client (browser, Postman, curl, etc.) connects to your HTTPS API on port 443, it doesn’t just “use port 443.” It picks a <strong>random high-numbered port</strong> on its side — called an <strong>ephemeral port</strong>.</p><p>This is how the flow looks:</p><pre>+---------+                          +---------+<br>| Client  | -- 54321 → 443 [Req] --&gt; | Server  |<br>|         | &lt;-- 443 → 54321 [Resp] --|         |<br>+---------+                          +---------+</pre><p>So what’s really happening?</p><ul><li>The <strong>client</strong> <strong>opens a temporary port</strong> (e.g., 54321)</li><li>Your EC2 receives the request on<strong> port 443</strong></li><li>Then EC2 <strong>sends the response back</strong> to the client’s <strong>ephemeral port</strong></li></ul><p>And here’s the catch: if your <strong>NACL doesn’t allow outbound traffic</strong> <strong>to that port range</strong>, the response gets dropped — silently. No error, no logs. Just timeouts.</p><h4>Ephemeral Port Ranges</h4><p>Different operating systems use different ranges:</p><pre>+-------------+-----------------------+<br>| OS          | Ephemeral Ports       |<br>+-------------+-----------------------+<br>| Linux       | 32768–65535           |<br>| Windows.    | 1024–65535            |<br>+-------------+-----------------------+<br><br>*Note: The range may vary depending on OS version and system settings.</pre><p>That means if your clients are on Windows (common in corporate environments), you might need to <strong>allow a much wider range</strong> in your NACL outbound rules.</p><h4>TL;DR:</h4><p>You don’t know in advance what port the client will use. That’s why your NACL has to allow a full <strong>ephemeral range </strong>— or HTTPS will break in weird, hard-to-debug ways.</p><h3>The Fix — Two Simple Steps</h3><p>Now that we understand what went wrong, let’s fix it — in two commands per layer:</p><h4>1. Security Group (stateful)</h4><pre>aws ec2 authorize-security-group-ingress <br>  --group-id sg-xxxx <br>  --protocol tcp --port 443 --cidr 0.0.0.0/0</pre><p>Result:</p><ul><li>Inbound 443 allowed</li><li>Outbound handled automatically</li></ul><h4>2. Network ACL (stateless)</h4><pre># Inbound 443<br>aws ec2 create-network-acl-entry <br>  --network-acl-id acl-xxx <br>  --rule-number 100 <br>  --protocol tcp <br>  --port-range From=443,To=443 <br>  --rule-action allow <br>  --cidr-block 0.0.0.0/0<br><br># Outbound ephemeral ports<br>aws ec2 create-network-acl-entry <br>  --network-acl-id acl-xxx <br>  --rule-number 110 <br>  --protocol tcp <br>  --port-range From=32768,To=65535 <br>  --rule-action allow <br>  --cidr-block 0.0.0.0/0 <br>  --egress</pre><p>Result:</p><ul><li>Both directions allowed</li><li>Now HTTPS works</li></ul><h3>HTTPS Troubleshooting Checklist</h3><p>Still seeing timeouts? Before blaming the app or the SSL cert, double-check these:</p><p><strong>EC2 &amp; Infrastructure:</strong></p><ul><li>☐ EC2 instance has Elastic IP</li><li>☐ Application is actually listening on port 443</li><li>☐ No iptables / host firewall blocking traffic</li><li>☐ Route Table allows 0.0.0.0/0 → Internet Gateway</li><li>☐ Elastic IP is correctly associated</li></ul><p><strong>Security Group:</strong></p><ul><li>☐ Inbound port 443 allowed</li><li>☐ Outbound is default (all allowed)</li><li>☐ Security group attached to correct EC2 instance</li></ul><p><strong>Network ACL:</strong></p><ul><li>☐ Inbound port 443 allowed</li><li>☐ <strong>Outbound ephemeral ports</strong> allowed (32768–65535 for Linux)</li><li>☐ Rules have correct priority numbers</li><li>☐ NACL associated with correct subnet</li></ul><h3>Key Takeaways</h3><ol><li><strong>SG ≠ NACL</strong>: They serve different purposes</li><li><strong>Stateful</strong> vs <strong>Stateless</strong> — impacts how traffic flows</li><li><strong>Ephemeral</strong> ports — easy to forget, crucial to remember</li><li>Always troubleshoot <strong>both layers</strong>, not just SG</li></ol><h3>Bottom Line</h3><p>Next time you see “Connection timeout” on port 443, remember: check what happens on the way back.</p><h3>Your Turn</h3><p>Have you run into this issue? What tripped you up the most? Let me know in the comments.</p><h3>A message from our Founder</h3><p><strong>Hey, </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>Sunil</strong></a><strong> here.</strong> I wanted to take a moment to thank you for reading until the end and for being a part of this community.</p><p>Did you know that our team run these publications as a volunteer effort to over 3.5m monthly readers? <strong>We don’t receive any funding, we do this to support the community. ❤️</strong></p><p>If you want to show some love, please take a moment to <strong>follow me on </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>LinkedIn</strong></a><strong>, </strong><a href="https://tiktok.com/@messyfounder"><strong>TikTok</strong></a>, <a href="https://instagram.com/sunilsandhu"><strong>Instagram</strong></a>. You can also subscribe to our <a href="https://newsletter.plainenglish.io/"><strong>weekly newsletter</strong></a>.</p><p>And before you go, don’t forget to <strong>clap</strong> and <strong>follow</strong> the writer️!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f965b89abef2" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/i-opened-port-443-why-is-my-app-still-broken-f965b89abef2">I Opened Port 443. Why Is My App Still Broken?</a> was originally published in <a href="https://aws.plainenglish.io/">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Your AWS Lambda Keeps Failing — And What IPs Have to Do With It]]></title>
            <link>https://towardsaws.com/why-your-aws-lambda-keeps-failing-and-what-ips-have-to-do-with-it-e16a813d6eac?source=rss-c4d6c55fa81b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e16a813d6eac</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[observability]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Vitalii Vostotskyi]]></dc:creator>
            <pubDate>Sun, 20 Jul 2025 21:13:25 GMT</pubDate>
            <atom:updated>2025-09-16T06:55:59.044Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why Your AWS Lambda Keeps Failing — And What IPs Have to Do With It</h3><p>Your app scales. Your Lambda doesn’t. It crashes with vague errors — no code bugs, no memory issues. Just one hidden enemy: <strong>your VPC is out of IPs.</strong></p><figure><img alt="AWS VPC diagram showing Lambda scaling failures caused by a small subnet CIDR block with limited IP addresses" src="https://cdn-images-1.medium.com/max/941/1*8HXyQr7eUtAmhbanIKwT9g.png" /><figcaption>Small CIDR in a private subnet can silently break Lambda scaling</figcaption></figure><blockquote>“We only have a few EC2s — why would we need a large CIDR block?”</blockquote><p>If you’ve ever thought this, you’re not alone. Many architectures start small, but when they scale, they break, often due to something you never expected: <strong>IP address exhaustion</strong>.</p><p>One of the most common symptoms? Lambda functions start failing with:</p><pre>EC2ThrottledException: Rate exceeded for ENIs</pre><p>This article breaks down why this happens, how Lambda actually uses IPs inside a VPC, and how to monitor and prevent these silent killers.</p><h3>What Causes EC2ThrottledException in Lambda?</h3><p>We often think of Lambda as something abstract — a lightweight, isolated serverless function.<br> But the moment it needs to talk to real infrastructure inside your VPC (like RDS, EFS, ElastiCache) — that illusion breaks.</p><p>Lambda suddenly needs <strong>a proper network presence</strong>.<br> And that means: <strong>ENIs</strong>, <strong>subnet IPs</strong>, and all the rules of traditional networking.</p><p>What is actually happening on VPC/Networking level when you connect an AWS Lambda function to a VPC?</p><ul><li>AWS creates <strong>Elastic Network Interfaces (ENIs)</strong> in your subnets.</li><li>Each concurrent execution of your function may require <strong>a new ENI</strong>, which needs <strong>an available IP address</strong> in that subnet.</li><li>If IPs run out → Lambda can’t create ENIs → <strong>invocations get throttled or fail</strong>.</li></ul><h3>Real-World Example: Crypto Transaction Processor</h3><p>A fintech company deployed a Lambda function to process cryptocurrency transactions in real-time.</p><p>In <strong>dev</strong>, everything worked flawlessly — low concurrency, no VPC bottlenecks, and stable performance. But in <strong>production</strong>, things changed fast.</p><p><strong>Architecture Overview:</strong></p><ul><li><strong>VPC Subnet</strong>: 10.31.0.0/27 → only 27 usable IPs (after AWS reservations)</li><li><strong>Peak Load</strong>: 40+ concurrent Lambda executions during market volatility</li><li><strong>Storage</strong>: Results written to EFS for compliance</li><li><strong>Timeline</strong>: 3 AM EST — Bitcoin hits new ATH, trading volume spikes <strong>10x </strong>💥💥</li></ul><p><strong>💥 The Breaking Point</strong><br>During a Bitcoin price spike, transaction volume exploded. Lambda tried to scale up — but failed.</p><p><strong>Simple Math:</strong><br>- 32 available IPs − 5 (reserved by AWS) = <strong>27 usable IPs</strong><br>- 40 concurrent executions → <strong>40 ENIs needed</strong> = 40 IP addresses<br>- <strong>Gap</strong>: Need 40, have 27 → <strong>13 IP shortage</strong></p><p><strong>Result</strong>: EC2ThrottledException → Failed transactions → Lost revenue → Angry customers</p><p><strong>🧊 The Hidden Cost</strong><br>What seemed like a “serverless” solution was still bound by <strong>traditional networking constraints</strong>. <br>Their <strong>CIDR block</strong>, not the <strong>Lambda logic</strong>, became the point of failure.</p><p><strong>🪓 The Irony </strong><br>They had infinite Lambda concurrency available , but were killed by a <strong>/27</strong> subnet planned for “just a few resources.”</p><h3>⚙️ What Eats Up Your IPs in VPC?</h3><p>Lambda isn’t the only culprit. Many AWS resources silently consume IP addresses during runtime , especially when scaling or interacting with VPC components. These allocations often stay hidden until your subnet runs out of space.</p><p>🧮 Compute Layer</p><p>EC2 Instances<br> • Uses: 1 IP per instance<br> • Watch out: Auto Scaling Groups can quickly exhaust small subnets</p><p>Lambda (connected to VPC)<br> • Uses: 1 IP per concurrent execution (via ENI)<br> • Watch out: Spiky workloads can create sudden IP demand</p><p>ECS Fargate<br> • Uses: 1 IP per task<br> • Watch out: Microservices × replicas = rapid IP consumption</p><p>ECS (EC2 + awsvpc)<br> • Uses: 1 IP per task<br> • Watch out: Dense task placement can surprise you</p><p>🌐 Networking</p><p>NAT Gateway<br> • Uses: 1 IP per gateway<br> • Watch out: Multi-AZ setups multiply this</p><p>ALB / NLB<br> • Uses: 2–3 IPs per AZ<br> • Watch out: Cross-AZ load balancers add up fast</p><p>VPC Endpoints (Interface)<br> • Uses: 1 IP per AZ per endpoint<br> • Watch out: Multiple endpoints × multiple AZs</p><p>Transit Gateway Attachments<br> • Uses: 1 IP per attachment<br> • Watch out: Multi-VPC architectures scale this quickly</p><p>🗄️ Data Layer</p><p>RDS (including Aurora)<br> • Uses: 1 IP (2 for Multi-AZ)<br> • Watch out: Aurora clusters can have many reader replicas</p><p>ElastiCache<br> • Uses: 1 IP per node<br> • Watch out: Redis clusters with multiple shards</p><p>Redshift<br> • Uses: 1 IP per node<br> • Watch out: Large clusters for analytics workloads</p><h3>🛡️ Monitoring IP Usage Proactively</h3><p>Now that you understand the root cause, let’s talk about catching this problem before it catches you.</p><p>The best defense? Proactive observability. We can periodically check available IPs in each subnet and trigger alerts when usage crosses dangerous thresholds — before services start failing.</p><p>There are many approaches, but the most straightforward and reliable method is a lightweight Lambda function that reports IP utilization to CloudWatch. This technique is:</p><ul><li>Fast to implement (15 minutes setup)</li><li>Cost-effective (pennies per month)</li><li>SRE-aligned (early detection + graceful degradation)</li></ul><p><strong>How It Works:</strong></p><ol><li>Scheduled Lambda runs every 5–15 minutes (via EventBridge)</li><li>It checks all subnets using the describe_subnets API</li><li>It calculates IP utilization per subnet</li><li>It pushes metrics to CloudWatch under a custom namespace</li><li>CloudWatch alerts you when thresholds are crossed</li></ol><p>Sample Lambda code (in Python):</p><pre>import boto3<br><br>def lambda_handler(event, context):<br> ec2 = boto3.client(&#39;ec2&#39;)<br> cloudwatch = boto3.client(&#39;cloudwatch&#39;)<br> subnets = ec2.describe_subnets()[&#39;Subnets&#39;]<br><br> for subnet in subnets:<br>  subnet_id = subnet[&#39;SubnetId&#39;]<br>  available_ips = subnet[&#39;AvailableIpAddressCount&#39;]<br>  total_ips = 2**(32 - int(subnet[&#39;CidrBlock&#39;].split(&#39;/&#39;)[1])) - 5<br>  utilization = ((total_ips - available_ips) / total_ips) * 100<br><br>  # Send to CloudWatch<br>  cloudwatch.put_metric_data(<br>   Namespace=&#39;VPC/IPUsage&#39;,<br>   MetricData=[{<br>    &#39;MetricName&#39;: &#39;IPUtilization&#39;,<br>    &#39;Dimensions&#39;: [{&#39;Name&#39;: &#39;SubnetId&#39;, &#39;Value&#39;: subnet_id}],<br>    &#39;Value&#39;: utilization,<br>    &#39;Unit&#39;: &#39;Percent&#39;<br>   }]<br>  )<br><br>  # Optional: Log for debugging<br>  print(f&quot;Subnet {subnet_id}: {utilization:.1f}% IP usage&quot;)</pre><p><strong>Set Up Alerts:</strong></p><p>Recommended thresholds:<br> 80% → ⚠️ Warning (time to plan expansion)<br> 90% → 🚨 Critical (immediate action needed)</p><blockquote>Pro tip: Also, create alerts for Lambda EC2ThrottledException errors as a backup detection method.</blockquote><p>Sample CloudWatch Alarm (CLI command):</p><pre>aws cloudwatch put-metric-alarm<br>--alarm-name &quot;IP-Usage-Critical&quot;<br>--metric-name IPUtilization<br>--namespace VPC/IPUsage<br>--threshold 90<br>--comparison-operator GreaterThanThreshold<br>--alarm-actions arn:aws:sns:region:account:ip-alerts</pre><p>The result: You’ll know about IP exhaustion <strong>hours</strong> or <strong>days</strong> before it impacts production, not during a 3 AM incident! 🌙</p><h3>💡 Plan for Scale, Not Regret</h3><p><strong>✅ Best Practices: Your IP Exhaustion Prevention Checklist</strong></p><p>Here’s your battle-tested survival guide to avoid 3 AM production incidents:</p><p><strong>🎯 CIDR Sizing (Stop Guessing, Start Planning):</strong></p><ul><li>Production VPC: /16 CIDR block — gives you room to breathe</li><li>Production subnets: /24 minimum (251 usable IPs) — don’t cheap out here</li><li>Heavy Lambda/Fargate workloads: /23 or /22 — because concurrency is unpredictable</li><li>QA/Testing: /25 can work, but watch it like a hawk</li></ul><blockquote>💡 Golden Rule: If you’re asking “is this subnet big enough?” — make it bigger.</blockquote><p><strong>🔍 Monitoring (Know Before You Blow):</strong></p><ul><li>Set up IP usage monitoring (see our Lambda script above)</li><li>Alert at 80% usage — this is your “time to plan” moment</li><li>Alert at 90% usage — this is your “drop everything and fix” moment</li><li>Track EC2ThrottledException in CloudWatch Logs</li></ul><p><strong>🏗️ Architecture Patterns That Actually Work:</strong></p><ul><li>Separate by service type: Don’t mix Lambda and ECS in the same tiny subnet</li><li>Multi-AZ Lambda: Spread functions across 2–3 subnets for resilience</li><li>Reserve capacity: Plan for 3–5x growth, not just current load</li><li>One big subnet ≠ good: Better to have multiple medium subnets</li></ul><p>🚨 Red Flags to Watch For</p><ul><li>Your Lambda functions share a /27 with anything else</li><li>You have auto-scaling groups in small subnets</li><li>You see intermittent EC2ThrottledException errors</li><li>Your monitoring shows gradual IP consumption growth</li></ul><blockquote>Remember: Over-provisioning subnets costs you nothing. Under-provisioning costs you sleep. 😴</blockquote><h3>📌 Conclusion: IP Planning = Resilient Architecture</h3><p>Running out of IPs won’t break your build. It won’t throw an error in your console. But it <strong>will</strong> break production when Lambda can’t scale — and it’ll do it silently, at the worst possible moment.</p><p>CIDR and subnet planning aren’t “networking details.” They’re part of your <strong>core infrastructure design </strong>— just like memory, CPU, or scaling policies.</p><p>Remember: IPs are finite. <strong>Plan like they aren’t</strong>.</p><p>Enjoyed this post? Follow me for more real-world AWS breakdowns. Let me know in the comments if you’ve hit IP exhaustion in the wild :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e16a813d6eac" width="1" height="1" alt=""><hr><p><a href="https://towardsaws.com/why-your-aws-lambda-keeps-failing-and-what-ips-have-to-do-with-it-e16a813d6eac">Why Your AWS Lambda Keeps Failing — And What IPs Have to Do With It</a> was originally published in <a href="https://towardsaws.com/">Towards AWS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Safely Testing and Pushing Branches in a Forked Repository: A Step-by-Step Guide]]></title>
            <link>https://medium.com/@vostotskiy/safely-testing-and-pushing-branches-in-a-forked-repository-a-step-by-step-guide-f9993322a633?source=rss-c4d6c55fa81b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9993322a633</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[devops-tips]]></category>
            <category><![CDATA[git-best-practices]]></category>
            <category><![CDATA[version-control]]></category>
            <dc:creator><![CDATA[Vitalii Vostotskyi]]></dc:creator>
            <pubDate>Mon, 25 Nov 2024 22:01:49 GMT</pubDate>
            <atom:updated>2024-11-25T22:01:49.755Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qZQw6ajauqm9YgCYhrK-NQ.jpeg" /></figure><p>Ever accidentally pushed untested code to staging and scrambled to recover? Working with forked repositories can save you—but only if you know the best practices. In this guide, we’ll cover how to safely test and push branches while avoiding costly mistakes like overwriting shared branches or losing original branch states.</p><h3>Understanding Forked Repositories</h3><p>A forked repository is your personal copy of another user’s repository. Think of it as creating your own parallel universe of the codebase where you can:</p><ul><li>Experiment freely without affecting the original code</li><li>Develop new features independently</li><li>Contribute to open-source projects safely</li><li>Maintain your own version while staying synchronized with the original</li></ul><h4>Why Fork Instead of Direct Access?</h4><ol><li><strong>Safety First</strong>: Forking prevents accidental changes to the main codebase</li><li><strong>Isolation</strong>: Your changes remain separate until explicitly reviewed and merged</li><li><strong>Team Workflow</strong>: Enables code review processes and quality control</li><li><strong>Version Control</strong>: Maintains clean history of contributions</li></ol><h3>Why This Matters</h3><p>Git mistakes can be costly. Accidentally overwriting shared branches or pushing untested code can halt team productivity and create merge conflicts. This guide helps you avoid these issues while maintaining a safe testing environment.</p><h3>Common Pitfalls to avoid</h3><ul><li>Directly pushing to shared branches without testing</li><li>Losing original branch state during testing</li><li>Creating conflicts for team members</li><li>Lacking recovery options if tests fail</li></ul><h3>Best Practices for Forked Repositories</h3><p><strong>1. Regular Synchronization</strong></p><ul><li>Keep your fork updated with the upstream repository.</li><li>Resolve conflicts early to avoid surprises later.</li></ul><p><strong>2. Branch Organization</strong></p><ul><li>Use clear naming conventions, e.g., feat/feature-name or test/integration-test.</li><li>Maintain separate branches for feature development, testing, and recovery.</li></ul><p><strong>3. Documentation</strong></p><ul><li>Record test scenarios and results.</li><li>Document environment-specific requirements.</li><li>Keep track of successful/failed test combinations.</li></ul><h3>Common Testing Scenarios and Safety Measures</h3><h4>Scenario 1: Feature Testing in Isolation</h4><p><em>Test your feature branch without affecting others.</em></p><pre># Create an isolated testing branch<br>git checkout -b test/feature-name-testing<br># Pull the latest staging branch<br>git pull upstream staging<br># Merge your feature branch into the testing branch<br>git merge feat/feature-name</pre><p><strong>Safety Tip:</strong> Always use a dedicated testing branch to avoid contaminating your feature branch.</p><h4>Scenario 2: Integration Testing with Multiple Features</h4><p><em>Combine multiple feature branches to test how they interact.</em></p><pre># Create an integration testing branch<br>git checkout -b test/integration-testing<br># Pull feature branches into the testing branch<br>git pull origin feat/feature-1<br>git pull origin feat/feature-2</pre><p><strong>Safety Tip:</strong> Document which features are included in your integration test to track results effectively.</p><h3>Recovery Strategies: Safely Push to Shared Branches</h3><p>When testing on shared branches like staging, follow these steps to ensure a safe and recoverable process:</p><h4>Preconditions:</h4><p>Before diving into the steps, let’s clarify the setup:</p><ul><li><strong>Forked Repository (Remote):</strong> Your personal fork of the repository.</li><li><strong>Original Repository (Upstream):</strong> The source repository where the shared branch resides.</li><li><strong>Target Branch:</strong> The shared branch (e.g., staging) you want to push to.</li><li><strong>Feature Branch:</strong> Your local development branch (e.g., feat/feature-name) in the forked repository.</li></ul><h4>Step-by-Step Workflow:</h4><h4>1. Create a Local Backup of the staging Branch:</h4><p>Switch to staging and pull the latest updates from upstream. Create a backup branch.</p><pre>git checkout staging<br>git pull upstream staging<br>git checkout -b staging-backup</pre><p><strong>2. Push Your Feature Branch to </strong><strong>staging:</strong><br>Switch to your feature branch and push it to the upstream staging branch for testing.</p><pre>git checkout feat/feature-name<br>git push upstream feat/feature-name:staging --force</pre><p><strong>3. Test Your Changes:</strong><br>Conduct your testing on the shared staging branch. If everything works, proceed confidently.</p><p><strong>4. Recover if Necessary:</strong><br>If something goes wrong, restore the original staging state from the backup branch.</p><pre>git push upstream staging-backup:staging --force</pre><p><strong>5. Cleanup:</strong><br>After successful testing, delete the backup branch locally.</p><pre>git branch -d staging-backup</pre><h3>Pro Tips for Safety</h3><ul><li><strong>Double-Check Your Backup:</strong> Ensure your staging-backup contains the latest updates before testing.</li><li><strong>Team Communication:</strong> Notify your team if others rely on the staging branch to avoid conflicts.</li></ul><h3>When to Use This Approach</h3><ul><li>Working on long-running feature branches</li><li>Testing complex feature interactions</li><li>Preparing for major releases</li><li>Collaborating with multiple team members</li></ul><p>By following this structured workflow, you can confidently test and push changes in a forked repository while ensuring a smooth and recoverable process. Happy coding!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uSb_cp9hxnLJNeHNfli27g.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9993322a633" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Simple Questions That Can Guide You to Your Dream Job]]></title>
            <link>https://medium.com/@vostotskiy/the-simple-questions-that-can-guide-you-to-your-dream-job-98687c330c8a?source=rss-c4d6c55fa81b------2</link>
            <guid isPermaLink="false">https://medium.com/p/98687c330c8a</guid>
            <dc:creator><![CDATA[Vitalii Vostotskyi]]></dc:creator>
            <pubDate>Wed, 08 May 2024 13:48:48 GMT</pubDate>
            <atom:updated>2024-05-08T16:16:37.979Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o6cNitBGCxkKp_YRuS5okQ.jpeg" /></figure><h3>Short Introduction</h3><p>I was inspired to write this article after reading a post by Victoria Prydatko, a well-known IT recruiter in Ukraine and abroad. In her personal blog on Facebook, she emphasized the importance of candidates asking questions during job interviews. Victoria expressed the opinion that companies value candidates who ask questions, as it demonstrates proactivity and genuine interest in the role. However, she noted that candidates often behave shyly and remain silent instead of seizing the opportunity to inquire.</p><p>After seeing other people’s responses, I recalled most of the questions which I very often asked in interviews with various companies, from small startups to top enterprise A-class giants. In this article, I will try to list those questions that were important to me personally, and I will also explain why the answers to the questions can be decisive not only for the hiring company but also for a potential employee who is looking for a favourable and mutually beneficial workplace.</p><p>I will not list all possible questions but rather focus on some of them that, when asked during the interview, allowed me to learn a lot about the internal processes of the company and to understand what can be expected from cooperation in certain aspects because there is nothing worse than unmet expectations.</p><h3>Yes, It Is Important</h3><p>As a prologue, I want to note that I agree with what Victoria says, because from my personal experience of preparing for an interview as an engineer, recruiters often advised not only to research the company and its products but also to ask as many questions as possible about the tools, processes, team, therefore, this approach is really important; otherwise, many outsourcing companies would not include this point in the process of preparing for interviews. On the other hand, many hiring managers from large technology companies advise the same because, for them personally, the person asking questions is both proactive and engaged in the process of learning about the company, ready to learn, willing to contribute to the company’s development and life, and wants to understand how to do it. All of the above is undoubted, but there are other aspects that are very important, that is, what value the company represents to you, how it will complement your life, what it will take, what it will share in return.</p><p>Having sufficiently delved into philosophy, let’s move on to the practical part and try to formulate questions that, on the one hand, will show interest and proactivity, and on the other hand, will allow us as potential employees to understand many values (existing or, sadly, absent) that can form a picture of how the cooperation will turn out in the following years (or it will not work out if you realize that this is not your path).</p><h3>Brothers in arms</h3><p><strong><em>Tell me, please, who does the team consist of, and what principle is it formed by?</em></strong></p><p>This issue is important because it reveals the matter of internal work organization. Often in product companies, teams are cross-functional, working on a large number of applications, or focused on certain features or applications. In cross-functional teams, it is very easy to grow “wide,” it is a more dynamic environment that will be comfortable for people who like to multitask and lose focus. On the other hand, a team dedicated to a specific feature is an opportunity to grow “in depth,” delve into the details of the domain, understand everything in its intricacies, and accumulate internal expertise within the team. In such an environment, it is a little easier to plan, because everyone knows what has already been done, there is less context-switching, and in my opinion, there is less chance of new mistakes, since the key here is the developers’ understanding of the domain specifics. If the product is young, or the company does not have a clear division into teams, accordingly, you should expect the former, cross-functional division, and have corresponding expectations for the work style.</p><p><strong><em>Does the team have their own business analyst or product manager?</em></strong></p><p>In my opinion, this question is quite important for product teams anchored by features because by having their own product owner or business analyst, the team can accumulate internal expertise and get clearer documents, requirements, and specifications. In turn, in the development process, you can focus on more accurate documents, accordingly — the tasks will be better evaluated and will better meet the specifications. Often, in the absence of a business analyst or product owner assigned to the team, part of the documentation is written by the team, accordingly, such tasks may be assigned to you.</p><p><strong><em>Is there a separate (dedicated) quality assurance engineer in the team?</em></strong></p><p>In my opinion, in product teams, the QA engineer is as important as the dedicated product owner because it allows them to accumulate domain expertise and do their job more clearly. However, very often in some startups, there are no testers at all; they are replaced by certain types of tests, or other team members perform their role. Accordingly, the responsibility for quality and possible bugs rests entirely on the shoulders of the developers.</p><p><strong><em>Can people work in multiple teams at the same time, or change teams over time?</em></strong></p><p>Over time, each person may lose interest in the tasks they perform; the tasks will seem more routine and monotonous. The opportunity to move to another team will allow you to breathe new life into work, get to know the new team more closely and understand the new domain. The presence of such a process in the company is a big plus; it shows the desire not to say goodbye to valuable employees for as long as possible and to allow them to evolve within the company. In some companies, there is an opportunity not only to change the team but also to change the position, and this is also a big plus and an additional opportunity.</p><h3>Expectations need to be met</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JB-OtPrA842QsHS0_-ZYOg.jpeg" /></figure><p><strong><em>What are the company’s expectations from a person in this position?</em></strong></p><p>The answer to this question will allow you to understand exactly how the company understands the ideal candidate, what characteristics it pays attention to, how it evaluates success, and which characteristics it puts the highest priority on. If a person already has work experience in the position they are applying for, you can compare the company’s expectations with their own experience and understand to what extent they will succeed or fail to meet them. The more precise and structured these expectations are defined, the more precisely the processes in the company are worked out.</p><p><strong><em>What daily tasks should be performed?</em></strong></p><p>The answer to the second question will give a very clear understanding of what tasks a person performs in their current position, with whom they communicate, to whom they report, and what circle of communication and responsibility they may have. This question comes closest to understanding what will have to be done directly from the first day in a new position. Often, in domain-based teams, the answers to these questions are more specific, while in cross-functional teams, they are more standard, templated, and high-level, because there may be few typical tasks</p><h3>Processes are the arteries of the company</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XB_JGciszg8X7Dv0S5HM9Q.jpeg" /></figure><p><strong><em>Does the company have an onboarding process, what does it consist of, and are there criteria for successfully completing onboarding?</em></strong></p><p>A clear and affirmative answer to this question means that the company has invested time and effort in creating processes, so you will have a clear plan and understanding of what is expected of you. This will allow you to focus on exactly those aspects of work that the company expects and by which it will evaluate your first steps. If there is no clear answer, you should be prepared for the fact that you will most likely have to do all the work to acquire knowledge yourself. There is a potential opportunity to create a process yourself — for example — in the form of a checklist of certain important stages recorded in the onboarding process and offer it to management for implementation. Such a manifestation of initiative rarely goes unnoticed. It is also worth taking into account that small and young startups rarely have processes in place from the start, so a certain chaos and lack of understanding of what to do is possible; besides, from the first days, you may be assigned real tasks. In this case, it is better to ask from the first days which people to turn to for various types of questions; this will make it much easier to find answers to your own questions.</p><p><strong><em>What is the probation period, and what is the criterion for it being closed? What distinguishes the probation period from the next stage?</em></strong></p><p>The answer to this question will reveal what to expect. Often, during the probation period, some companies limit some benefits for their employees, for example, they do not compensate for sick leave, they do not issue work equipment, so the answer to this question will give an understanding and expectations for vacation planning, for example. In some companies, there are no restrictions at all, and in its own way, this is a plus because a person has less stress, and gets all the necessary tools and preferences at once. Also, by understanding what exactly the company expects during the probation period, you can focus on these aspects, leaving other aspects in second place, which will allow you to pass the probation period favourably and fruitfully.</p><p><strong><em>How are technical and architectural decisions made, and is there an opportunity to be involved in the decision-making process?</em></strong></p><p>Very often, employees want to understand the process of distribution of responsibilities in the company and the opportunity to be involved in decision-making, especially with their expertise. Why not join the discussion and offer something from your experience? Or not warn about possible problems with the chosen solution that occurred on previous projects? Therefore, it is necessary to understand whether there is potentially such an opportunity. As an additional bonus, a potential new colleague with such questions shows their proactivity and interest in taking responsibility, which is generally positively evaluated by hiring managers. In some companies, large architectural decisions are made by a certain group of people, for example, a separate guild of architects and experienced leaders, and simpler decisions can be designed at the product team level. In others, on the contrary, developers have complete freedom to make decisions at the level of the entire platform. Accordingly, understanding the processes will allow you to understand your own capabilities and limitations.</p><p><strong><em>Is it possible to grow to level N or take on the functions of position N?</em></strong></p><p>The answer to this question potentially shows the candidate is interested in growth. On the other hand, the possibility of growth and prospects for transition (and the mechanisms that exist in the company) must be understood. In some companies, due to different specifics, it is very difficult to get a promotion and move to the next level; you can wait for years and still not get what you want. In others, on the contrary, by making efforts and proving your contribution, you can move up the career ladder. So, for a person with certain ambitions and a growth plan, it is a matter of opportunities and limitations.</p><p><strong><em>How does the company engage in employee development?</em></strong></p><p>Very often, companies offer access to various courses, platforms, and certifications as a bonus. When asking this question, it is necessary to convey that work in IT (for example) is a constant process of improvement, and therefore it is always necessary to look for effective tools for training and practice. It is very good if the company has mentoring programs, and when together with managers, a PDP (personal development plan) is created for each employee; this is an indicator of the company’s readiness and desire to strategically prepare employees for more complex and responsible positions, rather than hiring ready-made ones. Understand your needs and compare them with what the company offers if you consider learning and development a priority for you.</p><p><strong><em>Is it possible to cooperate with stakeholders, and customers of the company?</em></strong></p><p>Very often, especially in large companies, when receiving a certain task for implementation, developers do not see the “full picture” or understand what real-world problem they are solving. Being able to communicate with customers or stakeholders can be very important to gaining deep domain knowledge and understanding of the issues. On the other hand, there are people who feel more comfortable in more “technical”, closed frameworks; communication with the “outside”, often a non-technical world can be stressful for them. So, understand for yourself what is important to you, which conditions of interaction and task performance are more in line with your work and communication style, and compare it with how the work is implemented in the company.</p><p><strong><em>Are there any on-call activities, and does this position involve participation in on-call shifts?</em></strong></p><p>On-call rotation is a common practice in many product companies when certain developers responsible for their areas or platforms have to monitor services from time to time and deal with solving problems if they occur. Often, such activities go beyond the working schedule; relatively speaking, it can be a duty day. By asking this question, you can understand whether such activity awaits you on the project and, accordingly, whether you will be ready to perform such tasks. In most cases, on-calls are handled by dedicated employees, but there are always exceptions to the rules.</p><h3>What about if…</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K5PbciDNMdCz9cibkHkk6w.png" /></figure><p><strong><em>Tell me, please, what does the company do if an employee loses his performance and has some issues with day-to-day duties?</em></strong></p><p>From time to time, situations can occur when a person loses motivation; it can be due to life troubles, personal tragedies, or unpleasant situations with employees. Often, companies have a set of tools for such scenarios, such as a Personal Improvement Plan, the ability to take unpaid long-term leave, or other tools, thus being able to help their employee with the solution of the situation. The presence of such tools is a big plus, which indicates that the company has invested time and effort in helping and keeping important employees as much as possible, and in difficult times, you can count on open help.</p><p><strong><em>If I eventually decide to leave the company, will I be able to come back?</em></strong></p><p>Unfortunately, under certain objective or subjective circumstances, people get let go. Sometimes for the sake of a certain, perhaps more ambitious project, sometimes due to health conditions, due to the inability to perform tasks. And it is very good when there is an opportunity to return to a company where everyone knows you well and where you once felt comfortable working. This is a plus both for the company, which understands what to expect from its employee, and for the employee, since everything is already clear and familiar to them. And it is a plus when a service or product company provides such an opportunity. Many developers are afraid to ask such questions in an interview because they consider it inappropriate from the point of view of finding a new job. However, in companies where this is implemented, HR or hiring managers themselves often talk about such cases, and consider such situations their pride. So the effect can be unexpectedly the opposite. I personally consider it a sign of great trust and respect when people return to the company after some life circumstances and are able to continue working in the conditions they are used to.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Iw7BonGsDORCOFoE0mwR5Q.jpeg" /></figure><p>In conclusion, asking the right questions during an interview can provide invaluable insights into a company’s culture, processes, and values. It demonstrates your proactivity, curiosity, and genuine interest in finding a mutually beneficial workplace. As we’ve discussed, questions about team structure, growth opportunities, knowledge-sharing, decision-making processes, and work-life balance can reveal crucial details that shape your overall experience.</p><p>I encourage you, dear readers, to share in the comments below the questions that you find most important to ask during interviews and what they help you understand about a potential employer. Your contributions will undoubtedly enrich this discussion and provide valuable perspectives for fellow professionals navigating the job market.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=98687c330c8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Effortless Code Quality with Husky: Mastering Pre-Commit Hooks]]></title>
            <link>https://medium.com/@vostotskiy/effortless-code-quality-with-husky-mastering-pre-commit-hooks-a7df7be2a8d4?source=rss-c4d6c55fa81b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7df7be2a8d4</guid>
            <category><![CDATA[developer-experience]]></category>
            <category><![CDATA[team-collaboration]]></category>
            <category><![CDATA[automation-tools]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Vitalii Vostotskyi]]></dc:creator>
            <pubDate>Wed, 01 May 2024 18:03:00 GMT</pubDate>
            <atom:updated>2024-05-01T18:03:00.977Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zzYkAjWYx7uD6HQG4hTeCw.jpeg" /><figcaption>Husky looks like a super hero :)</figcaption></figure><h3>Introduction</h3><p>In the fast-paced world of software development, maintaining high standards of code quality and consistency is paramount. However, achieving this goal can be challenging, especially in collaborative environments where multiple developers are working on the same codebase. In this chapter, we’ll delve into the value proposition of Husky pre-commit hooks and why they are indispensable tools for ensuring code quality and fostering a productive development culture.</p><p>While Husky offers numerous benefits for streamlining the development workflow and maintaining code quality, the key to successful implementation lies in a thoughtful and inclusive approach. The primary objective of this article is to provide practical recommendations and considerations that will help teams integrate Husky seamlessly into their existing processes without causing undue stress or frustration. Effective communication, comprehensive documentation, and a focus on enhancing the overall developer experience are paramount. By involving team members early on, addressing potential concerns, and highlighting the long-term advantages of using Husky, you can foster a collaborative environment where everyone understands the rationale behind adopting this tool. Ultimately, the goal is to make the transition as smooth as possible, empowering developers to embrace Husky as a valuable ally in their pursuit of high-quality, maintainable code.</p><h3>Invaluable benefits</h3><p>Most people consider Husky as a tool used to pretty code before making commit happened. However, it could be much more powerful. Implementing husky pre-commit hooks on any step of SDLC may bring significant improvements and incredibly simplify some processes, that could be automated with various libraries used to prettify, perform linting, static analysis, unit testing, standards alignment etc. Here are a short list of things can potentially play behind the scene and potentially improve development experience and flows in general:</p><ol><li>Consistency: Husky pre-commit hooks enforce consistent coding standards across the entire codebase, ensuring that all team members adhere to the same guidelines. This consistency improves code readability and maintainability, making it easier for developers to collaborate effectively.</li><li>Early Detection of Issues: By running checks before each commit, Husky pre-commit hooks enable developers to catch issues early in the development lifecycle. Whether it’s syntax errors, code formatting issues, or failing tests, Husky provides immediate feedback, allowing developers to address issues before they escalate.</li><li>Reduced Technical Debt: By enforcing best practices and coding standards from the outset, Husky pre-commit hooks help prevent the accumulation of technical debt. Addressing issues early reduces the likelihood of encountering major roadblocks down the line, saving time and resources in the long run.</li><li>Improved Code Reviews: Husky pre-commit hooks contribute to more efficient and effective code reviews by ensuring that code changes meet quality standards before they are submitted for review. This streamlines the code review process and reduces the likelihood of lengthy review cycles due to code quality issues.</li></ol><h3>Introducing Pre-Commit Hooks Without Disrupting Your Team’s Flow</h3><p>Making changes to existing processes can be challenging for most teams, and introducing new rules or updates may sometimes lead to discouragement or frustration. However, the goal of improving the development workflow remains a priority, and to make the adoption of pre-commit hooks smoother and more comfortable, a few considerations can help smooth out the rough edges:</p><p><strong>Being Clear on Why We Use It</strong></p><p>Introducing new tools and processes can sometimes be met with resistance or scepticism, especially if their value is not effectively communicated. When adopting Husky for pre-commit hooks, it’s crucial to explain to your team why this tool will ultimately help rather than hinder their workflow. Husky serves as a guardian of code quality, ensuring that every commit adheres to predefined standards and best practices. By automating linting, formatting, testing, and committing message validation, Husky streamlines the development process and fosters a collaborative environment where consistent coding conventions are maintained. Emphasize that these hooks are designed to catch issues early, preventing potential bugs and regressions from slipping through the cracks. Ultimately, Husky is a powerful ally in maintaining a high-quality codebase, enabling teams to focus on writing code rather than spending valuable time on manual checks and reviews.</p><p><strong>Documentation is Key</strong></p><p>Provide comprehensive documentation that explains when and why various pre-commit hooks will be executed. A dedicated section in your project’s documentation can serve as an excellent starting point for developers to understand the rationale behind these hooks and how they integrate into the overall workflow.</p><p>Here is an example on how it can look like:</p><pre># Project Name<br><br>## Pre-Commit Hooks with Husky<br><br>This project uses [Husky](https://github.com/typicode/husky) to enforce code quality and formatting standards through pre-commit hooks. These hooks will automatically run before each commit, ensuring that your code adheres to the project&#39;s guidelines and conventions.<br><br>### Installed Hooks<br><br>#### 1. Linting<br>- **JavaScript/TypeScript**: [ESLint](https://eslint.org/) is used to lint all JavaScript and TypeScript files according to the rules defined in `.eslintrc`.<br>- **CSS/SCSS/Sass**: [Stylelint](https://stylelint.io/) is used to lint all CSS, SCSS, and Sass files according to the rules defined in `.stylelintrc`.<br><br>#### 2. Code Formatting<br>- **JavaScript/TypeScript**: [Prettier](https://prettier.io/) is used to automatically format all JavaScript and TypeScript files according to the rules defined in `.prettierrc`.<br>- **CSS/SCSS/Sass**: [Stylelint](https://stylelint.io/) is also responsible for formatting CSS, SCSS, and Sass files according to the rules defined in `.stylelintrc`.<br><br>#### 3. Unit Tests<br>- **Jest**: [Jest](https://jestjs.io/) is used to run the project&#39;s unit tests before each commit. This ensures that new code changes don&#39;t introduce regressions or break existing functionality.<br><br>#### 4. Commit Message Linting<br>- **Commitlint**: [Commitlint](https://commitlint.js.org/) is used to enforce a consistent commit message format according to the rules defined in `.commitlintrc`.<br>- **Commit-Conventional**: Commitlint is configured to use the `commit-conventional` plugin, which checks that your commit message follows the [Conventional Commits](https://www.conventionalcommits.org/) specification.<br><br>### How It Works<br><br>Husky is configured to run the relevant hooks at different stages of the Git workflow:<br><br>1. **Pre-Commit**: Runs before each commit, executing the following tasks:<br>    - **Prettier**: Automatically formats JavaScript, TypeScript, CSS, SCSS, and Sass files according to the project&#39;s code style rules.<br>    - **Lint-Staged**: Runs ESLint and Stylelint only on the files that have been staged for the commit, ensuring that linting and formatting checks are performed efficiently on the changed files.<br><br>2. **Pre-Push**: Runs before pushing commits to a remote repository, checking that your branch name fits the project&#39;s conventions.<br><br>3. **Commit-Msg**: Runs after the commit message has been entered, validating the message format using Commitlint and the `commit-conventional` plugin. This ensures that your commit messages follow the Conventional Commits specification.<br><br>If any of the checks fail (e.g., linting errors, failing tests, invalid commit message format, or non-conforming branch name), the respective Git operation (commit or push) will be aborted, and you&#39;ll be prompted to fix the issues before trying again.<br><br>This automated process helps maintain a consistent and high-quality codebase, making it easier for the team to collaborate and understand each other&#39;s code. It also ensures that new code changes don&#39;t introduce regressions or break existing functionality, and that commit messages and branch names follow established conventions.<br><br>### Bypassing Hooks (Not Recommended)<br><br>In rare cases, you might need to bypass the pre-commit hooks temporarily. You can do this by adding the `--no-verify` flag when committing:<br><br>`git commit --no-verify -m &quot;Your commit message&quot;`<br><br>However, it&#39;s strongly recommended to fix any issues identified by the hooks and commit your changes properly, as bypassing these checks can lead to code quality issues, potential bugs, and inconsistencies in the project&#39;s version control history.</pre><p><strong>Intuitive Error Handling</strong></p><p>Husky offers efficient error handling during pre-commit hook execution, allowing you to notify developers in a human-readable way when something goes wrong. For example, you can provide examples of correct values or suggest specific actions to resolve the issue, making it easier for developers to understand and address the problem.</p><p>Let’s say we have a task to keep the branch name aligned with commonly used naming conventions, for example:</p><pre>feature/JIRA-123-add-login-page</pre><p>An example of the script, that will check the conventions alignment, is shown below:</p><pre>#!/usr/bin/env sh<br># Load Husky&#39;s environment<br>. &quot;$(dirname -- &quot;$0&quot;)/_/husky.sh&quot;<br><br># Set the locale to ensure consistent pattern matching<br>LC_ALL=C<br><br># Get the current branch name<br>current_branch=$(git symbolic-ref --short HEAD)<br><br><br># Define the regex pattern for branch names<br>branch_pattern=&quot;^(feature|bugfix|release|hotfix|chore|docs)\/[A-Za-z]+-[0-9]+-.+$&quot;<br><br># Check if the branch name matches the pattern<br>if [[ ! $current_branch =~ $branch_pattern ]]; then<br><br># Example of error handling: Display an error message with instructions<br>printf &quot; \033[1;31mError:\033[0m Branch name &#39;%s&#39; doesn&#39;t follow the naming convention.\n&quot; &quot;$current_branch&quot;<br>printf &quot; \033[1;33mPlease follow the specified naming convention:\033[0m\n&quot;<br>printf &quot; \033[1;33mBranch name format:\033[0m prefix/&lt;Issue Id&gt;-&lt;Issue Description&gt;\n&quot;<br>printf &quot; \033[1;33mPrefix name shall be within [feature, bugfix, release, hotfix, chore, docs]\033[0m \n&quot;<br><br># Example of providing a bypass option<br>  printf &quot; \033[1;33mIf you need to bypass this check temporarily, you can use the --no-verify flag:\033[0m\n&quot;<br>  printf &quot; \033[1;32mgit push --no-verify\033[0m\n&quot;<br><br>exit 1<br>fi<br># Example of success message<br>printf &quot;\033[1;32mSuccess:\033[0m Branch name &#39;%s&#39; follows the naming convention.\n&quot; &quot;$current_branch&quot;<br><br>exit 0</pre><p>This proposed script maintains the core functionality of verifying the branch name against the specified pattern while incorporating additional examples and improvements:</p><ul><li><strong>Example of error handling</strong>: displays a clear error message with instructions on the expected naming convention, demonstrating how to provide user-friendly feedback when a check fails.</li><li><strong>Example of providing a bypass option</strong>: script informs the user about the possibility of bypassing the hook temporarily using the --no-verify flag, serving as an example of offering a fallback option in case of urgent situations.</li><li><strong>The positive scenario is also valuable</strong>: in software development, acknowledging the successful execution of pre-push hooks is as valuable as catching errors. This is especially crucial when multiple hooks are in play or when aligning project changes. The provided pre-push script ensures visibility by displaying success messages even upon successful execution;</li></ul><p>In case the developer provides a branch name, which doesn’t align with existing conventions ( for example fix/BAD-BRANCH-NAME), he will receive next message right in the console:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CRedMwBcM2RHNyZjI3xOKg.png" /></figure><p>Changing the name of the branch to the right one ( for example <em>feature/JIRA-123-add-login-page) </em>will lead to the success message and successful push to the proper remote repository</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b0htC_3e7TsefNpCGEnOMg.png" /></figure><p>Adopting new tools and processes can be challenging, but with clear communication, comprehensive documentation, and a focus on enhancing the overall development experience, the benefits of using Husky for pre-commit hooks can be realized without overwhelming or frustrating your team.</p><h3>Fostering Team Collaboration and Measuring Success</h3><p>By actively involving the team, providing clear guidelines, and continuously measuring and adapting the implementation, you can ensure that Husky hooks become an integral part of your development workflow, contributing to higher code quality, improved collaboration, and a more efficient development process.</p><p>Implementing new tools and processes often requires buy-in and active participation from the entire team to be truly successful. Here are some recommendations to foster collaboration and measure the effectiveness of using Husky hooks:</p><ol><li><strong>Involve the Team Early</strong>: Introduce Husky and pre-commit hooks during team meetings or planning sessions. Encourage open discussions, address concerns, and gather feedback from team members. This inclusive approach helps build understanding and ownership of the process.</li><li><strong>Establish Clear Guidelines and Documentation</strong>: Develop comprehensive documentation that outlines the purpose, configuration, and usage of Husky hooks. Provide examples, best practices, and guidelines for writing effective commit messages or adhering to coding standards. Clear documentation promotes consistency and reduces friction during adoption.</li><li><strong>Leverage Code Reviews and Pair Programming</strong>: Incorporate Husky hooks into your code review and pair programming practices. This reinforces the importance of following coding conventions and allows team members to learn from each other’s experiences with the hooks.</li><li><strong>Collect Metrics and Feedback</strong>: Monitor the impact of Husky hooks on code quality, team productivity, and bug rates. Gather feedback from team members regularly to identify areas for improvement or additional hooks that could be beneficial. Adjust and refine the implementation based on this feedback.</li><li><strong>Celebrate Successes and Share Best Practices</strong>: Recognize and celebrate achievements, such as reaching milestones or maintaining a consistent code quality over time. Encourage team members to share their experiences, tips, and best practices for using Husky hooks effectively. This fosters a culture of continuous learning and improvement.</li></ol><p>This marks my debut article on the Medium platform, and I’m eager to deliver engaging content drawn from both my personal journey and the lessons learned from successes and setbacks along the way. Stay tuned for a blend of insightful narratives and valuable experiences!</p><p>I’d love to hear your thoughts and experiences with implementing pre-commit hooks in your projects. Please share your insights and any tips or best practices you’ve learned along the way in the comments section below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7df7be2a8d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>