<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Ravi Kyada</title>
    <description>The latest articles on Forem by Ravi Kyada (@ravikyada).</description>
    <link>https://forem.com/ravikyada</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1069415%2F6d6aff2e-2cfe-434d-b1e7-65556b76f7ca.jpg</url>
      <title>Forem: Ravi Kyada</title>
      <link>https://forem.com/ravikyada</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ravikyada"/>
    <language>en</language>
    <item>
      <title>How We Re-Engineered a Production-Grade AI Platform on AWS to Balance Performance and Cloud cost.</title>
      <dc:creator>Ravi Kyada</dc:creator>
      <pubDate>Fri, 30 Jan 2026 07:22:35 +0000</pubDate>
      <link>https://forem.com/ravikyada/how-we-re-engineered-a-production-grade-ai-platform-on-aws-to-balance-performance-and-cloud-cost-2ngm</link>
      <guid>https://forem.com/ravikyada/how-we-re-engineered-a-production-grade-ai-platform-on-aws-to-balance-performance-and-cloud-cost-2ngm</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0jextxaomj4s71lravps.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0jextxaomj4s71lravps.png" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Running AI workloads in production is fundamentally different from running traditional web applications. Compute-heavy jobs, unpredictable traffic patterns, large data volumes, and extensive observability requirements can cause cloud costs to grow rapidly — often faster than user adoption.&lt;/p&gt;

&lt;p&gt;This case study describes how we helped a client &lt;strong&gt;optimize their AWS architecture for a production AI platform&lt;/strong&gt; , reducing costs significantly while preserving performance, scalability, and reliability.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Business Problem: Rising AWS Costs Without Matching Growth
&lt;/h3&gt;

&lt;p&gt;The client operates a production AI-based platform on AWS, serving customers through APIs while running background AI processing jobs. Over time, their AWS monthly spend was increasing steadily, but:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User growth was flat&lt;/li&gt;
&lt;li&gt;Request volume was stable&lt;/li&gt;
&lt;li&gt;No major new features had been launched&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvytl3nx5c2pqqojun1qy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvytl3nx5c2pqqojun1qy.png" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Despite a technically sound architecture, cloud costs were becoming a concern for leadership. The goal was &lt;strong&gt;not&lt;/strong&gt; to cut costs at the expense of reliability or slow down the product, but to establish &lt;strong&gt;cost-efficient, sustainable operations&lt;/strong&gt; for AI workloads.&lt;/p&gt;

&lt;h3&gt;
  
  
  High-Level Overview of the AI Platform
&lt;/h3&gt;

&lt;p&gt;At a high level, the system consisted of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Public APIs&lt;/strong&gt; running on AWS compute services&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Asynchronous AI jobs&lt;/strong&gt; for data processing and model inference&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Managed databases&lt;/strong&gt; for transactional and analytical workloads&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Object storage&lt;/strong&gt; for AI artifacts and intermediate data&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Extensive logging and metrics&lt;/strong&gt; for observability and debugging&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The platform was designed for scalability and correctness — but cost efficiency had not been revisited since the early growth phase.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Cost Analysis and Visibility
&lt;/h3&gt;

&lt;p&gt;The first phase focused on &lt;strong&gt;understanding where money was actually being spent&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Actions Taken
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Enabled detailed &lt;strong&gt;AWS Cost Explorer&lt;/strong&gt; and &lt;strong&gt;Cost and Usage Reports (CUR)&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Tagged resources by:&lt;/li&gt;
&lt;li&gt;Service&lt;/li&gt;
&lt;li&gt;Environment (prod, staging)&lt;/li&gt;
&lt;li&gt;Workload type (API, AI jobs, storage, observability)&lt;/li&gt;
&lt;li&gt;Analyzed costs across:&lt;/li&gt;
&lt;li&gt;EC2, ECS/EKS&lt;/li&gt;
&lt;li&gt;RDS and object storage&lt;/li&gt;
&lt;li&gt;CloudWatch Logs and metrics&lt;/li&gt;
&lt;li&gt;Data transfer between services and regions&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Key Findings
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Compute resources were over-provisioned for peak traffic that rarely occurred&lt;/li&gt;
&lt;li&gt;AI background jobs were running on &lt;strong&gt;on-demand instances&lt;/strong&gt; despite being fault-tolerant&lt;/li&gt;
&lt;li&gt;Logging volume had grown linearly with data size, not with actual debugging needs&lt;/li&gt;
&lt;li&gt;Cross-AZ and cross-service data transfer costs were non-trivial&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This phase established a baseline and ensured optimization decisions were &lt;strong&gt;data-driven&lt;/strong&gt; , not assumption-based.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Compute Optimization for APIs and AI Jobs
&lt;/h3&gt;

&lt;h3&gt;
  
  
  API Layer
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Right-sized EC2/ECS workloads based on &lt;strong&gt;real CPU and memory utilization&lt;/strong&gt; , not instance defaults&lt;/li&gt;
&lt;li&gt;Tuned &lt;strong&gt;Auto Scaling policies&lt;/strong&gt; to scale on realistic metrics rather than conservative thresholds&lt;/li&gt;
&lt;li&gt;Reduced idle capacity during off-peak hours without affecting latency SLAs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Trade-off:&lt;/strong&gt; Slightly slower scale-up time during traffic spikes, mitigated by warm capacity buffers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Background AI Jobs
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Migrated suitable workloads to &lt;strong&gt;Spot Instances&lt;/strong&gt; using:&lt;/li&gt;
&lt;li&gt;Managed node groups / capacity providers&lt;/li&gt;
&lt;li&gt;Job retry logic and checkpointing&lt;/li&gt;
&lt;li&gt;Split AI workloads into:&lt;/li&gt;
&lt;li&gt;Latency-sensitive (on-demand)&lt;/li&gt;
&lt;li&gt;Throughput-oriented (Spot)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Trade-off:&lt;/strong&gt; Occasional Spot interruptions, handled at the application level with retries and idempotency.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Database and Storage Optimization
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Databases
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Reviewed RDS instance classes and storage performance&lt;/li&gt;
&lt;li&gt;Reduced over-provisioned IOPS and instance sizes where utilization was consistently low&lt;/li&gt;
&lt;li&gt;Introduced &lt;strong&gt;read replicas&lt;/strong&gt; only where read scaling was actually required&lt;/li&gt;
&lt;li&gt;Implemented data lifecycle policies for historical data&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Object Storage
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Applied &lt;strong&gt;S3 lifecycle rules&lt;/strong&gt; :&lt;/li&gt;
&lt;li&gt;Hot data in Standard&lt;/li&gt;
&lt;li&gt;Infrequently accessed artifacts moved to IA&lt;/li&gt;
&lt;li&gt;Long-term archives moved to Glacier&lt;/li&gt;
&lt;li&gt;Removed unused or duplicate AI artifacts accumulated during experimentation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Trade-off:&lt;/strong&gt; Slightly higher retrieval latency for archived data, acceptable for non-production paths.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Logging and Monitoring Cost Reduction
&lt;/h3&gt;

&lt;p&gt;Logging was one of the fastest-growing cost centers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Improvements Made
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Reduced log verbosity for production workloads&lt;/li&gt;
&lt;li&gt;Introduced &lt;strong&gt;sampling&lt;/strong&gt; for high-volume API logs&lt;/li&gt;
&lt;li&gt;Set &lt;strong&gt;retention policies&lt;/strong&gt; in CloudWatch Logs instead of keeping logs indefinitely&lt;/li&gt;
&lt;li&gt;Exported critical logs to S3 for low-cost long-term retention&lt;/li&gt;
&lt;li&gt;Reviewed custom metrics and removed unused ones&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Outcome:&lt;/strong&gt; Observability quality remained intact while log storage and ingestion costs dropped substantially.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Network Configuration Optimization and Traffic Path Reduction
&lt;/h3&gt;

&lt;p&gt;As the platform scaled, we identified that a meaningful portion of AWS spend was tied to &lt;strong&gt;network data transfer rather than raw compute&lt;/strong&gt;. While the architecture was functionally correct, traffic paths were not always cost- or latency-efficient.&lt;/p&gt;

&lt;h3&gt;
  
  
  Improvements Implemented
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Reviewed &lt;strong&gt;service-to-service traffic flows&lt;/strong&gt; and eliminated unnecessary cross-AZ communication by aligning compute and dependent services within the same Availability Zones where fault tolerance allowed.&lt;/li&gt;
&lt;li&gt;Optimized &lt;strong&gt;VPC routing and security group design&lt;/strong&gt; to ensure direct traffic paths and avoid unintended hops through NAT gateways or intermediate services.&lt;/li&gt;
&lt;li&gt;Reduced reliance on NAT Gateways by introducing &lt;strong&gt;VPC endpoints (Interface and Gateway endpoints)&lt;/strong&gt; for AWS services such as S3, CloudWatch, and ECR, significantly lowering outbound data transfer costs.&lt;/li&gt;
&lt;li&gt;Ensured load balancers, backend services, and databases were &lt;strong&gt;regionally and zonally aligned&lt;/strong&gt; , minimizing cross-zone data transfer charges.&lt;/li&gt;
&lt;li&gt;Introduced caching at appropriate layers to avoid repeated network calls for frequently accessed data and AI artifacts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Engineering Trade-offs
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Tighter AZ affinity required careful evaluation of failure scenarios and was balanced with selective multi-AZ redundancy for critical paths.&lt;/li&gt;
&lt;li&gt;Additional upfront design effort was needed to map traffic flows, but it resulted in simpler and more predictable network behavior.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Outcome
&lt;/h3&gt;

&lt;p&gt;These changes reduced &lt;strong&gt;network data transfer costs&lt;/strong&gt; while also improving &lt;strong&gt;request latency and hop efficiency&lt;/strong&gt; , leading to faster service-to-service communication and a more predictable networking model under load.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 6: Governance and Cost Controls
&lt;/h3&gt;

&lt;p&gt;To prevent cost creep from returning:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Implemented &lt;strong&gt;AWS Budgets and alerts&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Enforced resource tagging via IaC&lt;/li&gt;
&lt;li&gt;Added cost checks to infrastructure review processes&lt;/li&gt;
&lt;li&gt;Established periodic cost review cycles alongside performance reviews&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This ensured optimisation became an &lt;strong&gt;ongoing practice&lt;/strong&gt; , not a one-time effort.&lt;/p&gt;

&lt;h3&gt;
  
  
  Results: Measurable Improvement Without Compromise
&lt;/h3&gt;

&lt;p&gt;Without disclosing exact numbers, the outcomes were clear:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Noticeable reduction in overall AWS spend&lt;/li&gt;
&lt;li&gt;Improved compute efficiency for AI workloads&lt;/li&gt;
&lt;li&gt;Better alignment between traffic patterns and infrastructure scaling&lt;/li&gt;
&lt;li&gt;Stable production performance with no reliability regressions&lt;/li&gt;
&lt;li&gt;Increased confidence in cost predictability as the platform scales&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most importantly, the platform became &lt;strong&gt;cost-efficient by design&lt;/strong&gt; , not by constant manual intervention.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion: Sustainable Cost Control for AI Workloads
&lt;/h3&gt;

&lt;p&gt;AI platforms amplify both &lt;strong&gt;value and inefficiency&lt;/strong&gt; in cloud environments. Over-provisioning, excessive logging, and conservative architecture choices can quietly inflate costs if left unchecked.&lt;/p&gt;

&lt;p&gt;This case study demonstrates that meaningful AWS cost optimization:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does not require compromising performance or reliability&lt;/li&gt;
&lt;li&gt;Relies on engineering discipline, not shortcuts&lt;/li&gt;
&lt;li&gt;Works best when embedded into architecture and governance&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Key Takeaway
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Sustainable cloud cost optimization for AI products comes from understanding workload behavior, making intentional trade-offs, and continuously aligning infrastructure with real usage — not peak assumptions.&lt;/strong&gt;&lt;/p&gt;




</description>
      <category>cloudcostoptimizatio</category>
      <category>aitools</category>
      <category>aws</category>
      <category>ai</category>
    </item>
    <item>
      <title>Choosing Between VPC Peering and Transit Gateway: What to Choose, When, and Why</title>
      <dc:creator>Ravi Kyada</dc:creator>
      <pubDate>Tue, 27 Jan 2026 05:00:39 +0000</pubDate>
      <link>https://forem.com/ravikyada/choosing-between-vpc-peering-and-transit-gateway-what-to-choose-when-and-why-4akc</link>
      <guid>https://forem.com/ravikyada/choosing-between-vpc-peering-and-transit-gateway-what-to-choose-when-and-why-4akc</guid>
      <description>&lt;h4&gt;
  
  
  VPC Peering and Transit Gateway are used to connect multiple VPCs.However, the efficiency of these solutions depends on a robust networking infrastructure.
&lt;/h4&gt;

&lt;p&gt;Designing an AWS network can feel like walking a tightrope — one wrong decision can lead to unnecessary costs or an architecture that pulls your system in completely different directions. At first glance, everything seems right.&lt;/p&gt;

&lt;p&gt;Every option promises seamless connectivity. Yet a single misstep can result in routing complexity, security blind spots, or expenses that quietly grow over time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F321vxuuacawo0xigdncb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F321vxuuacawo0xigdncb.png" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you’re a cloud engineer, DevOps professional, or architect, chances are you’ve asked yourself this question at least once:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;“Should I use VPC Peering or AWS Transit Gateway for my architecture?”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the surface, both services appear to solve the same fundamental problem — &lt;em&gt;connecting VPCs&lt;/em&gt;. But here’s the catch: they solve it in &lt;strong&gt;very different ways&lt;/strong&gt; , and choosing the wrong one can be like building a village road when you actually need a national highway.&lt;/p&gt;

&lt;p&gt;AWS doesn’t always make this choice obvious. Documentation explains &lt;em&gt;what&lt;/em&gt; each service does, but rarely tells you &lt;em&gt;when&lt;/em&gt; one becomes a better option than the other. And that’s where many architectures go wrong — not due to lack of knowledge, but due to lack of &lt;strong&gt;contextual decision-making&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Think of it this way:&lt;br&gt;&lt;br&gt;
 VPC Peering is like directly shaking hands with someone across the table. Simple, personal, and effective — but limited in reach.&lt;br&gt;&lt;br&gt;
 Transit Gateway, on the other hand, is more like setting up a central meeting hall where everyone comes together, follows rules, and communicates in an organized manner.&lt;/p&gt;

&lt;p&gt;So the real question isn’t &lt;strong&gt;“Which service is better?”&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
 The real question is &lt;strong&gt;“Which service fits my current needs &lt;em&gt;and&lt;/em&gt; future growth?”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this article, we’ll unpack that decision step by step. We’ll move beyond definitions and dive into &lt;strong&gt;real-world use cases, architectural trade-offs, cost implications, and scaling realities&lt;/strong&gt;. By the end, you won’t just know the difference between VPC Peering and Transit Gateway — you’ll know exactly &lt;strong&gt;when to choose one over the other, and why&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Let’s break it all down — clearly, practically, and without buzzword overload.&lt;/p&gt;

&lt;h3&gt;
  
  
  ## Understanding the Core Problem
&lt;/h3&gt;

&lt;p&gt;Before choosing a solution, let’s clarify the problem we’re trying to solve.&lt;/p&gt;

&lt;p&gt;Modern AWS environments are rarely simple. You may have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Multiple VPCs for &lt;strong&gt;dev, staging, and production&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Separate AWS accounts for &lt;strong&gt;security and billing isolation&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Shared services like &lt;strong&gt;logging, authentication, or monitoring&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Hybrid connectivity to &lt;strong&gt;on-premises networks&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At some point, these networks must talk to each other —  &lt;strong&gt;securely, reliably, and at scale&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That’s where VPC Peering and Transit Gateway enter the picture.&lt;/p&gt;

&lt;h3&gt;
  
  
  ## What Is Amazon VPC Peering?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;VPC Peering&lt;/strong&gt; is a one-to-one networking connection between two VPCs.&lt;/p&gt;

&lt;p&gt;Think of it like a &lt;strong&gt;private tunnel&lt;/strong&gt; directly connecting two houses. There’s no middleman, no detours — just a straight, private path.&lt;/p&gt;

&lt;p&gt;Once peered, resources in one VPC can communicate with resources in the other using &lt;strong&gt;private IP addresses&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Characteristics
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;One-to-one connection&lt;/li&gt;
&lt;li&gt;No bandwidth bottleneck&lt;/li&gt;
&lt;li&gt;Low latency&lt;/li&gt;
&lt;li&gt;No transitive routing&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ## How VPC Peering Works Internally
&lt;/h3&gt;

&lt;p&gt;Under the hood, VPC Peering uses AWS’s internal network backbone. Traffic:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Never traverses the public internet&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Is &lt;strong&gt;encrypted by default&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Requires &lt;strong&gt;manual route table updates&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However — and this is critical —  &lt;strong&gt;traffic cannot hop&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If VPC A is peered with VPC B, and VPC B is peered with VPC C, &lt;strong&gt;A cannot talk to C&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;No shortcuts. No exceptions.&lt;/p&gt;

&lt;h3&gt;
  
  
  ## Advantages of VPC Peering
&lt;/h3&gt;

&lt;p&gt;Why do people love VPC Peering? Because it’s &lt;strong&gt;simple and fast&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  ✔ Key Benefits
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Very low latency&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No additional hourly charges&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Simple to configure&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ideal for small architectures&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No single point of failure&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For two VPCs that just need to communicate — VPC Peering is often the cleanest solution.&lt;/p&gt;

&lt;h3&gt;
  
  
  ## Limitations of VPC Peering
&lt;/h3&gt;

&lt;p&gt;Here’s where the cracks begin to show.&lt;/p&gt;

&lt;h3&gt;
  
  
  ❌ Major Drawbacks
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;No transitive routing&lt;/li&gt;
&lt;li&gt;Complex mesh as VPC count grows&lt;/li&gt;
&lt;li&gt;Route table management becomes painful&lt;/li&gt;
&lt;li&gt;Hard to scale beyond a few VPCs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Imagine connecting 10 VPCs.&lt;br&gt;&lt;br&gt;
 You’d need &lt;strong&gt;45 peering connections&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That’s not architecture — that’s chaos.&lt;/p&gt;

&lt;h3&gt;
  
  
  ## What Is AWS Transit Gateway?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;AWS Transit Gateway (TGW)&lt;/strong&gt; is a &lt;strong&gt;hub-and-spoke networking service&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If VPC Peering is a narrow bridge, Transit Gateway is a &lt;strong&gt;central airport hub&lt;/strong&gt; where every route flows through a single control point.&lt;/p&gt;

&lt;p&gt;All VPCs, VPNs, and Direct Connect links attach to the Transit Gateway.&lt;/p&gt;

&lt;h3&gt;
  
  
  ## How Transit Gateway Works
&lt;/h3&gt;

&lt;p&gt;Transit Gateway acts as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;central routing hub&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;policy enforcement point&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;scalable backbone&lt;/strong&gt; for your AWS network&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once attached:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;VPCs communicate &lt;strong&gt;transitively&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Routing is &lt;strong&gt;centralized&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Growth becomes predictable, not painful&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ## Advantages of Transit Gateway
&lt;/h3&gt;

&lt;p&gt;This is where TGW really flexes 💪&lt;/p&gt;

&lt;h3&gt;
  
  
  ✔ Key Benefits
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Transitive routing enabled&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Hub-and-spoke architecture&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Centralized route management&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scales to thousands of VPCs&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ideal for multi-account setups&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Supports VPN and Direct Connect&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For large or growing environments, Transit Gateway isn’t just helpful — it’s essential.&lt;/p&gt;

&lt;h3&gt;
  
  
  ## Limitations of Transit Gateway
&lt;/h3&gt;

&lt;p&gt;Transit Gateway is powerful, but not free — in cost or complexity.&lt;/p&gt;

&lt;h3&gt;
  
  
  ❌ Things to Consider
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Hourly attachment cost&lt;/li&gt;
&lt;li&gt;Data processing charges&lt;/li&gt;
&lt;li&gt;Slightly higher latency than peering&lt;/li&gt;
&lt;li&gt;Overkill for very small setups&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In short: &lt;strong&gt;don’t bring a cargo ship to cross a swimming pool&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  ## Cost Comparison: What Really Costs More?
&lt;/h3&gt;

&lt;p&gt;Here’s the truth: &lt;strong&gt;cost depends on scale&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  VPC Peering Costs
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;No hourly cost&lt;/li&gt;
&lt;li&gt;Standard data transfer charges&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Transit Gateway Costs
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Per-hour attachment fee&lt;/li&gt;
&lt;li&gt;Per-GB data processing fee&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 For &lt;strong&gt;small environments&lt;/strong&gt; , peering is cheaper.&lt;br&gt;&lt;br&gt;
 👉 For &lt;strong&gt;large, complex environments&lt;/strong&gt; , Transit Gateway often saves money by reducing operational overhead and human error.&lt;/p&gt;

&lt;h3&gt;
  
  
  ## When to Choose VPC Peering
&lt;/h3&gt;

&lt;p&gt;Choose &lt;strong&gt;VPC Peering&lt;/strong&gt;  when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You have &lt;strong&gt;2–3 VPCs&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;No need for transitive routing&lt;/li&gt;
&lt;li&gt;Simple, stable architecture&lt;/li&gt;
&lt;li&gt;Low operational overhead required&lt;/li&gt;
&lt;li&gt;Cost sensitivity is high&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
 Frontend VPC ↔ Backend VPC&lt;/p&gt;

&lt;h3&gt;
  
  
  ## When to Choose Transit Gateway
&lt;/h3&gt;

&lt;p&gt;Choose &lt;strong&gt;Transit Gateway&lt;/strong&gt;  when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You have &lt;strong&gt;many VPCs&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Multiple AWS accounts&lt;/li&gt;
&lt;li&gt;Hybrid (on-prem + AWS) networking&lt;/li&gt;
&lt;li&gt;Shared services architecture&lt;/li&gt;
&lt;li&gt;Rapid growth expected&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
 Shared services VPC + Dev + QA + Prod + On-Prem&lt;/p&gt;

&lt;h3&gt;
  
  
  ## Real-World Architecture Scenarios
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Scenario 1: Startup SaaS (Early Stage)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;2 VPCs&lt;/li&gt;
&lt;li&gt;One AWS account
👉 &lt;strong&gt;VPC Peering&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Scenario 2: Growing SaaS Platform
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;10+ VPCs&lt;/li&gt;
&lt;li&gt;Multiple teams
👉 &lt;strong&gt;Transit Gateway&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Scenario 3: Enterprise with On-Prem
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;VPN + Direct Connect
👉 &lt;strong&gt;Transit Gateway (no debate)&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ## Common Mistakes and Anti-Patterns
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Using VPC Peering for 10+ VPCs&lt;/li&gt;
&lt;li&gt;Avoiding TGW due to “cost fear”&lt;/li&gt;
&lt;li&gt;Mixing architectures without a plan&lt;/li&gt;
&lt;li&gt;Forgetting route table complexity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Remember: &lt;strong&gt;operational pain is also a cost&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  ## Final Decision Framework
&lt;/h3&gt;

&lt;p&gt;Ask yourself:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;How many VPCs do I have  &lt;strong&gt;now&lt;/strong&gt;?&lt;/li&gt;
&lt;li&gt;How many will I have &lt;strong&gt;in 6–12 months&lt;/strong&gt;?&lt;/li&gt;
&lt;li&gt;Do I need &lt;strong&gt;transitive routing&lt;/strong&gt;?&lt;/li&gt;
&lt;li&gt;Is centralized control important?&lt;/li&gt;
&lt;li&gt;Am I optimizing for &lt;strong&gt;simplicity or scale&lt;/strong&gt;?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Your answers will almost always point clearly to one solution.&lt;/p&gt;

&lt;h3&gt;
  
  
  ## Conclusion
&lt;/h3&gt;

&lt;p&gt;Choosing between &lt;strong&gt;VPC Peering and Transit Gateway&lt;/strong&gt; isn’t about which is “better.”&lt;br&gt;&lt;br&gt;
 It’s about which one fits &lt;strong&gt;your architecture’s present and future&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;VPC Peering&lt;/strong&gt; is simple, fast, and cost-effective — &lt;em&gt;for small setups&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transit Gateway&lt;/strong&gt; is scalable, centralized, and enterprise-ready — &lt;em&gt;for growing or complex environments&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Design for where you’re going, not just where you are.&lt;/p&gt;

&lt;h3&gt;
  
  
  ## Frequently Asked Questions (FAQ)
&lt;/h3&gt;

&lt;h3&gt;
  
  
  1. Can I use both VPC Peering and Transit Gateway together?
&lt;/h3&gt;

&lt;p&gt;Yes. Many architectures use peering for small, isolated connections and TGW for the core network.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Is Transit Gateway slower than VPC Peering?
&lt;/h3&gt;

&lt;p&gt;Slightly, but the difference is usually negligible compared to its scalability benefits.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Can VPC Peering connect on-prem networks?
&lt;/h3&gt;

&lt;p&gt;No. Only Transit Gateway supports VPN and Direct Connect natively.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Is Transit Gateway overkill for startups?
&lt;/h3&gt;

&lt;p&gt;Early-stage startups may not need it, but fast-growing ones often adopt it sooner than expected.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Which is easier to manage long-term?
&lt;/h3&gt;

&lt;p&gt;Transit Gateway — centralized routing always wins at scale.&lt;/p&gt;




</description>
      <category>cloudcomputing</category>
      <category>aws</category>
      <category>vpc</category>
      <category>cloudservices</category>
    </item>
    <item>
      <title>Kubernetes Architecture Explained for DevOps Engineers</title>
      <dc:creator>Ravi Kyada</dc:creator>
      <pubDate>Fri, 26 Dec 2025 07:43:00 +0000</pubDate>
      <link>https://forem.com/ravikyada/kubernetes-architecture-explained-for-devops-engineers-2393</link>
      <guid>https://forem.com/ravikyada/kubernetes-architecture-explained-for-devops-engineers-2393</guid>
      <description>&lt;p&gt;&lt;a href="https://medium.com/cloud-native-journal/kubernetes-architecture-explained-for-devops-engineers-fc0f0d1c50ec?source=rss-6ff2b1a17b68------2" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwnkgru0hbygafbakm3g5.png" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A practical guide to Kubernetes internals for DevOps engineers building and operating clusters.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/cloud-native-journal/kubernetes-architecture-explained-for-devops-engineers-fc0f0d1c50ec?source=rss-6ff2b1a17b68------2" rel="noopener noreferrer"&gt;Continue reading on Cloud Native Journal »&lt;/a&gt;&lt;/p&gt;

</description>
      <category>kubectl</category>
      <category>kubernetes</category>
      <category>kubernetescluster</category>
      <category>cloudcomputing</category>
    </item>
    <item>
      <title>Best Practices for Securing an AWS Environment</title>
      <dc:creator>Ravi Kyada</dc:creator>
      <pubDate>Sat, 07 Jun 2025 10:52:48 +0000</pubDate>
      <link>https://forem.com/ravikyada/best-practices-for-securing-an-aws-environment-j9p</link>
      <guid>https://forem.com/ravikyada/best-practices-for-securing-an-aws-environment-j9p</guid>
      <description>&lt;h4&gt;
  
  
  A Hands-On Guide to Locking Down Your AWS Cloud with Industry-Backed Security Strategies.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl0m5kjo25xubs0y1zwsp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl0m5kjo25xubs0y1zwsp.png" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In today’s increasingly cloud-dependent world, organizations face mounting challenges related to data breaches, misconfigured resources, and insider threats.&lt;/p&gt;

&lt;p&gt;The flexibility and scalability of AWS are undeniable, but they also demand proactive, intentional security strategies.&lt;/p&gt;

&lt;p&gt;AWS operates on a shared responsibility model, where AWS manages the security &lt;em&gt;of&lt;/em&gt; the cloud, and you are responsible for security &lt;em&gt;in&lt;/em&gt; the cloud. This includes configuring services securely, managing user access, and monitoring for threats.&lt;/p&gt;

&lt;p&gt;This guide will walk you through &lt;a href="https://aws.amazon.com/architecture/security-identity-compliance/" rel="noopener noreferrer"&gt;AWS actionable best practices &lt;/a&gt;— backed by AWS whitepapers, industry security frameworks like CIS and NIST, and real-world DevSecOps principles — to keep your cloud safe.&lt;/p&gt;

&lt;p&gt;Let’s dive deep into best practices to protect your AWS assets — because it’s not just about preventing attacks; it’s about sleeping peacefully at night knowing your cloud is secure.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Start with Strong Account Foundations
&lt;/h3&gt;

&lt;p&gt;Security begins at the root — literally. Your AWS root user is the god of your cloud kingdom. Protect it like a vault.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use Group Email Alias
&lt;/h3&gt;

&lt;p&gt;What happens if the only person who receives AWS alerts is out sick or leaves the company? Disaster.&lt;/p&gt;

&lt;p&gt;Use a group email alias (like &lt;a href="mailto:aws-admin@yourcompany.com"&gt;aws-admin@yourcompany.com&lt;/a&gt;) so multiple trusted members stay in the loop for critical updates.&lt;/p&gt;

&lt;h3&gt;
  
  
  Enable Multi-Factor Authentication (MFA)
&lt;/h3&gt;

&lt;p&gt;Would you secure your bank account with just a password? Nope. AWS is no different.&lt;/p&gt;

&lt;p&gt;Enable MFA, especially on the &lt;strong&gt;root user&lt;/strong&gt; and &lt;strong&gt;privileged IAM users&lt;/strong&gt;. It ensures even if a password is compromised, the bad actor still hits a wall.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Embrace Identity and Access Management (IAM)
&lt;/h3&gt;

&lt;p&gt;IAM is like the bouncer at your club — only the right people should get access.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create IAM Users, Not Use Root
&lt;/h3&gt;

&lt;p&gt;Never use the root user for daily tasks. Instead:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create individual IAM users.&lt;/li&gt;
&lt;li&gt;Use roles for cross-account access.&lt;/li&gt;
&lt;li&gt;Disable root access keys entirely.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Assign Policies to Groups, Not Users
&lt;/h3&gt;

&lt;p&gt;It’s easier to manage policies when they’re attached to groups. Why?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It reduces configuration errors.&lt;/li&gt;
&lt;li&gt;Simplifies access changes.&lt;/li&gt;
&lt;li&gt;Keeps your architecture scalable.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Rotate and Manage Credentials Carefully
&lt;/h3&gt;

&lt;p&gt;Hardcoding credentials is like hiding your front-door key under the mat — anyone can find it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Never embed secrets in code.&lt;/li&gt;
&lt;li&gt;Use AWS Secrets Manager or Parameter Store.&lt;/li&gt;
&lt;li&gt;Rotate keys regularly (especially those older than 90 days).&lt;/li&gt;
&lt;li&gt;Delete unused access keys.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Audit and Monitor Using Native AWS Tools
&lt;/h3&gt;

&lt;p&gt;Visibility is power. And AWS gives you several spotlights.&lt;/p&gt;

&lt;h3&gt;
  
  
  Enable CloudTrail Across Regions
&lt;/h3&gt;

&lt;p&gt;CloudTrail records every API call. It’s your surveillance camera.&lt;/p&gt;

&lt;p&gt;Enable cloudtrail in &lt;strong&gt;all regions&lt;/strong&gt; , even unused ones, to detect unauthorized activities.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use CloudWatch, GuardDuty, and Security Hub
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CloudWatch&lt;/strong&gt; : Real-time monitoring and alarms.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GuardDuty&lt;/strong&gt; : AI-driven threat detection.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security Hub&lt;/strong&gt; : Aggregates findings and applies CIS benchmarks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These tools are your cloud’s security command center.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Categorize and Control Your AWS Assets
&lt;/h3&gt;

&lt;p&gt;You wouldn’t guard a garden hose the same way you guard a diamond, right?&lt;/p&gt;

&lt;p&gt;Tag resources to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Identify critical assets.&lt;/li&gt;
&lt;li&gt;Apply policies based on risk level.&lt;/li&gt;
&lt;li&gt;Automate workflows.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Segregate environments (dev, test, prod) into different accounts for tighter control.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Encrypt and Store Secrets Safely
&lt;/h3&gt;

&lt;p&gt;Encryption isn’t just a buzzword — it’s your last line of defense.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use AWS Key Management Service (KMS).&lt;/li&gt;
&lt;li&gt;Control who can decrypt data.&lt;/li&gt;
&lt;li&gt;Never store plaintext secrets in config files.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even if attackers breach your system, encrypted data is just gibberish without the keys.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Network Hardening and DNS Protection
&lt;/h3&gt;

&lt;p&gt;Your network is your digital fortress. Fortify it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use Amazon VPC Security Best Practices
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create isolated VPCs.&lt;/li&gt;
&lt;li&gt;Use NACLs and Security Groups.&lt;/li&gt;
&lt;li&gt;Enable &lt;strong&gt;VPC Flow Logs&lt;/strong&gt; to detect suspicious traffic.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Secure DNS Using Route 53 and SSL/TLS
&lt;/h3&gt;

&lt;p&gt;DNS is the phonebook of the internet. If attackers hijack it, they reroute your customers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;Amazon Route 53&lt;/strong&gt; with DNSSEC.&lt;/li&gt;
&lt;li&gt;Encrypt DNS traffic using TLS.&lt;/li&gt;
&lt;li&gt;Monitor DNS logs for anomalies.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  8. Respond Swiftly to Threats and Abuse
&lt;/h3&gt;

&lt;p&gt;Ever received an AWS abuse warning? You’re not alone.&lt;/p&gt;

&lt;p&gt;Have an incident response plan ready. Start by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Categorizing assets by region.&lt;/li&gt;
&lt;li&gt;Using automation to quarantine resources.&lt;/li&gt;
&lt;li&gt;Investigating with CloudTrail logs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A fast response can be the difference between a minor hiccup and a full-blown breach.&lt;/p&gt;

&lt;h3&gt;
  
  
  9. Backup Strategy: Your Data Safety Net
&lt;/h3&gt;

&lt;p&gt;No backup? Say goodbye to your data during disasters.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;AWS Backup&lt;/strong&gt; to automate snapshots.&lt;/li&gt;
&lt;li&gt;Store copies across regions.&lt;/li&gt;
&lt;li&gt;Test restores periodically — because backups are useless if they don’t work.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  10. Automate with Config, Tags, and Scripts
&lt;/h3&gt;

&lt;p&gt;Manual work is a security liability.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Turn on &lt;strong&gt;AWS Config&lt;/strong&gt; to track configuration drifts.&lt;/li&gt;
&lt;li&gt;Use tags to group resources for automation.&lt;/li&gt;
&lt;li&gt;Explore scripts from &lt;strong&gt;AWS Labs&lt;/strong&gt; for compliance checks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Automation reduces human error, and that’s where most breaches begin.&lt;/p&gt;

&lt;h3&gt;
  
  
  11. Mitigate DDoS with Defense-in-Depth
&lt;/h3&gt;

&lt;p&gt;A DDoS attack can turn your application into a paperweight.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;AWS WAF&lt;/strong&gt; to filter malicious traffic.&lt;/li&gt;
&lt;li&gt;Place workloads behind &lt;strong&gt;CloudFront&lt;/strong&gt; (CDN).&lt;/li&gt;
&lt;li&gt;Enable &lt;strong&gt;Shield Standard&lt;/strong&gt; or &lt;strong&gt;Shield Advanced&lt;/strong&gt; for enterprise-grade protection.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  12. Clean House: Remove Unused Security Groups
&lt;/h3&gt;

&lt;p&gt;Unused security groups are ghosts that might come back to haunt you.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Audit regularly.&lt;/li&gt;
&lt;li&gt;Remove unattached groups.&lt;/li&gt;
&lt;li&gt;Document changes for traceability.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  13. Establish Robust Naming Conventions
&lt;/h3&gt;

&lt;p&gt;Naming conventions are your AWS GPS. Without them, you’re flying blind.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;&lt;br&gt;
 Use env-role-service-region (like prod-db-rds-us-east-1).&lt;/p&gt;

&lt;p&gt;Don’t use obvious names like admin or fullaccess. Hackers love that.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion: Build Security into Your Cloud DNA
&lt;/h3&gt;

&lt;p&gt;Security isn’t a feature — it’s a mindset. It must be baked into every step of your AWS journey, not bolted on at the end.&lt;/p&gt;

&lt;p&gt;From your root account to your last Lambda function, every resource needs scrutiny, strategy, and a sprinkling of automation.&lt;/p&gt;

&lt;p&gt;And remember: it’s not about being perfect. It’s about being resilient, responsive, and always one step ahead.&lt;/p&gt;

&lt;h3&gt;
  
  
  FAQs
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. What’s the first thing I should do after creating an AWS account?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
 Enable multi-factor authentication (MFA) on the root user, create IAM users, and disable root access keys.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. How often should I rotate access keys in AWS?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
 At least every 90 days, or sooner if required by your security policy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Can I use AWS Secrets Manager for non-AWS applications?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
 Yes, Secrets Manager can store and retrieve secrets for third-party services like databases and APIs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. What’s the difference between NACL and Security Groups?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
 NACLs are stateless and apply at the subnet level. Security Groups are stateful and apply at the instance level.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Do I need to enable CloudTrail in every region?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
 Yes, to ensure you track activity even in regions you don’t actively use.&lt;/p&gt;

&lt;p&gt;Thank you so much for reading the article till the end! 🙌🏻 Your time and interest truly mean a lot. 😁📃&lt;/p&gt;

&lt;p&gt;If you have any &lt;strong&gt;questions or thoughts&lt;/strong&gt; about this blog, feel free to connect with me:&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;LinkedIn:&lt;/strong&gt; &lt;a href="https://www.linkedin.com/in/ravikyada" rel="noopener noreferrer"&gt;Ravi Kyada&lt;/a&gt;&lt;br&gt;&lt;br&gt;
🐦 &lt;strong&gt;Twitter:&lt;/strong&gt; &lt;a href="https://twitter.com/ravijkyada" rel="noopener noreferrer"&gt;@ravijkyada&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Until next time, ✌🏻 &lt;strong&gt;Cheers to more learning and discovery!&lt;/strong&gt; 🇮🇳 🚀&lt;/p&gt;




</description>
      <category>security</category>
      <category>cloudsecurity</category>
      <category>awssecurity</category>
      <category>aws</category>
    </item>
    <item>
      <title>Mastering Apache Web Server: Installation, Multi-Port Configuration, and Best Practices</title>
      <dc:creator>Ravi Kyada</dc:creator>
      <pubDate>Fri, 09 May 2025 10:00:31 +0000</pubDate>
      <link>https://forem.com/ravikyada/mastering-apache-web-server-installation-multi-port-configuration-and-best-practices-56lk</link>
      <guid>https://forem.com/ravikyada/mastering-apache-web-server-installation-multi-port-configuration-and-best-practices-56lk</guid>
      <description>&lt;h4&gt;
  
  
  Mastering Apache Web Server for Ubuntu
&lt;/h4&gt;

&lt;p&gt;The Apache HTTP Server is one of the world's most widely used web servers. What keeps Apache popular today is its mature ecosystem and tooling.&lt;/p&gt;

&lt;p&gt;Its Features, such as easy integration with Certbot for SSL certificates, .htaccess-based URL rewriting, and seamless 301 redirects, make it incredibly convenient.&lt;/p&gt;

&lt;p&gt;While many modern frameworks ship with their own built-in HTTP servers, there’s still value in having a single entry point—a centralized web server or load balancer with one SSL certificate that routes traffic to various services, not just static content.&lt;/p&gt;

&lt;p&gt;But have you ever thought beyond the basic setup? What if you need to run Apache on multiple ports or fine-tune it for custom firewall rules? This guide will walk you through everything — from installation to advanced configuration — in a conversational, step-by-step format.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmf1bpxfiywwgmprwuku5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmf1bpxfiywwgmprwuku5.png" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  🧱 Introduction to Apache Web Server
&lt;/h3&gt;

&lt;p&gt;Think of Apache as a highly efficient request handler in your web infrastructure. It listens for incoming HTTP requests, processes them based on configured rules and virtual hosts, retrieves the appropriate resources, such as HTML files or dynamic content via PHP, and delivers the response back to the client’s browser.&lt;/p&gt;

&lt;p&gt;Acting as a robust intermediary between the server and the internet, Apache ensures that web traffic is routed, managed, and served reliably and securely.&lt;/p&gt;

&lt;h3&gt;
  
  
  🌐 Why Apache Still Dominates Web Hosting
&lt;/h3&gt;

&lt;p&gt;Despite newer servers like NGINX, Apache’s modular architecture, ease of configuration, and wide support make it a staple in Linux-based web hosting. It’s flexible enough for a simple blog and powerful enough for a multi-site enterprise application.&lt;/p&gt;

&lt;h3&gt;
  
  
  ⚙️ Installing Apache on Ubuntu
&lt;/h3&gt;

&lt;p&gt;To install Apache on Ubuntu-based systems, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install apache2 -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command downloads and installs the latest Apache package with all required dependencies.&lt;/p&gt;

&lt;h3&gt;
  
  
  🗂️ Default Apache File Structure Explained
&lt;/h3&gt;

&lt;p&gt;Post-installation, here are the key paths you should know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Web root&lt;/strong&gt; : /var/www/html/index.html&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Logs&lt;/strong&gt; : /var/log/apache2/access.log&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Configuration directory&lt;/strong&gt; : /etc/apache2&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  📂 Understanding the Apache Directory Hierarchy
&lt;/h3&gt;

&lt;p&gt;Within /etc/apache2, you’ll find:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;/sites-available: Where all virtual host configurations live.&lt;/li&gt;
&lt;li&gt;/sites-enabled: Active configurations linked from sites-available.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To activate a configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo a2ensite your-site.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ✏️ Editing the Index File
&lt;/h3&gt;

&lt;p&gt;Edit your default landing page:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /var/www/html/index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace the default text with something custom, like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;h1&amp;gt;Welcome to My Apache Server&amp;lt;/h1&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  📜 Accessing Apache Logs
&lt;/h3&gt;

&lt;p&gt;For troubleshooting and performance monitoring, logs are your best friend:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo tail -f /var/log/apache2/access.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🔧 Introduction to Apache Configuration Files
&lt;/h3&gt;

&lt;p&gt;Every virtual host must be defined in a config file, usually stored in /etc/apache2/sites-available/. Here's a basic example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;VirtualHost *:80&amp;gt;
    ServerAdmin admin@example.com
    DocumentRoot /var/www/html
&amp;lt;/VirtualHost&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🔗 Enabling Apache Sites with a2ensite
&lt;/h3&gt;

&lt;p&gt;Apache provides a helper command to activate virtual hosts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo a2ensite your-site.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This symlinks it to /sites-enabled.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔁 Reloading Apache Gracefully
&lt;/h3&gt;

&lt;p&gt;After making config changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl reload apache2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This reloads Apache without dropping current connections.&lt;/p&gt;

&lt;h3&gt;
  
  
  🧪 Testing Apache Configuration Safely
&lt;/h3&gt;

&lt;p&gt;Before restarting or reloading, test your config:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apachectl configtest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look for Syntax OK — it’s your green light.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔀 Configuring Apache to Run on Multiple Ports
&lt;/h3&gt;

&lt;p&gt;Let’s say you want Apache to respond on ports 80 and 81. Start by editing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /etc/apache2/ports.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Listen 81
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🏗️ Setting Up Virtual Hosts on Different Ports
&lt;/h3&gt;

&lt;p&gt;Edit your virtual host file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /etc/apache2/sites-available/your-site.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;VirtualHost *:81&amp;gt;
    ServerAdmin admin@example.com
    DocumentRoot /var/www/html
&amp;lt;/VirtualHost&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then enable and reload:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo a2ensite your-site.conf
sudo systemctl restart apache2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🔐 Updating Firewall Rules for Apache Access
&lt;/h3&gt;

&lt;p&gt;If using ufw, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo ufw allow 81
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This opens port 81 to the world. Be cautious and restrict access if needed.&lt;/p&gt;

&lt;h3&gt;
  
  
  ☁️ Running Apache on AWS EC2 — Special Considerations
&lt;/h3&gt;

&lt;p&gt;For EC2 instances, you must also:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add inbound rule in the EC2 security group.&lt;/li&gt;
&lt;li&gt;Allow custom TCP on port 81 with source 0.0.0.0/0.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Access it via:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://&amp;lt;your-ec2-public-ip&amp;gt;:81
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🏁 Conclusion
&lt;/h3&gt;

&lt;p&gt;Apache remains an industry standard because of its deep configurability and reliability. From simple setups to multi-port configurations, mastering Apache gives you full control over your server environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  ❓ FAQ
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. Can I run multiple Apache instances on different ports?&lt;/strong&gt; Yes, but it’s more efficient to configure virtual hosts on different ports within the same Apache instance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. What’s the difference between sites-available and sites-enabled?&lt;/strong&gt; sites-available contains all configurations; sites-enabled contains symlinks to the active ones.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Do I need to open firewall ports for each new Apache port?&lt;/strong&gt; Yes. For every new port, make sure both your system firewall and cloud security group allow traffic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. How do I test if Apache is listening on a port?&lt;/strong&gt; Run: sudo netstat -tuln | grep :81 or ss -tuln&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. What happens if I don’t reload Apache after config changes?&lt;/strong&gt; Apache won’t pick up the changes, and your new config won’t be active until you reload or restart it.&lt;/p&gt;

&lt;p&gt;Ready to level up your web hosting game? Start by experimenting with multi-port configurations and custom virtual hosts today!&lt;/p&gt;

</description>
      <category>apache</category>
      <category>ubuntu</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Enhance EKS Load Balancing: Enable IPVS Mode in AWS EKS</title>
      <dc:creator>Ravi Kyada</dc:creator>
      <pubDate>Mon, 07 Apr 2025 07:45:23 +0000</pubDate>
      <link>https://forem.com/ravikyada/enhance-eks-load-balancing-enable-ipvs-mode-in-aws-eks-1cla</link>
      <guid>https://forem.com/ravikyada/enhance-eks-load-balancing-enable-ipvs-mode-in-aws-eks-1cla</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwewnhok4mmtshl0321uq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwewnhok4mmtshl0321uq.png" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you’re running Kubernetes in production, you already know that performance bottlenecks are the stuff of nightmares.&lt;/p&gt;

&lt;p&gt;One of the most underrated, impactful changes you can make is switching your cluster’s networking from &lt;strong&gt;IPTables&lt;/strong&gt; to &lt;strong&gt;IPVS (IP Virtual Server)&lt;/strong&gt; mode.&lt;/p&gt;

&lt;p&gt;But here’s the challenge: &lt;strong&gt;AWS EKS doesn’t support IPVS out of the box&lt;/strong&gt;. So what do we do? We roll up our sleeves and take the alternative route. in this article, I’ll walk you through exactly how to do it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If your k8s cluster is handling more than 500–1000Service objects, it’s &lt;strong&gt;highly recommended&lt;/strong&gt; to switch kube-proxy from &lt;strong&gt;IpTables&lt;/strong&gt; to &lt;strong&gt;IPVS mode&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;In fact, &lt;strong&gt;IPVS should almost always be your default choice&lt;/strong&gt; over iptables mode — it’s faster, more efficient, and built to scale better with large service counts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And when I say “almost always,” I mean it! If you have a compelling reason to stick with iptables instead of IPVS, &lt;strong&gt;drop a comment below&lt;/strong&gt;  — I’d genuinely love to learn from your experience and issues you faces.&lt;/p&gt;

&lt;h3&gt;
  
  
  🚀 The Need for Speed: Why IPVS Over IPTables?
&lt;/h3&gt;

&lt;p&gt;IPTables handles every packet one by one, scanning a long list of rules like a librarian looking for the right page in an old book.&lt;/p&gt;

&lt;p&gt;IPVS, on the other hand, is like a high-speed toll plaza with dedicated lanes and an automated system — it’s built for scale and speed.&lt;/p&gt;

&lt;p&gt;In tech terms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;IPTable&lt;/strong&gt; is rule-based, and slow with scale.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IPVS&lt;/strong&gt; is connection-based, highly performant, and supports better load-balancing algorithms.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🧱 The AWS EKS Catch: Why You Can’t Enable IPVS Natively
&lt;/h3&gt;

&lt;p&gt;AWS EKS manages the underlying infrastructure, including the base AMI used for your worker nodes. That means &lt;strong&gt;you can’t directly enable IPVS modules via the default Amazon EKS-optimized AMI&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;To get around this limitation, we’ll have to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a &lt;strong&gt;custom EC2 launch template or change user data, we will use user data&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Enable IPVS modules using cloud-init.&lt;/li&gt;
&lt;li&gt;Tweak the &lt;strong&gt;kube-proxy&lt;/strong&gt; deployment and config.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s go step by step.&lt;/p&gt;

&lt;h3&gt;
  
  
  🛠️ Our Workaround High-Level Steps
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Create a launch template that installs IPVS on boot.&lt;/li&gt;
&lt;li&gt;Deploy nodes using this custom template.&lt;/li&gt;
&lt;li&gt;Edit the kube-proxy &lt;strong&gt;DaemonSet&lt;/strong&gt; to use IPVS.&lt;/li&gt;
&lt;li&gt;Modify the kube-proxy &lt;strong&gt;ConfigMap&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Verify and validate IPVS is running.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  🔧 Step 1: Create a Launch Template With IPVS Support
&lt;/h3&gt;

&lt;h3&gt;
  
  
  📦 Modifying the EC2 Cloud-Init User Data
&lt;/h3&gt;

&lt;p&gt;The magic starts with the user-data script in your launch template. Paste the following Bash snippet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
sudo yum install -y ipvsadm
sudo ipvsadm -l
sudo modprobe ip_vs
sudo modprobe ip_vs_rr
sudo modprobe ip_vs_wrr
sudo modprobe ip_vs_sh
sudo modprobe nf_conntrack_ipv4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🧩 Why These Kernel Modules Matter
&lt;/h3&gt;

&lt;p&gt;Each modprobe line loads a kernel module essential for IPVS operations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ip_vs - The core IPVS module.&lt;/li&gt;
&lt;li&gt;ip_vs_rr, ip_vs_wrr, ip_vs_sh - Different load-balancing strategies.&lt;/li&gt;
&lt;li&gt;nf_conntrack_ipv4 - Enables connection tracking.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without these, IPVS is like a car with no engine.&lt;/p&gt;

&lt;h3&gt;
  
  
  🚀 Step 2: Deploy Nodes Using the Custom Launch Template
&lt;/h3&gt;

&lt;p&gt;Attach your launch template to your EKS node group:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to the EKS Console or use eksctl.&lt;/li&gt;
&lt;li&gt;Use your custom AMI or the default AMI + user-data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Make sure the nodes spin up successfully and the modules are loaded (you can SSH in and verify with lsmod | grep ip_vs).&lt;/p&gt;

&lt;h3&gt;
  
  
  🧠 Step 3: Edit the kube-proxy DaemonSet
&lt;/h3&gt;

&lt;p&gt;By default, kube-proxy runs in &lt;strong&gt;iptables mode&lt;/strong&gt;. Time to change that.&lt;/p&gt;

&lt;h4&gt;
  
  
  Run:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl -n kube-system edit ds kube-proxy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;containers:
- command:
  - kube-proxy
  - --v=2
  - --config=/var/lib/kube-proxy-config/config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;containers:
- command:
  - kube-proxy
  - --v=2
  - --proxy-mode=ipvs
  - --ipvs-scheduler=rr
  - --config=/var/lib/kube-proxy-config/config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🌍 Adding IPVS Environment Variable
&lt;/h3&gt;

&lt;p&gt;Add the environment variable too under changes in the daemon set:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;env:
- name: KUBE_PROXY_MODE
  value: ipvs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Combined changes we did in daemonSet(For your Better Understanding):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     containers:
     - command:
       - kube-proxy
       - --v=2
       - --proxy-mode=ipvs
       - --ipvs-scheduler=rr
       - --config=/var/lib/kube-proxy/config
       env:
       - name: KUBE_PROXY_MODE
         value: ipvs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🧾 Step 4: Tweak the Kube-Proxy ConfigMap
&lt;/h3&gt;

&lt;p&gt;This step is crucial. Let’s make the IPVS mode permanent in the config. be careful while you make changes here.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl -n kube-system edit cm kube-proxy-config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🔑 The Key Sections to Modify
&lt;/h3&gt;

&lt;p&gt;Change the following in the config: block:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ipvs:
  scheduler: "rr"
mode: "ipvs"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Complete example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration
mode: "ipvs"
ipvs:
  scheduler: "rr"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🔄 Load Balancing Algorithms You Can Use
&lt;/h3&gt;

&lt;p&gt;Choose your poison:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;rr: Round Robin&lt;/li&gt;
&lt;li&gt;lc: Least Connection&lt;/li&gt;
&lt;li&gt;dh: Destination Hashing&lt;/li&gt;
&lt;li&gt;sh: Source Hashing&lt;/li&gt;
&lt;li&gt;sed: Shortest Expected Delay&lt;/li&gt;
&lt;li&gt;nq: Never Queue&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;After this change restart the daemon set of kube-proxy.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl rollout restart -n kube-system daemonset kube-proxy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ⚠️ Common Pitfalls to Avoid
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Don’t forget to restart the kube-proxy pods&lt;/strong&gt; after editing the config.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your custom AMI must be kept up-to-date&lt;/strong&gt; with security patches.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ensure IPVS modules load successfully&lt;/strong&gt; on each reboot.&lt;/li&gt;
&lt;li&gt;Watch out for &lt;strong&gt;conflicts between kube-proxy and CNI plugins&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🧪 How to Verify IPVS Is Working as Expected
&lt;/h3&gt;

&lt;h3&gt;
  
  
  🔍 Using ipvsadm to Inspect Rules
&lt;/h3&gt;

&lt;p&gt;SSH into one of your worker nodes and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo ipvsadm -Ln
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see a list of services and destinations. If you see IPVS table empty, something's wrong—check your kube-proxy config again.&lt;/p&gt;

&lt;h3&gt;
  
  
  ⚖️ Pros and Cons: Should You Go This Route?
&lt;/h3&gt;

&lt;p&gt;Pros:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;High-performance packet routing&lt;/li&gt;
&lt;li&gt;Better load-balancing strategies&lt;/li&gt;
&lt;li&gt;Scales better under pressure&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;More complex to set it up in a better way&lt;/li&gt;
&lt;li&gt;Needs custom launch templates&lt;/li&gt;
&lt;li&gt;Maintenance overhead&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🔮 Future-Proofing: Will AWS Support Native IPVS?
&lt;/h3&gt;

&lt;p&gt;Maybe one day. Currently, &lt;strong&gt;AWS does not support a native way to enable IPVS&lt;/strong&gt; on EKS nodes. But if enough people start requesting it (hint: open a feature request), who knows?&lt;/p&gt;

&lt;h3&gt;
  
  
  ✅ Conclusion: Is the Work-Around Helpful?
&lt;/h3&gt;

&lt;p&gt;So, should you bother?&lt;/p&gt;

&lt;p&gt;If you’re running &lt;strong&gt;high-throughput, latency-sensitive workloads&lt;/strong&gt; , then yes, switching to IPVS can make a &lt;strong&gt;night-and-day difference&lt;/strong&gt;. It’s not just a tweak — it’s a performance strategy.&lt;/p&gt;

&lt;p&gt;It takes some work, sure. But so does anything worth doing in tech.&lt;/p&gt;

&lt;h3&gt;
  
  
  ❓ FAQ: Your Burning Questions Answered
&lt;/h3&gt;

&lt;h3&gt;
  
  
  1. Can I enable IPVS mode without custom launch templates?
&lt;/h3&gt;

&lt;p&gt;No, not currently. AWS’s default AMIs do not come with IPVS kernel modules.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Will enabling IPVS affect my existing workloads?
&lt;/h3&gt;

&lt;p&gt;No, as long as kube-proxy is configured correctly, the switch is seamless to your workloads.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Is this setup compatible with all CNI plugins?
&lt;/h3&gt;

&lt;p&gt;Most major CNIs like Calico and Cilium support IPVS, but check the documentation for version-specific notes.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Can I automate this setup?
&lt;/h3&gt;

&lt;p&gt;Yes! You can bake the user-data script into a Terraform or CloudFormation setup.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. What’s the performance gain from switching to IPVS?
&lt;/h3&gt;

&lt;p&gt;While mileage may vary, IPVS can handle &lt;strong&gt;millions of connections per second&lt;/strong&gt; , significantly outperforming IPTables in high-load scenarios.&lt;/p&gt;

&lt;p&gt;Thank you so much for reading the article till the end! 🙌🏻 Your time and interest truly mean a lot. 😁📃&lt;/p&gt;

&lt;p&gt;If you have any &lt;strong&gt;questions or thoughts&lt;/strong&gt; about this blog, feel free to connect with me:&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;LinkedIn:&lt;/strong&gt; &lt;a href="https://www.linkedin.com/in/ravikyada" rel="noopener noreferrer"&gt;Ravi Kyada&lt;/a&gt;&lt;br&gt;&lt;br&gt;
🐦 &lt;strong&gt;Twitter:&lt;/strong&gt; &lt;a href="https://twitter.com/ravijkyada" rel="noopener noreferrer"&gt;@ravijkyada&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Until next time, ✌🏻 &lt;strong&gt;Cheers to more learning and discovery!&lt;/strong&gt; 🇮🇳 🚀&lt;/p&gt;




</description>
      <category>aws</category>
      <category>iptables</category>
      <category>kubernetes</category>
      <category>awseks</category>
    </item>
    <item>
      <title>5 DevOps Security Best Practices for Your SaaS App</title>
      <dc:creator>Ravi Kyada</dc:creator>
      <pubDate>Fri, 04 Apr 2025 04:42:38 +0000</pubDate>
      <link>https://forem.com/ravikyada/5-devops-security-best-practices-for-your-saas-app-2j62</link>
      <guid>https://forem.com/ravikyada/5-devops-security-best-practices-for-your-saas-app-2j62</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0j1i2v0xva802363onq4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0j1i2v0xva802363onq4.png" width="800" height="1200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In a world where software applications are increasingly deployed in the cloud, ensuring their security has never been more critical.&lt;/p&gt;

&lt;p&gt;Adopting robust security practices is essential for software-as-a-service (SaaS) applications to protect sensitive data and maintain user trust.&lt;/p&gt;

&lt;p&gt;DevOps security practices are at the forefront of this transition, enabling teams to build security into their workflows rather than bolting it on as an afterthought.&lt;/p&gt;

&lt;p&gt;In this article, we will explore the top five DevOps security best practices tailor-made for your SaaS applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Implement Secure Coding Practices
&lt;/h3&gt;

&lt;p&gt;Security starts at the code level. By adopting secure coding practices, you reduce the chances of introducing vulnerabilities into your SaaS application right from the development stage.&lt;/p&gt;

&lt;p&gt;This means training your development team to write code with security in mind and leveraging secure patterns and frameworks across all stages of the SDLC.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;✅ Guidelines:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Follow language-specific secure coding standards (e.g., OWASP ASVS).&lt;/li&gt;
&lt;li&gt;Avoid hardcoded secrets; use secrets managers like AWS Secrets Manager or HashiCorp Vault.&lt;/li&gt;
&lt;li&gt;Educate developers on secure design and code review practices.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🛡️ &lt;em&gt;Train your development team regularly on secure coding practices to cultivate a security-first culture.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Perform Regular Security Testing
&lt;/h3&gt;

&lt;p&gt;Security testing should be continuous — not just a one-time task before production. By integrating both manual and automated testing into your pipeline, you can catch vulnerabilities early and reduce risk.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Static and dynamic analysis&lt;/strong&gt; : Use SAST and DAST tools to identify insecure code patterns and runtime vulnerabilities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Manual penetration testing&lt;/strong&gt; : Engage security professionals or use in-house red team exercises to identify complex issues that automated scanners may miss.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Recommended Actions:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Conduct penetration testing and threat modeling.&lt;/li&gt;
&lt;li&gt;Perform regular SAST (Static Application Security Testing) and DAST (Dynamic Application Security Testing).&lt;/li&gt;
&lt;li&gt;Simulate attacks using tools like OWASP ZAP or Burp Suite.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🎯 &lt;em&gt;Make security testing part of your development sprints and CI/CD process to catch vulnerabilities early.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Enforce Least Privilege
&lt;/h3&gt;

&lt;p&gt;The principle of least privilege (PoLP) is crucial in minimizing the attack surface of your application and infrastructure. Every user, service, and system component should only have the permissions necessary to perform their function — and nothing more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Role-based access control (RBAC)&lt;/strong&gt;: Use RBAC mechanisms across your cloud, Kubernetes, and SaaS systems to tightly control access.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Audit permissions regularly&lt;/strong&gt; : Avoid privilege creep by reviewing and revoking unused or excessive access rights.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;How:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Implement Role-Based Access Control (RBAC) for users and services.&lt;/li&gt;
&lt;li&gt;Use Just-In-Time (JIT) access policies where possible.&lt;/li&gt;
&lt;li&gt;Audit roles and privileges regularly and revoke unused ones.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🔐 &lt;em&gt;Adhering to PoLP limits the potential impact of compromised credentials or internal threats.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Secure CI/CD Pipeline
&lt;/h3&gt;

&lt;p&gt;Your CI/CD pipeline is one of the most sensitive components in your DevOps lifecycle. If compromised, it can lead to supply chain attacks and full control over your deployed environment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Secure credentials and secrets&lt;/strong&gt; : Always encrypt secrets and store them in secure vaults instead of in environment files or config scripts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Isolate build environments&lt;/strong&gt; : Use containerized or ephemeral environments to prevent attackers from jumping across builds or stages.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Tips:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use signed commits and enforce branch protection rules.&lt;/li&gt;
&lt;li&gt;Store credentials securely (e.g., GitHub Secrets, GitLab CI variables).&lt;/li&gt;
&lt;li&gt;Scan dependencies and artifacts before deployment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🚨 &lt;em&gt;Compromised pipelines can lead to supply chain attacks — always treat them as production environments.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Monitor and Respond to Threats
&lt;/h3&gt;

&lt;p&gt;Continuous monitoring and quick incident response are vital in a modern SaaS environment. Even with strong prevention, breaches can happen — so you must detect, alert, and respond effectively.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Centralized logging and SIEM&lt;/strong&gt; : Aggregate logs across services and integrate with tools to identify anomalies and suspicious behavior.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Incident response planning&lt;/strong&gt; : Develop and test playbooks regularly to ensure your team knows how to react under pressure.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Tools:&lt;/strong&gt; Prometheus, Grafana, CloudWatch, ELK Stack, Falco&lt;br&gt;&lt;br&gt;
 ✅ &lt;strong&gt;Strategies:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Centralize logs and use SIEM systems.&lt;/li&gt;
&lt;li&gt;Set alerts for unusual behavior or policy violations.&lt;/li&gt;
&lt;li&gt;Regularly test incident response playbooks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👁️ &lt;em&gt;You can’t secure what you don’t monitor. A robust observability setup enables fast detection and recovery.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Bonus Points
&lt;/h3&gt;

&lt;h3&gt;
  
  
  6. Hardening Servers and Containers:
&lt;/h3&gt;

&lt;p&gt;The first step towards securing your SaaS application is hardening your servers, containers, and instances operating in the cloud.&lt;/p&gt;

&lt;p&gt;This means taking proactive steps to secure services such as NGINX, Apache, MySQL, and Node.js. Here are some key practices:&lt;/p&gt;

&lt;p&gt;Secure your operating system: Whether you’re using a virtual machine or a Docker image, ensure that your base OS is hardened against security vulnerabilities.&lt;br&gt;&lt;br&gt;
Use trusted Docker images: Always pull Docker images from well-known and trusted sources in your community to minimize exposure to malicious code.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Practices:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use minimal base images and keep them updated.&lt;/li&gt;
&lt;li&gt;Disable unused services and enforce secure configurations.&lt;/li&gt;
&lt;li&gt;Pull images only from trusted sources and verify integrity.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  7. Application Security with OWASP
&lt;/h3&gt;

&lt;p&gt;Application security plays a crucial role in protecting sensitive data and processes. Implementing the OWASP Top Ten methodology can significantly enhance your application’s security posture. This framework helps your development team understand and mitigate common vulnerabilities such as:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Cross-Site Scripting (XSS)&lt;/li&gt;
&lt;li&gt;SQL Injection&lt;/li&gt;
&lt;li&gt;Cross-Site Request Forgery (CSRF)&lt;/li&gt;
&lt;li&gt;Security misconfigurations&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By adhering to OWASP’s guidelines, your development team will be better prepared to identify potential security flaws early in the development cycle.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Focus Areas:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Prevent XSS, SQL Injection, and CSRF.&lt;/li&gt;
&lt;li&gt;Sanitize all inputs and apply proper error handling.&lt;/li&gt;
&lt;li&gt;Stay updated on OWASP’s evolving list of vulnerabilities.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  8. Automated Scanning of Containers
&lt;/h3&gt;

&lt;p&gt;Integrating security checks into your Continuous Integration/Continuous Deployment (CI/CD) pipeline is vital. Using tools like Snyk, SonarQube, or Aqua can help automate the scanning of containers and application code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Detect vulnerabilities:&lt;/strong&gt; These tools inspect your containers, operating system, and code for vulnerabilities, allowing you to catch issues before they make it to production.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Ensure compliance:&lt;/strong&gt; By consistently running these scans, you can ensure that your deployments comply with your organization’s security policies and regulatory requirements.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;9. Securing Your Cloud Environment&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;When utilizing cloud services such as AWS, Google Cloud, or Azure, security configuration must be prioritized. Here are some key points for securing your cloud environment:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using Virtual Private Cloud (VPC):&lt;/strong&gt; Create public and private subnets within your VPC to segment resources effectively. Schedule critical services in private subnets while exposing only necessary services through public subnets.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Kubernetes security:&lt;/strong&gt; Safeguard your Kubernetes clusters through:&lt;br&gt;&lt;br&gt;
Namespace handling: Configure namespaces to isolate resources effectively.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Role-Based Access Control (RBAC):&lt;/strong&gt; Implement RBAC to restrict access to sensitive systems and data.&lt;/p&gt;

&lt;h3&gt;
  
  
  10. Implement a Reliable Backup Ecosystem
&lt;/h3&gt;

&lt;p&gt;Backing up your data and systems is critical for disaster recovery, albeit it may not seem directly related to security. By implementing robust backup practices, you ensure that data can be quickly restored in the event of a security incident.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use managed services like AWS RDS for automatic backups of your databases.&lt;/li&gt;
&lt;li&gt;Regularly backup EC2 instances automatically, ensuring rapid recovery in case of incidents.&lt;/li&gt;
&lt;li&gt;Consider using infrastructure as code tools like Terraform to automate and version your entire production environment to facilitate quick and effective recovery if needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ✅ Final Thoughts:
&lt;/h3&gt;

&lt;p&gt;DevOps isn’t just about shipping fast — it’s about shipping &lt;strong&gt;securely and confidently&lt;/strong&gt;. By implementing these 10 practices, your team can build a resilient SaaS app that’s ready to withstand modern security threats without compromising agility.&lt;/p&gt;

&lt;p&gt;Implementing these top five DevOps security best practices can significantly enhance your SaaS application’s resilience against potential threats.&lt;/p&gt;

&lt;p&gt;Prioritizing security measures such as hardening your servers and containers, adhering to established frameworks like OWASP, and integrating automated scanning tools into your CI/CD processes can create a robust defense mechanism for your applications.&lt;/p&gt;

&lt;p&gt;Furthermore, maintaining a reliable backup ecosystem ensures you can quickly recover from potential disasters.&lt;/p&gt;

&lt;p&gt;By adopting these best practices, you not only protect your application but also build trust with your users.&lt;/p&gt;

&lt;p&gt;If you’re looking for further assistance or specific solutions related to DevOps security practices for your SaaS application, explore &lt;a href="https://ravijkyada.medium.com/" rel="noopener noreferrer"&gt;Medium Profile.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you so much for reading the article till the end! 🙌🏻 Your time and interest truly mean a lot. 😁📃&lt;/p&gt;

&lt;p&gt;If you have any &lt;strong&gt;questions or thoughts&lt;/strong&gt; about this blog, feel free to connect with me:&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;LinkedIn:&lt;/strong&gt; &lt;a href="https://www.linkedin.com/in/ravikyada" rel="noopener noreferrer"&gt;Ravi Kyada&lt;/a&gt;&lt;br&gt;&lt;br&gt;
🐦 &lt;strong&gt;Twitter:&lt;/strong&gt; &lt;a href="https://twitter.com/ravijkyada" rel="noopener noreferrer"&gt;@ravijkyada&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Until next time, ✌🏻 &lt;strong&gt;Cheers to more learning and discovery!&lt;/strong&gt; 🇮🇳 🚀&lt;/p&gt;




</description>
      <category>security</category>
      <category>saas</category>
      <category>saastools</category>
      <category>devops</category>
    </item>
    <item>
      <title>AWS EKS IP Exhaustion: Causes, Solutions, and Best Practices</title>
      <dc:creator>Ravi Kyada</dc:creator>
      <pubDate>Tue, 18 Mar 2025 10:31:13 +0000</pubDate>
      <link>https://forem.com/ravikyada/aws-eks-ip-exhaustion-causes-solutions-and-best-practices-187a</link>
      <guid>https://forem.com/ravikyada/aws-eks-ip-exhaustion-causes-solutions-and-best-practices-187a</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fivx52oexs7i8pu1w0mgd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fivx52oexs7i8pu1w0mgd.png" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Imagine your AWS EKS cluster running smoothly in production, all CI/CD pipelines are working without any issues, services are scaling gracefully, and everything feels like autopilot mode. — Until one day, new pods fail to start.&lt;/p&gt;

&lt;h4&gt;
  
  
  So what’s going on?
&lt;/h4&gt;

&lt;p&gt;You dive into kubectl get pods and there it is — a bunch of pods stuck in &lt;strong&gt;Pending&lt;/strong&gt;  state.&lt;/p&gt;

&lt;p&gt;The logs say it all:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Failed to assign an IP address: ENI IP address limit reached.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That’s when it hits you — this isn’t about compute power. It’s a &lt;strong&gt;network-level bottleneck&lt;/strong&gt;. You’re out of &lt;strong&gt;allocatable IP addresses&lt;/strong&gt; in your cluster.&lt;/p&gt;

&lt;p&gt;At first, everything seems normal. But as your workloads scale, pods suddenly get stuck in a Pending state. The culprit? &lt;strong&gt;IP exhaustion.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Networking is the backbone of Kubernetes on AWS, and if not planned correctly, it can lead to serious scaling issues.&lt;/p&gt;

&lt;p&gt;This guide explores why IP exhaustion happens in AWS EKS, how to detect it early, and what best practices you should follow to prevent it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Understanding IP Exhaustion in AWS EKS
&lt;/h3&gt;

&lt;p&gt;AWS EKS assigns an IP address to every pod using the &lt;strong&gt;AWS VPC CNI (Container Network Interface)&lt;/strong&gt;. While this provides native networking integration with AWS, it also means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every pod consumes an IP from the &lt;strong&gt;subnet CIDR block&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;AWS reserves &lt;strong&gt;five IPs per subnet&lt;/strong&gt; , reducing the available range.&lt;/li&gt;
&lt;li&gt;Small CIDR blocks fill up quickly, leading to &lt;strong&gt;eventual IP exhaustion&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The available IP pool shrinks as your cluster scales, preventing new pods from running.&lt;/p&gt;

&lt;h3&gt;
  
  
  How AWS EKS Assigns IPs
&lt;/h3&gt;

&lt;h3&gt;
  
  
  AWS VPC CNI and Its Role
&lt;/h3&gt;

&lt;p&gt;The &lt;strong&gt;AWS VPC CNI plugin&lt;/strong&gt; manages pod-to-IP allocation using the primary VPC CIDR block. Here’s how it works:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each Kubernetes node gets an &lt;strong&gt;Elastic Network Interface (ENI)&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The ENI gets &lt;strong&gt;multiple secondary IPs&lt;/strong&gt; , assigned to running pods.&lt;/li&gt;
&lt;li&gt;The number of available IPs depends on the &lt;strong&gt;node instance type&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, an &lt;strong&gt;m5.large&lt;/strong&gt; instance supports 10 pods per ENI, meaning if you run more, you’ll need another ENI — consuming even more IPs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Does IP Exhaustion Happen?
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Subnet Size Limitations&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;AWS reserves &lt;strong&gt;five IPs per subnet&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Small subnets (e.g., /25) run out of addresses faster.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scaling Issues&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;More pods = more IPs required.&lt;/li&gt;
&lt;li&gt;Without proper planning, clusters grow beyond their available IPs.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Incorrect CIDR Block Allocation.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Using a &lt;strong&gt;/25 CIDR&lt;/strong&gt; for a large cluster is insufficient.&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;/20 or /21 CIDR&lt;/strong&gt; is recommended for high-scale deployments.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Signs That Your Cluster Is Running Out of IPs
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pods are stuck in&lt;/strong&gt;  &lt;strong&gt;Pending state&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;aws-node logs show IP exhaustion errors&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CloudWatch logs indicate subnet IP depletion&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Run the following command to check available IPs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get pods -A -o wide | grep Pending
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or monitor subnet usage with AWS CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws ec2 describe-subnets --filters "Name=vpc-id,Values=&amp;lt;your-vpc-id&amp;gt;" --query 'Subnets[*].[SubnetId,AvailableIpAddressCount]'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Best Practices to Prevent IP Exhaustion
&lt;/h3&gt;

&lt;h3&gt;
  
  
  1. Use a Larger CIDR Block
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Start with a &lt;strong&gt;/20 or /21&lt;/strong&gt; instead of /25 or /24.&lt;/li&gt;
&lt;li&gt;This provides &lt;strong&gt;thousands of IPs&lt;/strong&gt; for your cluster.&lt;/li&gt;
&lt;li&gt;Example setup:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws ec2 create-vpc --cidr-block 10.0.0.0/20
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Use Nitro-Based Instances
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Nitro instances support &lt;strong&gt;Prefix Delegation&lt;/strong&gt; , reducing IP overhead.&lt;/li&gt;
&lt;li&gt;Example: c6g, m6g, and r6g instances allow &lt;strong&gt;prefix-based IP allocation&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Leverage Secondary CIDR Blocks
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Add extra CIDR blocks to your VPC.&lt;/li&gt;
&lt;li&gt;This prevents a single subnet from exhausting all available IPs.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws ec2 associate-vpc-cidr-block --vpc-id &amp;lt;your-vpc-id&amp;gt; --cidr-block 10.1.0.0/16
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Enable Prefix Delegation
&lt;/h3&gt;

&lt;p&gt;Prefix delegation allows ENIs to allocate &lt;strong&gt;smaller subnet prefixes&lt;/strong&gt; instead of full IPs. This significantly reduces IP waste.&lt;/p&gt;

&lt;p&gt;To enable it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl set env daemonset aws-node -n kube-system ENABLE_PREFIX_DELEGATION=true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5. Use AWS PrivateLink for Services
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Avoid assigning &lt;strong&gt;public IPs&lt;/strong&gt; where unnecessary.&lt;/li&gt;
&lt;li&gt;AWS PrivateLink routes traffic &lt;strong&gt;internally&lt;/strong&gt; , saving IPs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Monitoring IP Usage in AWS EKS
&lt;/h3&gt;

&lt;p&gt;Use &lt;strong&gt;CloudWatch&lt;/strong&gt; and aws-node logs to track available IPs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl logs -n kube-system aws-node | grep "IP exhaustion"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Set up alerts with Amazon CloudWatch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws cloudwatch put-metric-alarm --alarm-name IP-Exhaustion-Alert \
  --metric-name AvailableIPCount --namespace AWS/VPC \
  --threshold 10 --comparison-operator LessThanThreshold \
  --evaluation-periods 1 --alarm-actions arn:aws:sns:region:account-id:topic-name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Debugging IP Exhaustion Issues
&lt;/h3&gt;

&lt;h3&gt;
  
  
  1. Identify Stuck Pods
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get pods --all-namespaces -o wide | grep Pending
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Check IP Availability
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws ec2 describe-subnets --query 'Subnets[*].[SubnetId,AvailableIpAddressCount]'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Restart aws-node DaemonSet
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl rollout restart daemonset aws-node -n kube-system
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Case Study: Preventing IP Exhaustion in a Growing EKS Deployment
&lt;/h3&gt;

&lt;p&gt;A SaaS startup faced &lt;strong&gt;scaling issues&lt;/strong&gt; as its EKS cluster outgrew a /25 subnet. Pods were failing, and deployments stalled. The solution:&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Migrated to a&lt;/strong&gt;  &lt;strong&gt;/20 CIDR block&lt;/strong&gt; for long-term scalability.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Switched to Nitro instances&lt;/strong&gt; for Prefix Delegation support.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Used AWS PrivateLink&lt;/strong&gt; to reduce public IP allocation.&lt;/p&gt;

&lt;p&gt;Within a few weeks, they eliminated IP exhaustion issues and achieved &lt;strong&gt;seamless scaling&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;AWS EKS networking &lt;strong&gt;must be planned in advance&lt;/strong&gt; to avoid IP exhaustion issues. Using a &lt;strong&gt;proper CIDR block&lt;/strong&gt; , enabling &lt;strong&gt;Prefix Delegation&lt;/strong&gt; , and monitoring &lt;strong&gt;IP consumption&lt;/strong&gt; will prevent costly scaling failures.&lt;/p&gt;

&lt;p&gt;By implementing these best practices, you can ensure your Kubernetes workloads &lt;strong&gt;scale smoothly&lt;/strong&gt; without hitting network roadblocks. 🚀&lt;/p&gt;

&lt;h3&gt;
  
  
  FAQ
&lt;/h3&gt;

&lt;h3&gt;
  
  
  1. What is AWS VPC CNI, and how does it assign IPs?
&lt;/h3&gt;

&lt;p&gt;AWS VPC CNI assigns IPs from the &lt;strong&gt;VPC CIDR block&lt;/strong&gt; to each pod running in EKS. It does this via &lt;strong&gt;Elastic Network Interfaces (ENIs)&lt;/strong&gt; attached to EC2 nodes.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. How can I check if my AWS EKS cluster is running out of IPs?
&lt;/h3&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get pods -A -o wide | grep Pending
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or check available IPs in subnets:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws ec2 describe-subnets --query 'Subnets[*].[AvailableIpAddressCount]'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. What’s the best CIDR block size for an EKS cluster?
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;/20 or /21&lt;/strong&gt; CIDR block is recommended for large-scale deployments to avoid early IP exhaustion.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. How does Prefix Delegation improve IP efficiency?
&lt;/h3&gt;

&lt;p&gt;Prefix Delegation allows ENIs to &lt;strong&gt;allocate IPs more efficiently&lt;/strong&gt; , reducing waste and increasing scalability.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Can I add more IPs to an existing AWS EKS cluster?
&lt;/h3&gt;

&lt;p&gt;Yes! You can &lt;strong&gt;associate a secondary CIDR block&lt;/strong&gt; to your VPC to expand available IPs without downtime.&lt;/p&gt;

&lt;p&gt;By implementing these strategies, you’ll &lt;strong&gt;future-proof your AWS EKS networking&lt;/strong&gt; and avoid painful IP exhaustion issues. 🚀&lt;/p&gt;

&lt;p&gt;Thank you so much for reading the article till the end! 🙌🏻 Your time and interest truly mean a lot. 😁📃&lt;/p&gt;

&lt;p&gt;If you have any &lt;strong&gt;questions or thoughts&lt;/strong&gt; about this blog, feel free to connect with me:&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;LinkedIn:&lt;/strong&gt; &lt;a href="https://www.linkedin.com/in/ravikyada" rel="noopener noreferrer"&gt;Ravi Kyada&lt;/a&gt;&lt;br&gt;&lt;br&gt;
🐦 &lt;strong&gt;Twitter:&lt;/strong&gt; &lt;a href="https://twitter.com/ravijkyada" rel="noopener noreferrer"&gt;@ravijkyada&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Until next time, ✌🏻 &lt;strong&gt;Cheers to more learning and discovery!&lt;/strong&gt; 🇮🇳 🚀&lt;/p&gt;




</description>
      <category>aws</category>
      <category>networking</category>
      <category>ipv4</category>
      <category>kubernetes</category>
    </item>
    <item>
      <title>How to Automate Tasks in Linux with Cron Jobs and Shell Scripting (Step-by-Step Guide)</title>
      <dc:creator>Ravi Kyada</dc:creator>
      <pubDate>Mon, 17 Mar 2025 12:44:30 +0000</pubDate>
      <link>https://forem.com/ravikyada/how-to-automate-tasks-in-linux-with-cron-jobs-and-shell-scripting-step-by-step-guide-3a34</link>
      <guid>https://forem.com/ravikyada/how-to-automate-tasks-in-linux-with-cron-jobs-and-shell-scripting-step-by-step-guide-3a34</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faasajyf0aop9ui88w74h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faasajyf0aop9ui88w74h.png" width="800" height="1200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Imagine never having to execute a repetitive task again manually. What if your computer could effortlessly handle scheduled maintenance, database backups, or log rotations?&lt;/p&gt;

&lt;p&gt;That’s exactly what &lt;strong&gt;Automate Tasks in Linux with Cron Jobs and Shell Scripting&lt;/strong&gt; helps you to do! Whether you’re a seasoned sysadmin or just diving into automation, mastering cron jobs can save you valuable time and effort.&lt;/p&gt;

&lt;p&gt;Have you ever wondered how system tasks run at precise intervals without human intervention? That’s the magic of cron jobs! By leveraging &lt;strong&gt;Automate Tasks in Linux with Cron Jobs and Shell Scripting&lt;/strong&gt; , you can set up tasks to execute on a schedule — be it hourly, daily, weekly, or even by the second.&lt;/p&gt;

&lt;p&gt;Let’s dive deep into how cron jobs work, how to configure them, and how to enhance your automation with cron.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Task Automation in Linux?
&lt;/h3&gt;

&lt;p&gt;Task automation in Linux allows users to execute scripts and commands at predefined times, eliminating the need for manual intervention.&lt;/p&gt;

&lt;p&gt;Whether it’s system maintenance, backups, or log management, automation ensures efficiency and reliability.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Use Cron Jobs and Shell Scripts?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Cron jobs&lt;/strong&gt; schedule tasks, while &lt;strong&gt;shell scripts&lt;/strong&gt; define a sequence of commands to execute. Together, they form a powerful automation system for Linux users, developers, and sysadmins.&lt;/p&gt;

&lt;h3&gt;
  
  
  Understanding Cron Jobs
&lt;/h3&gt;

&lt;h3&gt;
  
  
  What is a Cron Job?
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;cron job&lt;/strong&gt; is a scheduled task that runs automatically at specified intervals. The Linux cron daemon (cron.service) manages these jobs, executing them in the background.&lt;/p&gt;

&lt;h3&gt;
  
  
  How Does the Cron Daemon Work?
&lt;/h3&gt;

&lt;p&gt;The cron daemon reads the crontab file, which contains scheduled tasks. When the system time matches a cron entry, the corresponding command runs automatically.&lt;/p&gt;

&lt;p&gt;To check if the cron daemon is active:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl status cron.service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Crontab: The Heart of Cron Jobs
&lt;/h3&gt;

&lt;h3&gt;
  
  
  What is Crontab?
&lt;/h3&gt;

&lt;p&gt;Crontab (Cron Table) is a file where users define scheduled tasks.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Edit Crontab Entries
&lt;/h3&gt;

&lt;p&gt;Use the following command to edit your crontab:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;crontab -e
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Crontab Syntax Explained (* * * * *)
&lt;/h3&gt;

&lt;p&gt;Crontab uses a five-field format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* * * * * command_to_execute
| | | | |
| | | | +---- Day of the week (0 - 7) [Sunday = 0 or 7]
| | | +------ Month (1 - 12)
| | +-------- Day of the month (1 - 31)
| +---------- Hour (0 - 23)
+------------ Minute (0 - 59)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example: Run a script every day at 5 AM&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0 5 * * * /path/to/script.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Creating a Simple Cron Job
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Example: Scheduling a Script to Run Every Minute
&lt;/h4&gt;

&lt;p&gt;Let’s create a simple script that logs the current date to a file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Create the Script&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo `date` &amp;gt;&amp;gt; /root/date-out.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Make it Executable&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod 775 /root/date-script.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Add it to Crontab&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;crontab -e
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the following line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;*/1 * * * * /bin/sh /root/date-script.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Redirecting Cron Output
&lt;/h3&gt;

&lt;p&gt;To capture the output of a cron job, use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* * * * sh /path/to/script.sh &amp;amp;&amp;gt; log_file.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Redirecting Output to Log Files
&lt;/h3&gt;

&lt;p&gt;To capture cron job output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* * * * * /path/to/script.sh &amp;gt;&amp;gt; /var/log/cron_output.log 2&amp;gt;&amp;amp;1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Checking Cron Job Execution History
&lt;/h3&gt;

&lt;p&gt;Check system logs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat /var/log/syslog | grep CRON
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Introduction to Shell Scripting
&lt;/h3&gt;

&lt;p&gt;Shell scripting automates repetitive tasks by executing a series of commands in a script file. Instead of typing commands manually, you can write a script and run it automatically.&lt;/p&gt;

&lt;h3&gt;
  
  
  Types of Shells
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Bourne Shell (sh)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;C Shell (csh)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Korn Shell (ksh)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;GNU Bourne-Again Shell (bash)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Basic Shell Scripting Example
&lt;/h3&gt;

&lt;p&gt;Create a script file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/sh
echo "Hello, World!"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make it executable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x test.sh
./test.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Using Variables in Shell Scripts
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name="John"
echo "Hello, $name!"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Reading User Input
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;read user_name
echo "Hello, $user_name!"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Making Variables Read-Only
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;readonly VAR_NAME
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Unsetting Variables
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;unset VAR_NAME
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Writing Your First Shell Script
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Creating a Script File
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch my_script.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Adding Execute Permissions
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x my_script.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Writing a Simple Script
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
echo "Hello, World!"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Running the Script
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./my_script.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Automating Tasks with Shell Scripts and Cron Jobs
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Scheduling a Shell Script with Cron
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0 3 * * * /path/to/my_script.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Runs the script daily at 3 AM.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using Cron Jobs for Database Management
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Automating MySQL Backups
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0 2 * * * mysqldump -u root -p mydatabase &amp;gt; /backup/db_backup.sql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Runs a database backup at 2 AM daily.&lt;/p&gt;

&lt;h3&gt;
  
  
  Common Cron Job Mistakes and Fixes
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Path Issues
&lt;/h3&gt;

&lt;p&gt;Use absolute paths:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/bin/bash /home/user/script.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Permission Problems
&lt;/h3&gt;

&lt;p&gt;Ensure the script has execute permissions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x /home/user/script.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Cron jobs and shell scripting make Linux automation seamless and efficient. Mastering these tools saves time and ensures system stability.&lt;/p&gt;

&lt;h3&gt;
  
  
  FAQ
&lt;/h3&gt;

&lt;h3&gt;
  
  
  1. How do I list all my cron jobs?
&lt;/h3&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;crontab -l
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. How do I remove a cron job?
&lt;/h3&gt;

&lt;p&gt;Edit crontab and delete the relevant line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;crontab -e
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Can I schedule cron jobs as a different user?
&lt;/h3&gt;

&lt;p&gt;Yes, using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo crontab -u username -e
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. How do I ensure my cron job is running?
&lt;/h3&gt;

&lt;p&gt;Check logs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat /var/log/syslog | grep CRON
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5. Why isn’t my cron job executing?
&lt;/h3&gt;

&lt;p&gt;Ensure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The script has execute permissions (chmod +x script.sh)&lt;/li&gt;
&lt;li&gt;Absolute paths are used&lt;/li&gt;
&lt;li&gt;The cron daemon is running (sudo systemctl status cron.service)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This guide covers everything you need to &lt;strong&gt;master Linux automation&lt;/strong&gt; using &lt;strong&gt;cron jobs and shell scripting&lt;/strong&gt;. Start automating today!&lt;/p&gt;

&lt;p&gt;Thank you so much for reading the article till the end! 🙌🏻 Your time and interest truly mean a lot. 😁📃&lt;/p&gt;

&lt;p&gt;If you have any &lt;strong&gt;questions or thoughts&lt;/strong&gt; about this blog, feel free to connect with me:&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;LinkedIn:&lt;/strong&gt; &lt;a href="https://www.linkedin.com/in/ravikyada" rel="noopener noreferrer"&gt;Ravi Kyada&lt;/a&gt;&lt;br&gt;&lt;br&gt;
🐦 &lt;strong&gt;Twitter:&lt;/strong&gt; &lt;a href="https://twitter.com/ravijkyada" rel="noopener noreferrer"&gt;@ravijkyada&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Until next time, ✌🏻 &lt;strong&gt;Cheers to more learning and discovery!&lt;/strong&gt; 🇮🇳 🚀&lt;/p&gt;

</description>
      <category>bash</category>
      <category>linux</category>
      <category>cron</category>
    </item>
    <item>
      <title>The Smart Way to Manage Multiple GitHub Accounts in Linux CLI</title>
      <dc:creator>Ravi Kyada</dc:creator>
      <pubDate>Wed, 26 Feb 2025 10:35:43 +0000</pubDate>
      <link>https://forem.com/ravikyada/the-smart-way-to-manage-multiple-github-accounts-in-linux-cli-26g8</link>
      <guid>https://forem.com/ravikyada/the-smart-way-to-manage-multiple-github-accounts-in-linux-cli-26g8</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz6x3sucg85yv737oums4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz6x3sucg85yv737oums4.png" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you work with multiple GitHub accounts, such as personal and work accounts, you may face challenges when pushing code to different repositories.&lt;/p&gt;

&lt;p&gt;Managing multiple GitHub accounts in Linux can be tricky, but with the right setup, it becomes seamless.&lt;/p&gt;

&lt;p&gt;Whether you’re juggling a personal and a work account, or contributing to different organizations, this guide will walk you through setting up and switching between multiple GitHub accounts effortlessly using SSH keys.&lt;/p&gt;

&lt;h3&gt;
  
  
  Challenges &amp;amp; Common Issues
&lt;/h3&gt;

&lt;p&gt;Before diving into the solution, let’s explore the common challenges:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Authentication conflicts&lt;/strong&gt; : You might be logged in with your personal account but need to push to a work repository.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wrong identity in commits&lt;/strong&gt; : If Git uses the wrong email and username, your commits may not be correctly attributed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Permission errors&lt;/strong&gt; : Cloning a repo but realizing you lack the correct SSH key permissions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Luckily, all these issues can be resolved by setting up multiple SSH keys and configuring Git correctly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Generating SSH Keys
&lt;/h3&gt;

&lt;p&gt;For each GitHub account, you need a separate SSH key. Run the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh-keygen -t ed25519 -C "your_personal_email@example.com" -f ~/.ssh/id_ed25519_personal
ssh-keygen -t ed25519 -C "your_work_email@example.com" -f ~/.ssh/id_ed25519_work
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;~/.ssh/id_ed25519_personal (Private key)&lt;/li&gt;
&lt;li&gt;~/.ssh/id_ed25519_personal.pub (Public key)&lt;/li&gt;
&lt;li&gt;~/.ssh/id_ed25519_work (Private key)&lt;/li&gt;
&lt;li&gt;~/.ssh/id_ed25519_work.pub (Public key)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 2: Adding SSH Keys to GitHub
&lt;/h3&gt;

&lt;p&gt;Next, copy and add the public keys to GitHub:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat ~/.ssh/id_ed25519_personal.pub
cat ~/.ssh/id_ed25519_work.pub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go to &lt;strong&gt;GitHub → Settings → SSH and GPG keys&lt;/strong&gt; and add the corresponding keys to each account.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Configuring SSH
&lt;/h3&gt;

&lt;p&gt;Modify your SSH config file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nano ~/.ssh/config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Personal GitHub Account
Host github.com-personal
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_ed25519_personal
    IdentitiesOnly yes

# Work GitHub Account
Host github.com-work
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_ed25519_work
    IdentitiesOnly yes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This ensures Git uses the correct SSH key for each account.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Testing SSH Connections
&lt;/h3&gt;

&lt;p&gt;Verify that each key is correctly associated:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh -T git@github.com-personal
ssh -T git@github.com-work
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If successful, you’ll see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hi username! You've successfully authenticated, but GitHub does not provide shell access.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 5: Cloning Repositories Using Different Accounts
&lt;/h3&gt;

&lt;p&gt;When cloning repositories, use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Personal account:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone git@github.com-personal:your_username/repo.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Work account:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone git@github.com-work:your_work_username/repo.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 6: Configuring Git Identity Per Repository
&lt;/h3&gt;

&lt;p&gt;Set user details inside the repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd repo_name
git config user.name "Your Name"
git config user.email "your_email@example.com"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For global settings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nano ~/.gitconfig

[includeIf "gitdir:~/work/"]
    path = ~/.gitconfig-work
[includeIf "gitdir:~/personal/"]
    path = ~/.gitconfig-personal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 7: Managing SSH Keys Efficiently
&lt;/h3&gt;

&lt;p&gt;Use SSH-Agent to manage keys:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh-add ~/.ssh/id_ed25519_personal
ssh-add ~/.ssh/id_ed25519_work
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To list added keys:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh-add -l
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Alternative Method: HTTPS Credential Helper
&lt;/h3&gt;

&lt;p&gt;Instead of SSH, use HTTPS and personal access tokens:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global credential.helper cache
git clone https://github.com/your_username/repo.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;GitHub will prompt you for credentials, and you can use a personal access token instead of a password.&lt;/p&gt;

&lt;h3&gt;
  
  
  Automating with Scripts
&lt;/h3&gt;

&lt;p&gt;Create a script to switch accounts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "Switching to Work Account"
ssh-add ~/.ssh/id_ed25519_work
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Troubleshooting Common Issues
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;SSH key not being used?&lt;/strong&gt; Use ssh -vT &lt;a href="mailto:git@github.com-personal"&gt;git@github.com-personal&lt;/a&gt; to debug.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Permission denied?&lt;/strong&gt; Ensure the SSH key is added to GitHub.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Best Practices
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Keep SSH keys secure.&lt;/li&gt;
&lt;li&gt;Use meaningful SSH hostnames.&lt;/li&gt;
&lt;li&gt;Use HTTPS for occasional access instead of adding too many SSH keys.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Managing multiple GitHub accounts in Linux becomes easy with SSH keys and proper configuration. By following this guide, you can avoid authentication issues and switch between accounts seamlessly.&lt;/p&gt;

&lt;h3&gt;
  
  
  FAQ
&lt;/h3&gt;

&lt;h3&gt;
  
  
  1. Can I use SSH and HTTPS for different accounts?
&lt;/h3&gt;

&lt;p&gt;Yes! You can use SSH for one account and HTTPS for another.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. How do I remove an SSH key from GitHub?
&lt;/h3&gt;

&lt;p&gt;Go to &lt;strong&gt;Settings → SSH and GPG keys&lt;/strong&gt; , and remove the unwanted key.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. What if I accidentally commit with the wrong account?
&lt;/h3&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit --amend --author="Correct Name &amp;lt;correct@email.com&amp;gt;"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Can I use the same SSH key for multiple GitHub accounts?
&lt;/h3&gt;

&lt;p&gt;No, each GitHub account requires a unique SSH key.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. How can I see which SSH key Git is using?
&lt;/h3&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh -T git@github.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By following these steps, you can efficiently manage multiple GitHub accounts on Linux! 🚀&lt;/p&gt;

&lt;p&gt;Thank you so much for reading the article till the end! 🙌🏻 Your time and interest truly mean a lot. 😁📃&lt;/p&gt;

&lt;p&gt;If you have any &lt;strong&gt;questions or thoughts&lt;/strong&gt; about this blog, feel free to connect with me:&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;LinkedIn:&lt;/strong&gt; &lt;a href="https://www.linkedin.com/in/ravikyada" rel="noopener noreferrer"&gt;Ravi Kyada&lt;/a&gt;&lt;br&gt;&lt;br&gt;
🐦 &lt;strong&gt;Twitter:&lt;/strong&gt; &lt;a href="https://twitter.com/ravijkyada" rel="noopener noreferrer"&gt;@ravijkyada&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Until next time, ✌🏻 &lt;strong&gt;Cheers to more learning and discovery!&lt;/strong&gt; 🇮🇳 🚀&lt;/p&gt;




</description>
      <category>github</category>
      <category>git</category>
      <category>linx</category>
      <category>githubactions</category>
    </item>
    <item>
      <title>Updating WordPress and Managing Secure Permissions for PHP</title>
      <dc:creator>Ravi Kyada</dc:creator>
      <pubDate>Thu, 20 Feb 2025 08:41:57 +0000</pubDate>
      <link>https://forem.com/ravikyada/updating-wordpress-and-managing-secure-permissions-for-php-1il3</link>
      <guid>https://forem.com/ravikyada/updating-wordpress-and-managing-secure-permissions-for-php-1il3</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn05g8snqt0pehmor3p8f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn05g8snqt0pehmor3p8f.png" width="800" height="457"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Imagine you leave your front door unlocked at night. Would you sleep peacefully? Probably not. Yet, many WordPress users unknowingly leave their websites vulnerable by neglecting updates and mismanaging file permissions.&lt;/p&gt;

&lt;p&gt;If you’ve ever encountered errors like &lt;strong&gt;“The update cannot be installed because some files could not be copied”&lt;/strong&gt; , chances are your file permissions are not properly set.&lt;/p&gt;

&lt;p&gt;But don’t worry! In this guide, you’ll learn not just how to update WordPress safely but also how to set up the correct permissions for &lt;strong&gt;maximum security and performance&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Preparing for a WordPress Update
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Backing Up Your Site
&lt;/h3&gt;

&lt;p&gt;Before you update, think of it like skydiving — you wouldn’t jump without a parachute, right? The same goes for your website. Always back up your files and database before updating.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;UpdraftPlus&lt;/strong&gt; , &lt;strong&gt;All-in-One WP Migration&lt;/strong&gt; , or &lt;strong&gt;your web host’s backup feature&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Backup manually using &lt;strong&gt;phpMyAdmin&lt;/strong&gt; for the database and &lt;strong&gt;FTP/SFTP&lt;/strong&gt; for files.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Checking for Compatibility Issues
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Ensure all plugins and themes are &lt;strong&gt;compatible&lt;/strong&gt; with the new WordPress version.&lt;/li&gt;
&lt;li&gt;Use a &lt;strong&gt;staging environment&lt;/strong&gt; to test updates before applying them to your live site.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  How to Update WordPress Safely
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Using the WordPress Dashboard
&lt;/h3&gt;

&lt;p&gt;The easiest way to update WordPress is through the admin panel:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to &lt;strong&gt;Dashboard &amp;gt; Updates&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Update Now&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Wait for the update to complete.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Updating via FTP or SFTP
&lt;/h3&gt;

&lt;p&gt;If the automatic update fails, you can manually update via FTP:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Download the latest WordPress version from &lt;a href="https://wordpress.org/" rel="noopener noreferrer"&gt;wordpress.org&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Extract the .zip file.&lt;/li&gt;
&lt;li&gt;Upload everything &lt;strong&gt;except&lt;/strong&gt;  &lt;strong&gt;wp-config.php and&lt;/strong&gt;  &lt;strong&gt;wp-content&lt;/strong&gt; to your server.&lt;/li&gt;
&lt;li&gt;Run the &lt;strong&gt;Database Update&lt;/strong&gt; prompt (/wp-admin/upgrade.php).&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Manual Update via SSH
&lt;/h3&gt;

&lt;p&gt;For developers, an SSH-based update is faster:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd /var/www/wordpress
wp core update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Understanding File Permissions in WordPress
&lt;/h3&gt;

&lt;h3&gt;
  
  
  What Are File Permissions?
&lt;/h3&gt;

&lt;p&gt;File permissions define &lt;strong&gt;who can read, write, and execute files&lt;/strong&gt; on your server.&lt;/p&gt;

&lt;h3&gt;
  
  
  Breaking Down Permission Numbers
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;644 → Files (Owner: Read/Write, Group &amp;amp; Others: Read)&lt;/li&gt;
&lt;li&gt;755 → Directories (Owner: Full Access, Group &amp;amp; Others: Read/Execute)&lt;/li&gt;
&lt;li&gt;775 → Some servers require this for group editing&lt;/li&gt;
&lt;li&gt;600 → wp-config.php (for extra security)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Importance of Secure PHP Permissions
&lt;/h3&gt;

&lt;p&gt;When your PHP files have the wrong permissions, &lt;strong&gt;malicious scripts can execute&lt;/strong&gt; , or updates can fail.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why File Ownership Matters
&lt;/h3&gt;

&lt;p&gt;The recommended owner for WordPress files is www-data (Apache/Nginx):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chown -R www-data:www-data /var/www/wordpress
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Correct WordPress File &amp;amp; Directory Permissions
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Set Secure Permissions Using These Commands:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;find /var/www/wordpress -type d -exec chmod 755 {} \;
find /var/www/wordpress -type f -exec chmod 644 {} \;
chmod 600 /var/www/wordpress/wp-config.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Advanced: Adjusting Ownership for Security
&lt;/h3&gt;

&lt;p&gt;If permissions alone don’t fix your issue, update ownership:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chown -R www-data:www-data /var/www/wordpress
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Fixing Common Permission Errors
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;“Cannot Install Plugin or Theme” Error&lt;/strong&gt; → Check write permissions on /wp-content/uploads/.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;“Failed to Write File” Error&lt;/strong&gt; → Ensure directories are 755 and files 644.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Using FS_METHOD for Direct File Updates
&lt;/h3&gt;

&lt;p&gt;Modify wp-config.php:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;define('FS_METHOD', 'direct');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This forces WordPress to update without FTP credentials.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hardening WordPress Security Beyond Permissions
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Restrict access to wp-config.php:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod 600 /var/www/wordpress/wp-config.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Disable file editing in the admin panel:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;define('DISALLOW_FILE_EDIT', true);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Automating Permission Fixes with a Script
&lt;/h3&gt;

&lt;p&gt;Create a shell script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
find /var/www/wordpress -type d -exec chmod 755 {} \;
find /var/www/wordpress -type f -exec chmod 644 {} \;
chown -R www-data:www-data /var/www/wordpress
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Checking Server Logs for Permission Errors
&lt;/h3&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tail -f /var/log/apache2/error.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  When to Contact Your Web Host
&lt;/h3&gt;

&lt;p&gt;If none of these fixes work, your host may &lt;strong&gt;restrict file access&lt;/strong&gt;. Contact support.&lt;/p&gt;

&lt;h3&gt;
  
  
  Final Thoughts on Security &amp;amp; Updates
&lt;/h3&gt;

&lt;p&gt;Keeping WordPress updated &lt;strong&gt;and&lt;/strong&gt; securing permissions is like &lt;strong&gt;locking your doors&lt;/strong&gt;. You want to &lt;strong&gt;strike a balance&lt;/strong&gt; between security and functionality.&lt;/p&gt;

&lt;h3&gt;
  
  
  FAQs
&lt;/h3&gt;

&lt;h3&gt;
  
  
  1. Why do my WordPress updates fail?
&lt;/h3&gt;

&lt;p&gt;Usually due to &lt;strong&gt;incorrect file permissions or ownership&lt;/strong&gt; issues.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Should I use 777 permissions?
&lt;/h3&gt;

&lt;p&gt;Never! This makes your site vulnerable to attacks.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. How do I know if my permissions are correct?
&lt;/h3&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls -la /var/www/wordpress
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. What if my host doesn’t allow permission changes?
&lt;/h3&gt;

&lt;p&gt;Some managed hosting providers have &lt;strong&gt;locked file permissions&lt;/strong&gt;. Contact them.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Does incorrect ownership affect performance?
&lt;/h3&gt;

&lt;p&gt;Yes. It can cause &lt;strong&gt;slow updates, plugin failures, and security risks&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Thank you so much for reading the article till the end! 🙌🏻 Your time and interest truly mean a lot. 😁📃&lt;/p&gt;

&lt;p&gt;If you have any &lt;strong&gt;questions or thoughts&lt;/strong&gt; about this blog, feel free to connect with me:&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;LinkedIn:&lt;/strong&gt; &lt;a href="https://www.linkedin.com/in/ravikyada" rel="noopener noreferrer"&gt;Ravi Kyada&lt;/a&gt;&lt;br&gt;&lt;br&gt;
🐦 &lt;strong&gt;Twitter:&lt;/strong&gt; &lt;a href="https://twitter.com/ravijkyada" rel="noopener noreferrer"&gt;@ravijkyada&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Until next time, ✌🏻 &lt;strong&gt;Cheers to more learning and discovery!&lt;/strong&gt; 🇮🇳 🚀&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>apache</category>
      <category>php</category>
    </item>
    <item>
      <title>Resolving SSH Authentication Issues in Jenkins: A Step-by-Step Guide</title>
      <dc:creator>Ravi Kyada</dc:creator>
      <pubDate>Mon, 17 Feb 2025 06:36:57 +0000</pubDate>
      <link>https://forem.com/ravikyada/resolving-ssh-authentication-issues-in-jenkins-a-step-by-step-guide-3o65</link>
      <guid>https://forem.com/ravikyada/resolving-ssh-authentication-issues-in-jenkins-a-step-by-step-guide-3o65</guid>
      <description>&lt;p&gt;Jenkins is a widely used automation tool, that helps developers streamline CI/CD workflows.&lt;/p&gt;

&lt;p&gt;One common use case is deploying applications or running commands on remote servers via SSH using the &lt;strong&gt;Publish Over SSH&lt;/strong&gt;  plugin.&lt;/p&gt;

&lt;p&gt;However, many users face authentication errors that prevent successful connections.&lt;/p&gt;

&lt;p&gt;One such error is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ardjenkins.plugins.publish_over.BapPublisherException: Failed to connect and initialize SSH connection. Message: [Failed to connect session for config [.....]. Message [Auth fail]]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This blog will help you understand why this happens and how to resolve it with a simple SSH configuration update.&lt;/p&gt;

&lt;h3&gt;
  
  
  Understanding the Issue
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Why Does the SSH Authentication Error Occur?
&lt;/h3&gt;

&lt;p&gt;This issue occurs due to &lt;strong&gt;recent security changes in OpenSSH&lt;/strong&gt; , where &lt;strong&gt;ssh-rsa&lt;/strong&gt; has been deprecated as a default authentication method. If your remote server runs a newer version of OpenSSH (such as on &lt;strong&gt;Ubuntu 20.04 or 22.04&lt;/strong&gt; ), it may reject authentication attempts using older RSA keys.&lt;/p&gt;

&lt;p&gt;This is why Jenkins’ &lt;strong&gt;Publish Over SSH&lt;/strong&gt; plugin may fail to connect, even if your SSH key is correctly stored in &lt;strong&gt;Jenkins credentials&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Identify the Issue?
&lt;/h3&gt;

&lt;p&gt;If you try to connect manually using SSH, you may see this error in the remote machine’s logs (/var/log/auth.log):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]
error: Received disconnect from XX.XX.XX.XX port 54588:3: com.jcraft.jsch.JSchException: Auth fail [preauth]
Disconnected from authenticating user ubuntu XX.XX.XX.XX port 54588 [preauth]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This log confirms that &lt;strong&gt;ssh-rsa is not an accepted key type&lt;/strong&gt; on the remote server.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Solution: Updating SSH Configuration
&lt;/h3&gt;

&lt;p&gt;To resolve this, you need to &lt;strong&gt;allow ssh-rsa keys&lt;/strong&gt; on the remote server explicitly.&lt;/p&gt;

&lt;h3&gt;
  
  
  📌 Step-by-Step Fix
&lt;/h3&gt;

&lt;p&gt;Follow these steps on the remote machine:&lt;/p&gt;

&lt;h3&gt;
  
  
  1️⃣ Access the Remote Machine
&lt;/h3&gt;

&lt;p&gt;Log in to your remote server where Jenkins is trying to connect:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh user@remote-server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2️⃣ Edit the SSH Configuration File
&lt;/h3&gt;

&lt;p&gt;Use a text editor like vi or nano to modify the SSH daemon configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo vi /etc/ssh/sshd_config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3️⃣ Enable Public Key Authentication
&lt;/h3&gt;

&lt;p&gt;Look for the following line and &lt;strong&gt;uncomment it&lt;/strong&gt; (remove the # if present):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PubKeyAuthentication yes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, &lt;strong&gt;add this line at the bottom of the file&lt;/strong&gt; :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PubKeyAcceptedKeyTypes=+ssh-rsa
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells OpenSSH to &lt;strong&gt;accept SSH-RSA keys&lt;/strong&gt; , restoring compatibility with Jenkins’ Publish Over SSH plugin.&lt;/p&gt;

&lt;h3&gt;
  
  
  4️⃣ Save and Exit the File
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;If using vi, press ESC, type :wq, and hit Enter.&lt;/li&gt;
&lt;li&gt;If using nano, press CTRL + X, then Y, and Enter to save changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5️⃣ Restart SSH Service
&lt;/h3&gt;

&lt;p&gt;After making the changes, restart SSH for them to take effect:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;udo systemctl restart sshd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  6️⃣ (Optional) Reboot the Machine
&lt;/h3&gt;

&lt;p&gt;If the fix does not take effect immediately, try rebooting:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo reboot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Verifying the Fix
&lt;/h3&gt;

&lt;p&gt;Once your remote server has restarted the SSH service (or rebooted), go back to Jenkins and try running your &lt;strong&gt;Publish Over SSH&lt;/strong&gt; job again.&lt;/p&gt;

&lt;p&gt;It should now successfully connect to the remote server without the authentication error. 🎉&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Did This Fix Work?
&lt;/h3&gt;

&lt;p&gt;By default, OpenSSH in newer Linux distributions &lt;strong&gt;disables ssh-rsa&lt;/strong&gt; for security reasons. The fix works because:&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;PubKeyAuthentication yes&lt;/strong&gt; → Ensures SSH key authentication is enabled.&lt;br&gt;&lt;br&gt;
✅ &lt;strong&gt;PubKeyAcceptedKeyTypes=+ssh-rsa&lt;/strong&gt; → Allows ssh-rsa keys that were previously blocked.&lt;/p&gt;

&lt;p&gt;These changes restore compatibility between Jenkins and your remote machine, allowing SSH connections to succeed.&lt;/p&gt;
&lt;h3&gt;
  
  
  Additional Troubleshooting
&lt;/h3&gt;

&lt;p&gt;If you’re still facing issues, try these steps:&lt;/p&gt;
&lt;h3&gt;
  
  
  1️⃣ Ensure Jenkins Uses the Correct SSH Key
&lt;/h3&gt;

&lt;p&gt;If Jenkins still fails to connect, check if the &lt;strong&gt;correct SSH private key is configured in Jenkins credentials&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;strong&gt;Manage Jenkins&lt;/strong&gt; → &lt;strong&gt;Manage Credentials&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Find the &lt;strong&gt;SSH key stored for your server&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Ensure it &lt;strong&gt;matches the public key on the remote server&lt;/strong&gt; (in ~/.ssh/authorized_keys).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also manually test if your key works:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh -i /path/to/your/key user@remote-server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2️⃣ Test SSH Connectivity from the Jenkins Machine
&lt;/h3&gt;

&lt;p&gt;Try connecting manually from the Jenkins server to see if the SSH authentication succeeds:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh user@remote-server -v
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you see &lt;strong&gt;“Auth fail”&lt;/strong&gt; , it means the server is still rejecting your key.&lt;/p&gt;

&lt;h3&gt;
  
  
  3️⃣ Try Regenerating SSH Keys
&lt;/h3&gt;

&lt;p&gt;If your SSH key is old, try generating a &lt;strong&gt;new RSA key pair&lt;/strong&gt; on your Jenkins machine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, add the new public key (id_rsa.pub) to the remote server’s ~/.ssh/authorized_keys file.&lt;/p&gt;

&lt;h3&gt;
  
  
  Alternative Approach: Upgrade Your Key Type
&lt;/h3&gt;

&lt;p&gt;Instead of re-enabling ssh-rsa, consider upgrading to a more secure key type like &lt;strong&gt;ED25519&lt;/strong&gt; or  &lt;strong&gt;ECDSA&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;To generate a new &lt;strong&gt;ED25519 key&lt;/strong&gt; :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, add the new public key to the remote machine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat ~/.ssh/id_ed25519.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update Jenkins to use this new key in &lt;strong&gt;Manage Credentials&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This method is &lt;strong&gt;more secure&lt;/strong&gt; and recommended for modern OpenSSH setups.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;If you are facing SSH authentication errors in Jenkins’ &lt;strong&gt;Publish Over SSH&lt;/strong&gt; plugin, the root cause is often &lt;strong&gt;new OpenSSH security policies&lt;/strong&gt; that disable ssh-rsa.&lt;/p&gt;

&lt;p&gt;The best solution is to &lt;strong&gt;modify the SSH daemon config&lt;/strong&gt; on the remote machine to explicitly allow ssh-rsa keys:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Uncomment&lt;/strong&gt; PubKeyAuthentication yes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add&lt;/strong&gt; PubKeyAcceptedKeyTypes=+ssh-rsa&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Restart&lt;/strong&gt; the SSH service&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If possible, consider &lt;strong&gt;upgrading to stronger key types&lt;/strong&gt; like ED25519 for improved security.&lt;/p&gt;

&lt;p&gt;By following these steps, you can &lt;strong&gt;successfully restore Jenkins SSH connectivity&lt;/strong&gt; , ensuring your automation pipelines run smoothly! 🚀&lt;/p&gt;

&lt;h3&gt;
  
  
  💬 Have You Faced This Issue?
&lt;/h3&gt;

&lt;p&gt;Have you encountered SSH authentication failures with Jenkins? What worked for you? Let us know in the comments! 👇&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;For more details, refer to the&lt;/strong&gt; &lt;a href="https://github.com/jenkinsci/publish-over-ssh-plugin/issues/247" rel="noopener noreferrer"&gt;&lt;strong&gt;original GitHub issue&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>ssh</category>
      <category>jenkins</category>
      <category>linux</category>
      <category>ubuntu</category>
    </item>
  </channel>
</rss>
