The 20 traps listed here are drawn from recurring patterns observed across cloud migration, architecture review, and cost optimization engagements led by Gart's engineers. All provider-specific pricing references were verified against official AWS, Azure, and GCP documentation and FinOps Foundation guidance as of April 2026. This article was last substantially reviewed in April 2026.
Organizations moving infrastructure to the cloud often expect immediate cost savings. The reality is frequently more complicated. Without deliberate cloud cost optimization, cloud bills can grow faster than on-premises costs ever did — driven by dozens of hidden traps that are easy to fall into and surprisingly hard to detect once they compound.
At Gart Solutions, our cloud architects review spending patterns across AWS, Azure, and GCP environments every week. This article distills the 20 most damaging cloud cost optimization traps we encounter — organized into four cost-control layers — along with the signals that reveal them and the fastest fixes available.
Is cloud waste draining your budget right now? Our Infrastructure Audit identifies exactly where spend is leaking — typically within 5 business days. Most clients uncover 20–40% in recoverable cloud costs.
⚡ TL;DR — Quick Summary
Migration traps (Traps 1–4): Lift-and-shift, wrong architecture, over-engineered enterprise tools, and poor capacity forecasting inflate costs from day one.
Architecture traps (Traps 5–9): Data egress, vendor lock-in, over-provisioning, ignored discounts, and storage mismanagement create structural waste.
Operations traps (Traps 10–15): Idle resources, licensing gaps, monitoring blind spots, and poor backup planning drain budgets silently.
Governance & FinOps traps (Traps 16–20): Missing tagging, no cost policies, weak tooling, hidden fees, and undeveloped FinOps practices are the root cause behind most budget overruns.
The biggest single lever: adopting a continuous FinOps operating cadence aligned to the FinOps Foundation framework.
32%
Average cloud waste reported by organizations without a FinOps practice
$0.09/GB
AWS standard egress cost that catches most teams off guard
72%
Maximum savings available via Reserved Instances vs on-demand
20 Cloud Cost Optimization Traps
Use this table to quickly scan every trap and identify where your environment is most exposed before diving into the detailed breakdowns below.
#TrapWhy It HurtsTypical SignalFastest Fix1Lift-and-Shift MigrationPays cloud prices for on-prem designHigh instance costs, poor utilizationRefactor high-cost workloads first2Wrong ArchitectureScalability failures → expensive reworkManual scaling, outages at traffic peaksArchitecture review before migration3Overreliance on Enterprise EditionsPaying for features you don't useEnterprise licenses on dev/stagingAudit licenses by environment tier4Uncontrolled Capacity PlanningOver- or under-provisioned resourcesIdle capacity OR repeated scaling crisesDemand-based autoscaling + monitoring5Underestimating Data EgressEgress fees add up faster than computeData transfer line items spike monthlyVPC endpoints + region co-location6Ignoring Vendor Lock-in RiskSwitching costs explode over timeAll workloads on a single providerAdopt portable abstractions (K8s, Terraform)7Over-Provisioning ResourcesPaying for idle CPU/RAMAvg CPU utilization <20%Right-sizing + Compute Optimizer8Skipping Reserved Instances & Savings PlansOn-demand premium for predictable workloadsNo commitments in billing dashboardAnalyze 3-month usage → commit on stable workloads9Misjudging Storage CostsWrong storage class for access patternS3 Standard used for rarely accessed dataEnable S3 Intelligent-Tiering10Neglecting to Decommission ResourcesPaying for forgotten resourcesUnattached EBS volumes, stopped EC2Weekly idle resource audit + automation11Overlooking Software LicensingBYOL vs license-included confusionDuplicate license chargesLicense inventory before migration12No Monitoring or Optimization LoopWaste compounds undetectedNo cost anomaly alerts configuredEnable AWS Cost Anomaly Detection / Azure Budgets13Poor Backup & DR PlanningOver-replicated data or recovery failuresDR spend exceeds 15% of total cloud billTiered backup strategy with lifecycle policies14Not Using Cloud Cost ToolsInvisible spend patternsNo regular Cost Explorer reportsSchedule weekly cost review cadence15Inadequate Skills & ExpertiseWrong decisions compound into structural debtManual fixes, repeated incidentsEngage a certified cloud partner16Missing Governance & TaggingNo cost attribution = no accountabilityUntagged resources >30% of billEnforce tagging policy via IaC17Ignoring Security & Compliance CostsBreaches cost far more than preventionNo WAF, no encryption at restSecurity baseline as part of onboarding18Missing Hidden FeesNAT, cross-AZ, IPv4, log retention surprisesUnexplained line items in billingDetailed billing breakdown monthly19Not Leveraging Provider DiscountsPaying full price unnecessarilyNo EDP, PPA, or partner program enrollmentWork with an AWS/Azure/GCP partner for pricing20No FinOps Operating CadenceCost decisions made reactivelyNo monthly cloud cost review meetingAdopt FinOps Foundation operating modelCloud Cost Optimization Traps
Traps 1–4: Migration Strategy Mistakes That Set the Wrong Foundation
Cloud cost problems often originate at the very first decision: how to migrate. Poor migration strategy creates structural inefficiencies that become exponentially harder and more expensive to fix after go-live.
Trap 1 - The "Lift and Shift" Approach
Migrating existing infrastructure to the cloud without architectural changes — commonly called "lift and shift" — is the single most widespread source of cloud cost overruns. Cloud economics reward cloud-native design. When you move an on-premises architecture unchanged, you keep all of its inefficiencies while adding cloud-specific cost layers.
A typical example: an on-premises database server running at 15% utilization, provisioned for peak load. In a data center, that idle capacity has no additional cost. In AWS or Azure, you pay for the full instance 24/7. That same pattern repeated across 50 services can double your effective cloud spend versus what a refactored equivalent would cost.
The right approach is "refactoring" — redesigning or partially rewriting applications to use cloud-native services such as managed databases, serverless compute, and event-driven architectures. Refactoring does require upfront investment, but it consistently delivers 30–60% lower steady-state costs compared to lift-and-shift.
Risk: High compute costs; pays cloud prices for on-prem design decisions
Signal: Low CPU/memory utilization (<25%) on most instances post-migration
Fix: Identify the top 5 cost drivers; prioritize those for refactoring in Sprint 1
Trap 2 - Choosing the Wrong IT Architecture
Architecture decisions made before or during migration determine your cost ceiling for years. A monolithic deployment that requires a large EC2 instance to function at all will always cost more than a microservices-based design that can scale individual components independently. Similarly, choosing synchronous service-to-service calls when asynchronous queuing would work causes unnecessary instance sizing to handle peak concurrency.
Poor architectural choices also create security and scalability gaps that require expensive remediation. We have seen clients spend more fixing architectural decisions in year two than their original migration cost.
What to do: Conduct a formal architecture review before migration. Map how services interact, identify coupling points, and evaluate whether managed cloud services (RDS, SQS, ECS Fargate, Lambda) can replace self-managed components. Seek an independent review — internal teams often have blind spots around the architectures they built.
Risk: Expensive rework; environments that don't scale without large instance upgrades
Signal: Manual vertical scaling during traffic events; frequent infrastructure incidents
Fix: Infrastructure audit pre-migration with explicit architecture recommendations
Trap 3 - Overreliance on Enterprise Editions
Many organizations default to enterprise tiers of cloud services and SaaS tools without validating whether standard editions cover their actual requirements. Enterprise editions can cost 3–5× more than standard equivalents while delivering features that 80% of teams never activate.
This is especially common in managed database services, monitoring platforms, and identity management. A 50-person engineering team paying for enterprise database licensing at $8,000/month when a standard tier at $1,200/month would meet their SLA requirements is a straightforward optimization many teams overlook.
What to do: Build a license inventory as part of your migration plan. Map every service tier to actual feature usage. Apply enterprise editions only where specific features — such as advanced security controls or SLA guarantees — are genuinely required. Use non-production environments to validate that standard tiers meet your needs before committing.
Risk: 3–5× cost premium for unused enterprise features
Signal: Enterprise licenses deployed uniformly across all environments including dev/staging
Fix: Feature-usage audit per service; downgrade where usage doesn't justify tier
Trap 4 - Uncontrolled Capacity Planning
Capacity needs differ dramatically by workload type. Some workloads are constant, some linear, some follow exponential growth curves, and some are highly seasonal (e-commerce spikes, payroll runs, end-of-quarter reporting). Without workload-specific capacity models, teams either over-provision to be safe — paying for idle capacity — or under-provision and face service disruptions that result in emergency spending.
A practical example: an e-commerce platform provisioning its peak Black Friday capacity year-round would spend roughly 4× more than a platform using autoscaling with predictive scaling policies and spot instances for burst capacity.
What to do: Model capacity by workload pattern type. Use cloud-native autoscaling with predictive policies (AWS Auto Scaling predictive scaling, Azure VMSS autoscale) for variable workloads. Use Reserved Instances only for the steady-state baseline that you can reliably forecast 12 months out. Review capacity assumptions quarterly.
Risk Persistent over-provisioning or costly emergency scaling events
Signal Flat autoscaling policies; no predictive scaling configured
Fix Workload classification + autoscaling policy tuning + quarterly capacity review
Traps 5–9: Architectural Decisions That Create Structural Waste
Even with a sound migration strategy, specific architectural choices can lock in cost inefficiencies. These traps are particularly dangerous because they are not visible in compute cost reports — they hide in network fees, storage charges, and pricing tiers.
Trap 5 - Underestimating Data Transfer and Egress Costs
Data transfer costs are the most consistently underestimated line item in cloud budgets. AWS charges $0.09 per GB for standard egress from most regions. Azure and GCP follow similar models. For an application that moves 100 TB of data monthly between services, regions, or to end users, that's $9,000 per month from egress alone — often invisible during initial cost modeling.
Beyond external egress, cross-Availability Zone (cross-AZ) data transfer is a hidden cost that catches many teams by surprise. In AWS, cross-AZ traffic costs $0.01 per GB in each direction. A microservices application making frequent cross-AZ calls can generate thousands of dollars in monthly cross-AZ fees that appear in no single obvious dashboard item.
NAT Gateway charges are another overlooked trap: at $0.045 per GB processed (AWS), a data-heavy workload can generate NAT costs that rival compute. Use VPC Interface Endpoints or Gateway Endpoints for S3, DynamoDB, SQS, and other AWS-native services to eliminate unnecessary NAT Gateway traffic entirely.
Risk $0.09+/GB egress; cross-AZ and NAT fees compound quickly at scale
Signal Data transfer line items represent >15% of total cloud bill
Fix Deploy VPC endpoints; co-locate communicating services in same AZ; use CDN for user-facing egress
Trap 6 - Overlooking Vendor Lock-in Risks
Vendor lock-in is not merely an architectural concern — it is a cost risk. When 100% of your workloads are tightly coupled to a single cloud provider's proprietary services, your negotiating position on pricing is zero, migration away from bad pricing agreements is prohibitively expensive, and you are exposed to any pricing changes the provider makes.
Using open standards — Kubernetes for container orchestration, Terraform or Pulumi for infrastructure as code, PostgreSQL-compatible databases rather than proprietary variants — preserves optionality without meaningful cost or performance tradeoffs for most workloads. The Cloud Native Computing Foundation (CNCF) maintains an extensive ecosystem of portable tooling that reduces lock-in risk while supporting enterprise-grade requirements.
Risk Zero pricing leverage; multi-year migration cost if you need to switch
Signal All infrastructure uses proprietary managed services with no portable alternatives
Fix Adopt open standards (K8s, Terraform, open-source databases) for new workloads
Trap 7 - Over-Provisioning Resources
Over-provisioning — allocating more compute, memory, or storage than workloads actually need — is one of the most common and most correctable sources of cloud waste. Industry benchmarks consistently show that average CPU utilization across cloud environments sits below 20%. That means 80% of compute capacity is idle on an average day.
AWS Compute Optimizer analyzes actual utilization metrics and generates rightsizing recommendations. In a typical engagement, Gart architects find that 30–50% of EC2 instances are candidates for downsizing by one or more instance sizes, often without any measurable performance impact. The same pattern applies to managed database instances, where default sizing is frequently 2× what the actual workload requires.
For Kubernetes workloads, idle node waste is a particularly common issue. If EKS nodes run at <40% average utilization, Fargate profiles for low-utilization pods can reduce compute costs significantly by charging only for the CPU and memory actually requested by each pod — not the entire node.
Risk Paying for 80% idle capacity on average; compounds across every service
Signal Average CPU <20%; CloudWatch showing consistent low utilization
Fix Run AWS Compute Optimizer or Azure Advisor; right-size top 10 cost drivers first
Trap 9 - Skipping Reserved Instances and Savings Plans
On-demand pricing is the most expensive way to run predictable workloads. AWS Reserved Instances and Compute Savings Plans offer discounts of up to 72% versus on-demand rates for 1- or 3-year commitments — discounts that are documented in AWS's official pricing documentation. Azure Reserved VM Instances and GCP Committed Use Discounts offer comparable savings.
Despite the size of these savings, many organizations run the majority of their workloads on on-demand pricing, either because they lack the forecasting confidence to commit or because no one has owned the decision. For production workloads with predictable usage — databases, core application servers, monitoring stacks — there is almost never a good reason to use on-demand pricing exclusively.
Practical approach: Analyze your last 90 days of usage. Identify the minimum baseline usage across all instance types — that is your "floor." Commit Reserved Instances to cover that floor. Use Savings Plans (more flexible, applying across instance families and regions) to cover the next layer of predictable usage. Keep only genuine burst capacity on on-demand or Spot.
Risk Paying 72% more than necessary for stable workloads
Signal No active reservations or savings plans in billing console
Fix 90-day usage analysis → commit on the steady-state baseline; layer Savings Plans on top
Trap 10 - Misjudging Data Storage Costs
Storage costs are deceptively easy to ignore when an organization is small — and surprisingly painful when data volumes grow. Three specific patterns create disproportionate storage costs:
Wrong storage class. Storing rarely-accessed data in S3 Standard at $0.023/GB when S3 Glacier Instant Retrieval costs $0.004/GB is a 6× overspend on archival data. S3 Intelligent-Tiering solves this automatically for access patterns you cannot predict — it moves objects between tiers based on access history and can deliver savings of 40–95% on archival content.
EBS volume type mismatch. Most workloads still use gp2 EBS volumes by default. Migrating to gp3 reduces cost by approximately 20% ($0.10/GB vs $0.08/GB in us-east-1) while delivering better baseline IOPS. A team with 5 TB of EBS saves $100/month with a configuration change that takes minutes.
Observability retention bloat. CloudWatch Log Groups with retention set to "Never Expire" accumulate months or years of logs that no one reviews. Setting a 30- or 90-day retention policy on non-compliance logs is one of the simplest cost reductions available and can represent significant monthly savings for data-heavy applications.
Risk Up to 6× overpayment on archival storage; compounding log retention costs
Signal All S3 data in Standard class; CloudWatch retention set to "Never"
Fix Enable Intelligent-Tiering; migrate EBS to gp3; set log retention policies immediately
Traps 10–15: Operational Habits That Drain the Budget Silently
Operational cloud cost traps are the result of what teams do (and don't do) day to day. They are often smaller individually than architectural traps, but they compound quickly and are the most common source of the "unexplained" portion of cloud bills.
Trap 10 - Neglecting to Decommission Unused Resources
Cloud environments accumulate ghost resources — stopped EC2 instances, unattached EBS volumes, unused Elastic IPs, orphaned load balancers, forgotten RDS snapshots — faster than most teams realize. Each item carries a small individual cost, but across a mature cloud environment these can represent 10–20% of the total bill.
Starting from February 2024, AWS charges $0.005 per public IPv4 address per hour — approximately $3.65/month per address. An environment with 200 public IPs that have never been audited pays $730/month in IPv4 fees alone, often without anyone noticing. Transitioning to IPv6 where supported eliminates this cost entirely.
Best practice: Schedule a monthly idle-resource audit using AWS Trusted Advisor, Azure Advisor, or a dedicated FinOps tool. Automate shutdown of non-production resources outside business hours. Set lifecycle policies on EBS snapshots, RDS snapshots, and ECR images to automatically prune old versions.
Risk 10–20% of bill in ghost resources; IPv4 fees accumulate invisibly
Signal Unattached EBS volumes; stopped instances still appearing in billing
Fix Automated weekly cleanup script + lifecycle policies on snapshots and images
Trap 11 - Overlooking Software Licensing Costs
Cloud migration can inadvertently increase software licensing costs in two ways: activating license-included instance types when you already hold bring-your-own-license (BYOL) agreements, or losing license portability by moving to managed services that bundle licensing at a premium.
Windows Server and SQL Server licenses are particularly high-value areas. Running SQL Server Enterprise on a license-included RDS instance can cost significantly more than using a BYOL license on an EC2 instance with an optimized configuration. Understanding your existing software agreements before migration — and mapping them to cloud deployment options — can save substantial amounts annually.
Risk Duplicate licensing costs; paying for bundled licenses when BYOL applies
Signal No license inventory reviewed before migration; license-included instances for Windows/SQL Server
Fix Software license audit pre-migration; map existing agreements to BYOL eligibility in cloud
Trap 12 - Failing to Monitor and Optimize Usage Continuously
Cloud cost optimization is not a one-time project — it is a continuous operational practice. Without ongoing monitoring, cost anomalies go undetected, new services are provisioned without review, and seasonal workloads retain peak-period sizing long after demand has subsided.
AWS Cost Anomaly Detection, Azure Cost Management alerts, and GCP Budget Alerts all provide free anomaly detection capabilities that most organizations never configure. Setting budget thresholds with alert notifications takes less than an hour and provides immediate visibility into unexpected spend spikes.
Recommended monitoring stack: cloud-native cost dashboards (Cost Explorer / Azure Cost Management) for historical analysis, budget alerts for real-time anomaly detection, and a weekly team review of the top 10 cost drivers by service.
Risk Waste compounds for months before anyone notices
Signal No cost anomaly alerts configured; no regular cost review meeting
Fix Enable anomaly detection; schedule weekly cost review; assign cost ownership per team
Trap 13 - Inadequate Backup and Disaster Recovery Planning
Backup and disaster recovery strategies that aren't cost-optimized can inflate cloud bills significantly. Common mistakes include retaining identical backup copies across multiple regions for all data regardless of criticality, keeping backups indefinitely without a lifecycle policy, and running full active-active DR environments for workloads where a simpler warm standby or pilot light approach would meet RTO/RPO requirements.
Cost-effective DR design starts with classifying workloads by criticality tier. Not every application needs a hot standby. Many workloads with RTO requirements of 4+ hours can be recovered efficiently from S3-based backups at a fraction of the cost of a full multi-region active replica. For S3, enabling lifecycle rules that transition backup data to Glacier Deep Archive after 30 days reduces storage cost by up to 95%.
Risk DR costs exceeding 15–20% of total cloud bill for non-critical workloads
Signal Uniform DR strategy applied to all workloads regardless of criticality tier
Fix Workload criticality classification → tiered DR strategy → S3 Glacier lifecycle policies
Trap 14 - Ignoring Cloud Cost Management Tools
Every major cloud provider ships cost management and optimization tools that the majority of organizations either ignore or underuse. AWS Cost Explorer, AWS Compute Optimizer, AWS Trusted Advisor, Azure Advisor, and GCP Recommender collectively surface rightsizing recommendations, reserved capacity suggestions, and idle resource reports — all free of charge.
Third-party FinOps platforms (CloudHealth, Apptio Cloudability, Spot by NetApp) provide cross-provider views and more sophisticated anomaly detection for multi-cloud environments. For organizations spending more than $50K/month on cloud, the ROI on a dedicated FinOps tool typically exceeds 10:1 within the first quarter.
Risk Missing savings recommendations that providers generate automatically
Signal No regular review of Trusted Advisor / Azure Advisor recommendations
Fix Enable all native cost tools; schedule weekly review of top recommendations
Trap 15 - Lack of Appropriate Cloud Skills
Cloud cost optimization requires specific expertise that is not automatically present in teams that migrate from on-premises environments. Teams without cloud-native skills tend to default to familiar patterns — large VMs, manual scaling, on-demand pricing — that systematically cost more than cloud-optimized equivalents.
The skill gap is not just about knowing which services exist. It is about understanding the cost implications of architectural decisions in real time — knowing that choosing a NAT Gateway over a VPC endpoint has a measurable monthly cost, or that a managed database defaults to a larger instance tier than necessary for a given workload.
Gart's approach:We embed a cloud architect alongside your team during the first 90 days post-migration. That direct knowledge transfer prevents the most expensive mistakes during the period when cloud spend is most volatile.
Risk Repeated costly mistakes; structural technical debt from uninformed decisions
Signal Manual infrastructure changes; frequent cost surprises; no IaC adoption
Fix Engage a certified cloud partner for the migration and 90-day post-migration period
Traps 16–20: Governance and FinOps Failures That Undermine Everything Else
The most technically sophisticated cloud architecture can still generate runaway costs without adequate governance. These final five traps operate at the organizational level — they are about processes, policies, and culture as much as technology.
Trap 16 - Missing Governance, Tagging, and Cost Policies
Without a resource tagging strategy, cloud cost reports show you what you're spending but not who is spending it, on what, or why. This makes accountability impossible and optimization very difficult. Untagged resources in a mature cloud environment commonly represent 30–50% of the total bill — a figure that makes cost attribution to business units, projects, or environments nearly impossible.
Effective tagging policies include mandatory tags enforced at provisioning time via Service Control Policies (AWS), Azure Policy, or IaC templates. Minimum viable tags: environment (production/staging/dev), team, project, and cost-center. Resources that fail tagging checks should be prevented from provisioning in production.
Governance beyond tagging includes spending approval workflows for new service provisioning, budget alerts per team, and quarterly cost reviews that compare actual vs. planned spend by business unit.
Risk No cost accountability; optimization impossible without attribution
Signal >30% of resources untagged; no per-team budget visibility
Fix Enforce tagging at IaC level; SCPs/Azure Policy for tag compliance; team-level budget dashboards
Trap 17 - Ignoring Security and Compliance Costs
Under-investing in cloud security creates a different kind of cost trap: the cost of a breach or compliance failure vastly exceeds the cost of prevention. The average cost of a cloud data breach reached $4.9M in 2024 (IBM Cost of a Data Breach report). WAF, encryption at rest, secrets management, and compliance automation are not optional overhead — they are cost controls.
Security-related compliance requirements (SOC 2, HIPAA, GDPR, PCI DSS) also have cloud cost implications: they constrain which storage services, regions, and encryption configurations you can use. Understanding these constraints before architecture is finalized prevents expensive rework and compliance-driven re-migration.
For implementation guidance, the Linux Foundation and cloud provider security frameworks provide open standards for cloud security baselines that are both compliance-aligned and cost-efficient.
Risk Breach costs far exceed prevention investment; compliance rework is expensive
Signal No WAF; secrets in environment variables; no encryption at rest configured
Fix Security baseline as part of initial architecture; compliance audit before go-live
Trap 18 - Not Considering Hidden and Miscellaneous Costs
Beyond compute and storage, cloud bills contain dozens of smaller line items that collectively represent a significant portion of total spend. The most commonly overlooked hidden costs we see in client audits:
Public IPv4 addressing: $0.005/hour per IP in AWS = $3.65/month per address. 100 addresses = $365/month that many teams have never noticed.
Cross-AZ traffic: $0.01/GB in each direction. Microservices with chatty inter-service communication across AZs can generate thousands per month.
NAT Gateway processing: $0.045/GB processed through NAT. Services that use NAT to reach AWS APIs instead of VPC endpoints pay this fee unnecessarily.
CloudWatch log ingestion: $0.50 per GB ingested. Verbose application logging without sampling can generate large CloudWatch bills.
Managed service idle time: RDS instances, ElastiCache clusters, and OpenSearch domains running 24/7 for development workloads that operate 8 hours/day.
Risk Cumulative hidden fees representing 10–25% of total bill
Signal Unexplained or unlabeled line items in billing breakdown
Fix Monthly detailed billing review; enable Cost Allocation Tags; use VPC endpoints to eliminate NAT fees
Trap 19 - Failing to Leverage Cloud Provider Discounts
Beyond Reserved Instances and Savings Plans, cloud providers offer several discount programs that most organizations never explore. AWS Enterprise Discount Program (EDP), Azure Enterprise Agreement (EA) pricing, and GCP Committed Use Discounts can deliver negotiated rates of 10–30% on overall spend for organizations with committed annual volumes.
Working with an AWS, Azure, or GCP partner can also unlock reseller discount arrangements and technical credit programs. Partners in the AWS Partner Network (APN) and Microsoft Partner Network can often pass on pricing that is not directly available to end customers. Gart's AWS partner status allows us to structure engagements that include pricing advantages for qualifying clients — an arrangement that can save 5–15% of annual cloud spend independently of any architectural optimization.
Provider credit programs (AWS Activate for startups, Google for Startups, Microsoft for Startups) are also frequently overlooked by companies that don't realize they qualify. Many Series A and Series B companies are still eligible for substantial credits.
Risk Paying full list price when negotiated rates of 10–30% are available
Signal No EDP, EA, or partner program enrollment; no credits applied
Fix Engage a cloud partner to assess discount program eligibility and negotiate pricing
Trap 20 - No FinOps Operating Cadence
The final and most systemic trap is the absence of an organized FinOps practice. FinOps — Financial Operations — is the cloud financial management discipline that brings financial accountability to variable cloud spend, enabling engineering, finance, and product teams to make informed trade-offs between speed, cost, and quality. The FinOps Foundation defines the framework that leading cloud-native organizations use to govern cloud economics.
Without a FinOps operating cadence, cloud cost optimization is reactive: teams respond to bill shock rather than preventing it. With FinOps, cost optimization becomes embedded in engineering workflows — part of sprint planning, architecture review, and release processes.
Core FinOps practices to adopt immediately:
Weekly cloud cost review meeting with engineering leads and finance representative
Cost forecasts updated monthly by service and team
Budget alerts set at 80% and 100% of monthly targets
Anomaly detection enabled on all accounts
Quarterly optimization sprints with dedicated engineering time for cost improvements
Risk All other 19 traps compound without FinOps to catch them
Signal No regular cost review; cost surprises discovered at invoice receipt
Fix Adopt FinOps Foundation operating model; assign cloud cost owner per account.
Cloud Cost Optimization Checklist for Engineering Leaders
Use this checklist to rapidly assess where your cloud environment stands across the four cost-control layers. Items you cannot check today represent your highest-priority optimization opportunities.
Cloud Cost Optimization Checklist
Migration & Architecture
✓
Workloads have been evaluated for refactoring opportunities, not just lifted and shifted
✓
Architecture has been formally reviewed for cost and scalability by an independent expert
✓
All software licenses have been inventoried and mapped to BYOL vs. license-included options
✓
Data egress paths have been mapped; VPC endpoints used for AWS-native service communication
✓
EBS volumes migrated from gp2 to gp3; S3 storage classes reviewed
Compute & Capacity
✓
Reserved Instances or Savings Plans cover at least 60% of steady-state compute
✓
Autoscaling policies are configured with predictive scaling for variable workloads
✓
AWS Compute Optimizer or Azure Advisor recommendations reviewed and actioned
✓
Non-production environments scheduled to scale down outside business hours
✓
Kubernetes node utilization above 50% average; Fargate evaluated for low-utilization pods
Operations & Monitoring
✓
Monthly idle resource audit completed; unattached EBS volumes and unused IPs removed
✓
CloudWatch log group retention policies set on all groups
✓
Cost anomaly detection enabled on all cloud accounts
✓
Weekly cost review cadence established with team leads
✓
DR strategy tiered by workload criticality; not all workloads on active-active
Governance & FinOps
✓
Tagging policy enforced at provisioning time via IaC or cloud policy
✓
<10% of resources untagged in production environments
✓
Per-team or per-project cloud budget dashboards visible to engineering and finance
✓
Cloud discount programs (EDP, EA, partner programs) evaluated and enrolled where eligible
✓
FinOps operating cadence established with quarterly optimization sprints
Stop Guessing. Start Optimizing.
Gart's cloud architects have helped 50+ organizations recover 20–40% of their cloud spend — without sacrificing performance or reliability.
🔍 Cloud Cost Audit
We analyze your full cloud bill and deliver a prioritized savings roadmap within 5 business days.
🏗️ Architecture Review
Identify structural inefficiencies like over-provisioning and redesign for efficiency without disruption.
📊 FinOps Implementation
Operating cadence, tagging governance, and cost dashboards to keep cloud spend under control.
☁️ Ongoing Optimization
Monthly or quarterly retainers that keep your spend aligned with business goals as workloads evolve.
Book a Free Cloud Cost Assessment →
★★★★★
Reviewed on Clutch 4.9 / 5.0
· 15 verified reviews
AWS & Azure certified partner
Roman Burdiuzha
Co-founder & CTO, Gart Solutions · Cloud Architecture Expert
Roman has 15+ years of experience in DevOps and cloud architecture, with prior leadership roles at SoftServe and lifecell Ukraine. He co-founded Gart Solutions, where he leads cloud transformation and infrastructure modernization engagements across Europe and North America. In one recent client engagement, Gart reduced infrastructure waste by 38% through consolidating idle resources and introducing usage-aware automation. Read more on Startup Weekly.
In my experience optimizing cloud costs, especially on AWS, I often find that many quick wins are in the "easy to implement - good savings potential" quadrant.
[lwptoc]
That's why I've decided to share some straightforward methods for optimizing expenses on AWS that will help you save over 80% of your budget.
Choose reserved instances
Potential Savings: Up to 72%
Choosing reserved instances involves committing to a subscription, even partially, and offers a discount for long-term rentals of one to three years. While planning for a year is often deemed long-term for many companies, especially in Ukraine, reserving resources for 1-3 years carries risks but comes with the reward of a maximum discount of up to 72%.
You can check all the current pricing details on the official website - Amazon EC2 Reserved Instances
Purchase Saving Plans (Instead of On-Demand)
Potential Savings: Up to 72%
There are three types of saving plans: Compute Savings Plan, EC2 Instance Savings Plan, SageMaker Savings Plan.
AWS Compute Savings Plan is an Amazon Web Services option that allows users to receive discounts on computational resources in exchange for committing to using a specific volume of resources over a defined period (usually one or three years). This plan offers flexibility in utilizing various computing services, such as EC2, Fargate, and Lambda, at reduced prices.
AWS EC2 Instance Savings Plan is a program from Amazon Web Services that offers discounted rates exclusively for the use of EC2 instances. This plan is specifically tailored for the utilization of EC2 instances, providing discounts for a specific instance family, regardless of the region.
AWS SageMaker Savings Plan allows users to get discounts on SageMaker usage in exchange for committing to using a specific volume of computational resources over a defined period (usually one or three years).
The discount is available for one and three years with the option of full, partial upfront payment, or no upfront payment. EC2 can help save up to 72%, but it applies exclusively to EC2 instances.
Utilize Various Storage Classes for S3 (Including Intelligent Tier)
Potential Savings: 40% to 95%
AWS offers numerous options for storing data at different access levels. For instance, S3 Intelligent-Tiering automatically stores objects at three access levels: one tier optimized for frequent access, 40% cheaper tier optimized for infrequent access, and 68% cheaper tier optimized for rarely accessed data (e.g., archives).
S3 Intelligent-Tiering has the same price per 1 GB as S3 Standard — $0.023 USD.
However, the key advantage of Intelligent Tiering is its ability to automatically move objects that haven't been accessed for a specific period to lower access tiers.
Every 30, 90, and 180 days, Intelligent Tiering automatically shifts an object to the next access tier, potentially saving companies from 40% to 95%. This means that for certain objects (e.g., archives), it may be appropriate to pay only $0.0125 USD per 1 GB or $0.004 per 1 GB compared to the standard price of $0.023 USD.
Information regarding the pricing of Amazon S3
AWS Compute Optimizer
Potential Savings: quite significant
The AWS Compute Optimizer dashboard is a tool that lets users assess and prioritize optimization opportunities for their AWS resources.
The dashboard provides detailed information about potential cost savings and performance improvements, as the recommendations are based on an analysis of resource specifications and usage metrics.
The dashboard covers various types of resources, such as EC2 instances, Auto Scaling groups, Lambda functions, Amazon ECS services on Fargate, and Amazon EBS volumes.
For example, AWS Compute Optimizer reproduces information about underutilized or overutilized resources allocated for ECS Fargate services or Lambda functions. Regularly keeping an eye on this dashboard can help you make informed decisions to optimize costs and enhance performance.
Use Fargate in EKS for underutilized EC2 nodes
If your EKS nodes aren't fully used most of the time, it makes sense to consider using Fargate profiles. With AWS Fargate, you pay for a specific amount of memory/CPU resources needed for your POD, rather than paying for an entire EC2 virtual machine.
For example, let's say you have an application deployed in a Kubernetes cluster managed by Amazon EKS (Elastic Kubernetes Service). The application experiences variable traffic, with peak loads during specific hours of the day or week (like a marketplace or an online store), and you want to optimize infrastructure costs. To address this, you need to create a Fargate Profile that defines which PODs should run on Fargate. Configure Kubernetes Horizontal Pod Autoscaler (HPA) to automatically scale the number of POD replicas based on their resource usage (such as CPU or memory usage).
Manage Workload Across Different Regions
Potential Savings: significant in most cases
When handling workload across multiple regions, it's crucial to consider various aspects such as cost allocation tags, budgets, notifications, and data remediation.
Cost Allocation Tags: Classify and track expenses based on different labels like program, environment, team, or project.
AWS Budgets: Define spending thresholds and receive notifications when expenses exceed set limits. Create budgets specifically for your workload or allocate budgets to specific services or cost allocation tags.
Notifications: Set up alerts when expenses approach or surpass predefined thresholds. Timely notifications help take actions to optimize costs and prevent overspending.
Remediation: Implement mechanisms to rectify expenses based on your workload requirements. This may involve automated actions or manual interventions to address cost-related issues.
Regional Variances: Consider regional differences in pricing and data transfer costs when designing workload architectures.
Reserved Instances and Savings Plans: Utilize reserved instances or savings plans to achieve cost savings.
AWS Cost Explorer: Use this tool for visualizing and analyzing your expenses. Cost Explorer provides insights into your usage and spending trends, enabling you to identify areas of high costs and potential opportunities for cost savings.
Transition to Graviton (ARM)
Potential Savings: Up to 30%
Graviton utilizes Amazon's server-grade ARM processors developed in-house. The new processors and instances prove beneficial for various applications, including high-performance computing, batch processing, electronic design automation (EDA) automation, multimedia encoding, scientific modeling, distributed analytics, and machine learning inference on processor-based systems.
The processor family is based on ARM architecture, likely functioning as a system on a chip (SoC). This translates to lower power consumption costs while still offering satisfactory performance for the majority of clients. Key advantages of AWS Graviton include cost reduction, low latency, improved scalability, enhanced availability, and security.
Spot Instances Instead of On-Demand
Potential Savings: Up to 30%
Utilizing spot instances is essentially a resource exchange. When Amazon has surplus resources lying idle, you can set the maximum price you're willing to pay for them. The catch is that if there are no available resources, your requested capacity won't be granted.
However, there's a risk that if demand suddenly surges and the spot price exceeds your set maximum price, your spot instance will be terminated.
Spot instances operate like an auction, so the price is not fixed. We specify the maximum we're willing to pay, and AWS determines who gets the computational power. If we are willing to pay $0.1 per hour and the market price is $0.05, we will pay exactly $0.05.
Use Interface Endpoints or Gateway Endpoints to save on traffic costs (S3, SQS, DynamoDB, etc.)
Potential Savings: Depends on the workload
Interface Endpoints operate based on AWS PrivateLink, allowing access to AWS services through a private network connection without going through the internet. By using Interface Endpoints, you can save on data transfer costs associated with traffic.
Utilizing Interface Endpoints or Gateway Endpoints can indeed help save on traffic costs when accessing services like Amazon S3, Amazon SQS, and Amazon DynamoDB from your Amazon Virtual Private Cloud (VPC).
Key points:
Amazon S3: With an Interface Endpoint for S3, you can privately access S3 buckets without incurring data transfer costs between your VPC and S3.
Amazon SQS: Interface Endpoints for SQS enable secure interaction with SQS queues within your VPC, avoiding data transfer costs for communication with SQS.
Amazon DynamoDB: Using an Interface Endpoint for DynamoDB, you can access DynamoDB tables in your VPC without incurring data transfer costs.
Additionally, Interface Endpoints allow private access to AWS services using private IP addresses within your VPC, eliminating the need for internet gateway traffic. This helps eliminate data transfer costs for accessing services like S3, SQS, and DynamoDB from your VPC.
Optimize Image Sizes for Faster Loading
Potential Savings: Depends on the workload
Optimizing image sizes can help you save in various ways.
Reduce ECR Costs: By storing smaller instances, you can cut down expenses on Amazon Elastic Container Registry (ECR).
Minimize EBS Volumes on EKS Nodes: Keeping smaller volumes on Amazon Elastic Kubernetes Service (EKS) nodes helps in cost reduction.
Accelerate Container Launch Times: Faster container launch times ultimately lead to quicker task execution.
Optimization Methods:
Use the Right Image: Employ the most efficient image for your task; for instance, Alpine may be sufficient in certain scenarios.
Remove Unnecessary Data: Trim excess data and packages from the image.
Multi-Stage Image Builds: Utilize multi-stage image builds by employing multiple FROM instructions.
Use .dockerignore: Prevent the addition of unnecessary files by employing a .dockerignore file.
Reduce Instruction Count: Minimize the number of instructions, as each instruction adds extra weight to the hash. Group instructions using the && operator.
Layer Consolidation: Move frequently changing layers to the end of the Dockerfile.
These optimization methods can contribute to faster image loading, reduced storage costs, and improved overall performance in containerized environments.
Use Load Balancers to Save on IP Address Costs
Potential Savings: depends on the workload
Starting from February 2024, Amazon begins billing for each public IPv4 address. Employing a load balancer can help save on IP address costs by using a shared IP address, multiplexing traffic between ports, load balancing algorithms, and handling SSL/TLS.
By consolidating multiple services and instances under a single IP address, you can achieve cost savings while effectively managing incoming traffic.
Optimize Database Services for Higher Performance (MySQL, PostgreSQL, etc.)
Potential Savings: depends on the workload
AWS provides default settings for databases that are suitable for average workloads. If a significant portion of your monthly bill is related to AWS RDS, it's worth paying attention to parameter settings related to databases.
Some of the most effective settings may include:
Use Database-Optimized Instances: For example, instances in the R5 or X1 class are optimized for working with databases.
Choose Storage Type: General Purpose SSD (gp2) is typically cheaper than Provisioned IOPS SSD (io1/io2).
AWS RDS Auto Scaling: Automatically increase or decrease storage size based on demand.
If you can optimize the database workload, it may allow you to use smaller instance sizes without compromising performance.
Regularly Update Instances for Better Performance and Lower Costs
Potential Savings: Minor
As Amazon deploys new servers in their data processing centers to provide resources for running more instances for customers, these new servers come with the latest equipment, typically better than previous generations. Usually, the latest two to three generations are available. Make sure you update regularly to effectively utilize these resources.
Take Memory Optimize instances, for example, and compare the price change based on the relevance of one instance over another. Regular updates can ensure that you are using resources efficiently.
InstanceGenerationDescriptionOn-Demand Price (USD/hour)m6g.large6thInstances based on ARM processors offer improved performance and energy efficiency.$0.077m5.large5thGeneral-purpose instances with a balanced combination of CPU and memory, designed to support high-speed network access.$0.096m4.large4thA good balance between CPU, memory, and network resources.$0.1m3.large3rdOne of the previous generations, less efficient than m5 and m4.Not avilable
Use RDS Proxy to reduce the load on RDS
Potential for savings: Low
RDS Proxy is used to relieve the load on servers and RDS databases by reusing existing connections instead of creating new ones. Additionally, RDS Proxy improves failover during the switch of a standby read replica node to the master.
Imagine you have a web application that uses Amazon RDS to manage the database. This application experiences variable traffic intensity, and during peak periods, such as advertising campaigns or special events, it undergoes high database load due to a large number of simultaneous requests.
During peak loads, the RDS database may encounter performance and availability issues due to the high number of concurrent connections and queries. This can lead to delays in responses or even service unavailability.
RDS Proxy manages connection pools to the database, significantly reducing the number of direct connections to the database itself.
By efficiently managing connections, RDS Proxy provides higher availability and stability, especially during peak periods.
Using RDS Proxy reduces the load on RDS, and consequently, the costs are reduced too.
Define the storage policy in CloudWatch
Potential for savings: depends on the workload, could be significant.
The storage policy in Amazon CloudWatch determines how long data should be retained in CloudWatch Logs before it is automatically deleted.
Setting the right storage policy is crucial for efficient data management and cost optimization. While the "Never" option is available, it is generally not recommended for most use cases due to potential costs and data management issues.
Typically, best practice involves defining a specific retention period based on your organization's requirements, compliance policies, and needs.
Avoid using an undefined data retention period unless there is a specific reason. By doing this, you are already saving on costs.
Configure AWS Config to monitor only the events you need
Potential for savings: depends on the workload
AWS Config allows you to track and record changes to AWS resources, helping you maintain compliance, security, and governance. AWS Config provides compliance reports based on rules you define. You can access these reports on the AWS Config dashboard to see the status of tracked resources.
You can set up Amazon SNS notifications to receive alerts when AWS Config detects non-compliance with your defined rules. This can help you take immediate action to address the issue. By configuring AWS Config with specific rules and resources you need to monitor, you can efficiently manage your AWS environment, maintain compliance requirements, and avoid paying for rules you don't need.
Use lifecycle policies for S3 and ECR
Potential for savings: depends on the workload
S3 allows you to configure automatic deletion of individual objects or groups of objects based on specified conditions and schedules. You can set up lifecycle policies for objects in each specific bucket. By creating data migration policies using S3 Lifecycle, you can define the lifecycle of your object and reduce storage costs.
These object migration policies can be identified by storage periods. You can specify a policy for the entire S3 bucket or for specific prefixes. The cost of data migration during the lifecycle is determined by the cost of transfers. By configuring a lifecycle policy for ECR, you can avoid unnecessary expenses on storing Docker images that you no longer need.
Switch to using GP3 storage type for EBS
Potential for savings: 20%
By default, AWS creates gp2 EBS volumes, but it's almost always preferable to choose gp3 — the latest generation of EBS volumes, which provides more IOPS by default and is cheaper.
For example, in the US-east-1 region, the price for a gp2 volume is $0.10 per gigabyte-month of provisioned storage, while for gp3, it's $0.08/GB per month. If you have 5 TB of EBS volume on your account, you can save $100 per month by simply switching from gp2 to gp3.
Switch the format of public IP addresses from IPv4 to IPv6
Potential for savings: depending on the workload
Starting from February 1, 2024, AWS will begin charging for each public IPv4 address at a rate of $0.005 per IP address per hour. For example, taking 100 public IP addresses on EC2 x $0.005 per public IP address per month x 730 hours = $365.00 per month.
While this figure might not seem huge (without tying it to the company's capabilities), it can add up to significant network costs. Thus, the optimal time to transition to IPv6 was a couple of years ago or now.
Here are some resources about this recent update that will guide you on how to use IPv6 with widely-used services — AWS Public IPv4 Address Charge.
Collaborate with AWS professionals and partners for expertise and discounts
Potential for savings: ~5% of the contract amount through discounts.
AWS Partner Network (APN) Discounts: Companies that are members of the AWS Partner Network (APN) can access special discounts, which they can pass on to their clients. Partners reaching a certain level in the APN program often have access to better pricing offers.
Custom Pricing Agreements: Some AWS partners may have the opportunity to negotiate special pricing agreements with AWS, enabling them to offer unique discounts to their clients. This can be particularly relevant for companies involved in consulting or system integration.
Reseller Discounts: As resellers of AWS services, partners can purchase services at wholesale prices and sell them to clients with a markup, still offering a discount from standard AWS prices. They may also provide bundled offerings that include AWS services and their own additional services.
Credit Programs: AWS frequently offers credit programs or vouchers that partners can pass on to their clients. These could be promo codes or discounts for a specific period.
Seek assistance from AWS professionals and partners. Often, this is more cost-effective than purchasing and configuring everything independently. Given the intricacies of cloud space optimization, expertise in this matter can save you tens or hundreds of thousands of dollars.
More valuable tips for optimizing costs and improving efficiency in AWS environments:
Scheduled TurnOff/TurnOn for NonProd environments: If the Development team is in the same timezone, significant savings can be achieved by, for example, scaling the AutoScaling group of instances/clusters/RDS to zero during the night and weekends when services are not actively used.
Move static content to an S3 Bucket & CloudFront: To prevent service charges for static content, consider utilizing Amazon S3 for storing static files and CloudFront for content delivery.
Use API Gateway/Lambda/Lambda Edge where possible: In such setups, you only pay for the actual usage of the service. This is especially noticeable in NonProd environments where resources are often underutilized.
If your CI/CD agents are on EC2, migrate to CodeBuild: AWS CodeBuild can be a more cost-effective and scalable solution for your continuous integration and delivery needs.
CloudWatch covers the needs of 99% of projects for Monitoring and Logging: Avoid using third-party solutions if AWS CloudWatch meets your requirements. It provides comprehensive monitoring and logging capabilities for most projects.
Feel free to reach out to me or other specialists for an audit, a comprehensive optimization package, or just advice.
Kubernetes is becoming the standard for development, while the entry barrier remains quite high. We've compiled a list of recommendations for application developers who are migrating their apps to the orchestrator. Knowing the listed points will help you avoid potential problems and not create limitations where Kubernetes has advantages. Kubernetes Migration.
Who is this text for?
It's for developers who don't have DevOps expertise in their team – no full-time specialists. They want to move to Kubernetes because the future belongs to microservices, and Kubernetes is the best solution for container orchestration and accelerating development through code delivery automation to environments. At the same time, they may have locally run something in Docker but haven't developed anything for Kubernetes yet.
Such a team can outsource Kubernetes support – hire a contractor company, an individual specialist, or, for example, use the relevant services of an IT infrastructure provider. For instance, Gart Solutions offers DevOps as a Service – a service where the company's experienced DevOps specialists will take on any infrastructure project under full or partial supervision: they'll move your applications to Kubernetes, implement DevOps practices, and accelerate your time-to-market.
Regardless, there are nuances that developers should be aware of at the architecture planning and development stage – before the project falls into the hands of DevOps specialists (and they force you to modify the code to work in the cluster). We highlight these nuances in the text.
The text will be useful for those who are writing code from scratch and planning to run it in Kubernetes, as well as for those who already have a ready application that needs to be migrated to Kubernetes. In the latter case, you can go through the list and understand where you should check if your code meets the orchestrator's requirements.
The Basics
At the start, make sure you're familiar with the "golden" standard The Twelve-Factor App. This is a public guide describing the architectural principles of modern web applications. Most likely, you're already applying some of the points. Check how well your application adheres to these development standards.
The Twelve-Factor App
Codebase: One codebase, tracked in a version control system, serves all deployments.
Dependencies: Explicitly declare and isolate dependencies.
Configuration: Store configuration in the environment - don't embed in code.
Backing Services: Treat backing services as attached resources.
Build, Release, Run: Strictly separate the build, release, and run stages.
Processes: Run the application as one or more stateless processes.
Port Binding: Expose services through port binding.
Concurrency: Scale the application by adding processes.
Disposability: Maximize reliability with fast startup and graceful shutdown.
Dev/Prod Parity: Keep development, staging, and production environments as similar as possible.
Logs: Treat logs as event streams.
Admin Processes: Run administrative tasks as one-off processes.
Now let's move on to the highlighted recommendations and nuances.
Prefer Stateless Applications
Why?
Implementing fault tolerance for stateful applications will require significantly more effort and expertise.
Normal behavior for Kubernetes is to shut down and restart nodes. This happens during auto-healing when a node stops responding and is recreated, or during auto-scaling down (e.g., some nodes are no longer loaded, and the orchestrator excludes them to save resources).
Since nodes and pods in Kubernetes can be dynamically removed and recreated, the application should be ready for this. It should not write any data that needs to be preserved to the container it is running in.
What to do?
You need to organize the application so that data is written to databases, files to S3 storage, and, say, cache to Redis or Memcache. By having the application store data "on the side," we significantly facilitate cluster scaling under load when additional nodes need to be added, and replication.
In a stateful application where data is stored in an attached Volume (roughly speaking, in a folder next to the application), everything becomes more complicated. When scaling a stateful application, you'll have to order "volumes," ensure they're properly attached and created in the right zone. And what do you do with this "volume" when a replica needs to be removed?
Yes, some business applications should be run as stateful. However, in this case, they need to be made more manageable in Kubernetes. You need an Operator, specific agents inside performing the necessary actions... A prime example here is the postgres-operator. All of this is far more labor-intensive than simply throwing the code into a container, specifying five replicas, and watching it all work without additional dancing.
Ensure Availability of Endpoints for Application Health Checks
Why?
We've already noted that Kubernetes itself ensures the application is maintained in the desired state. This includes checking the application's operation, restarting faulty pods, disabling load, restarting on less loaded nodes, terminating pods exceeding the set resource consumption limits.
For the cluster to correctly monitor the application's state, you should ensure the availability of endpoints for health checks, the so-called liveness and readiness probes. These are important Kubernetes mechanisms that essentially poke the container with a stick – check the application's viability (whether it's working properly).
What to do?
The liveness probes mechanism helps determine when it's time to restart the container so the application doesn't get stuck and continues to work.
Readiness probes are not so radical: they allow Kubernetes to understand when the container is ready to accept traffic. In case of an unsuccessful check, the pod will simply be excluded from load balancing – no new requests will reach it, but no forced termination will occur.
You can use this capability to allow the application to "digest" the incoming stream of requests without pod failure. Once a few readiness checks pass successfully, the replica pod will return to load balancing and start receiving requests again. From the nginx-ingress side, this looks like excluding the replica's address from the upstream.
Such checks are a useful Kubernetes feature, but if liveness probes are configured incorrectly, they can harm the application's operation. For example, if you try to deploy an application update that fails the liveness/readiness checks, it will roll back in the pipeline or lead to performance degradation (in case of correct pod configuration). There are also known cases of cascading pod restarts, when Kubernetes "collapses" one pod after another due to liveness probe failures.
You can disable checks as a feature, and you should do so if you don't fully understand their specifics and implications. Otherwise, it's important to specify the necessary endpoints and inform DevOps about them.
If you have an HTTP endpoint that can be an exhaustive indicator, you can configure both liveness and readiness probes to work with it. By using the same endpoint, make sure your pod will be restarted if this endpoint cannot return a correct response.
Aim for More Predictable and Uniform Application Resource Consumption
Why?
Almost always, containers inside Kubernetes pods are resource-limited within certain (sometimes quite small) values. Scaling in the cluster happens horizontally by increasing the number of replicas, not the size of a single replica. In Kubernetes, we deal with memory limits and CPU limits. Mistakes in CPU limits can lead to throttling, exhausting the available CPU time allotted to the container. And if we promise more memory than is available, as the load increases and hits the ceiling, Kubernetes will start evicting the lowest priority pods from the node. Of course, limits are configurable. You can always find a value at which Kubernetes won't "kill" pods due to memory constraints, but nevertheless, more predictable resource consumption by the application is a best practice. The more uniform the application's consumption, the tighter you can schedule the load.
What to do
Evaluate your application: estimate approximately how many requests it processes, how much memory it occupies. How many pods need to be run for the load to be evenly distributed among them? A situation where one pod consistently consumes more than the others is unfavorable for the user. Such a pod will be constantly restarted by Kubernetes, jeopardizing the application's fault-tolerant operation. Expanding resource limits for potential peak loads is also not an option. In that case, resources will remain idle whenever there is no load, wasting money. In parallel with setting limits, it's important to monitor pod metrics. This could be kube-Prometheus-Stack, VictoriaMetrics, or at least Metrics Server (more suitable for very basic scaling; in its console, you can view stats from kubelet—how much pods are consuming). Monitoring will help identify problem areas in production and reconsider the resource distribution logic.
There is a rather specific nuance regarding CPU time that Kubernetes application developers should keep in mind to avoid deployment issues and having to rewrite code to meet SRE requirements. Let's say a container is allocated 500 milli-CPUs—roughly 0.5 CPU time of a single core over 100 ms of real time. Simplified, if the application utilizes CPU time in several continuous threads (let's say four) and "eats up" all 500 milli-CPUs in 25 ms, it will be frozen by the system for the remaining 75 ms until the next quota period. Staging databases run in Kubernetes with small limits exemplify this behavior: under load, queries that would normally take 5 ms plummet to 100 ms. If the response graphs show load continuously increasing and then latency spiking, you've likely encountered this nuance. Address resource management—give more resources to replicas or increase the number of replicas to reduce load on each one.
Get a sample of IT Audit
Sign up now
Get on email
Loading...
Thank you!
You have successfully joined our subscriber list.
Leverage Kubernetes ConfigMaps, Secrets, and Environment Variables
Kubernetes has several objects that can greatly simplify life for developers. Study them to save yourself time in the future.
ConfigMaps are Kubernetes objects used to store non-confidential data as key-value pairs. Pods can use them as environment variables or as configuration files in volumes. For example, you're developing an application that can run locally (for direct development) and, say, in the cloud. You create an environment variable for your app—e.g., DATABASE_HOST—which the app will use to connect to the database. You set this variable locally to localhost. But when running the app in the cloud, you need to specify a different value—say, the hostname of an external database.
Environment variables allow using the same Docker image for both local use and cloud deployment. No need to rebuild the image for each individual parameter. Since the parameter is dynamic and can change, you can specify it via an environment variable.
The same applies to application config files. These files store certain settings for the app to function correctly. Usually, when building a Docker image, you specify a default config or a config file to load into Docker. Different environments (dev, prod, test, etc.) require different settings that sometimes need to be changed, for testing, for example.
Instead of building separate Docker images for each environment and config, you can mount config files into Docker when starting the pod. The app will then pick up the specified configuration files, and you'll use one Docker image for the pods.
Typically, iftheconfig files are large,youuse a Volume to mount them into Docker as files. If the config files contain short values, environment variables are more convenient. It all depends on yourapplication's requirements.
Another useful Kubernetes abstraction is Secrets. Secrets are similar to ConfigMaps but are meant for storing confidential data—passwords, tokens, keys, etc. Using Secrets means you don't need to include secret data in your application code. They can be created independently of the pods that use them, reducing the risk of data exposure. Secrets can be used as files in volumes mounted in one or multiple pod containers. They can also serve as environment variables for containers.
Disclaimer: In this point, we're only describing out-of-the-box Kubernetes functionality. We're not covering more specialized solutions for working with secrets, such as Vault.
Knowing about these Kubernetes features, a developer won't need to rebuild the entire container if something changes in the prepared configuration, for example, a password change.
Ensure Graceful Container Shutdown with SIGTERM
Why?
There are situations where Kubernetes "kills" an application before it has a chance to release resources. This is not an ideal scenario. It's better if the application can respond to incoming requests without accepting new ones, complete a transaction, or save data to a database before shutting down.
What to Do
A successful practice here is for the application to handle the SIGTERM signal. When a container is being terminated, the PID 1 process first receives the SIGTERM signal, and then the application is given some time for graceful termination (the default is 30 seconds). Subsequently, if the container has not terminated itself, it receives SIGKILL—the forced termination signal. The application should not continue accepting connections after receiving SIGTERM.
Many frameworks (e.g., Django) can handle this out of the box. Your application may already handle SIGTERM appropriately. Ensure that this is the case.
Here are a few more important points:
The Application Should Not Depend on Which Pod a Request Goes To
When moving an application to Kubernetes, we expectedly encounter auto-scaling—you may have migrated for this very reason. Depending on the load, the orchestrator adds or removes application replicas. The application mustn't depend on which pod a client request goes to, for example, static pods. Either the state needs to be synchronized to provide an identical response from any pod, or your backend should be able to work across multiple replicas without corrupting data.
Your Application Should Be Behind a Reverse Proxy and Serve Links Over HTTPS
Kubernetes has the Ingress entity, which essentially provides a reverse proxy for the application, typically an nginx with cluster automation. For the application, it's enough to work over HTTP and understand that the external link will be over HTTPS. Remember that in Kubernetes, the application is behind a reverse proxy, not directly exposed to the internet, and links should be served over HTTPS. When the application returns an HTTP link, Ingress rewrites it to HTTPS, which can lead to looping and a redirect error. Usually, you can avoid such a conflict by simply toggling a parameter in the library you're using, checking that the application is behind a reverse proxy. But if you're writing an application from scratch, it's important to remember how Ingress works as a reverse proxy.
Leave SSL Certificate Management to Kubernetes
Developers don't need to think about how to "hook up" certificate addition in Kubernetes. Reinventing the wheel here is unnecessary and even harmful. For this, a separate service is typically used in the orchestrator — cert-manager, which can be additionally installed. The Ingress Controller in Kubernetes allows using SSL certificates for TLS traffic termination. You can use both Let's Encrypt and pre-issued certificates. If needed, you can create a special secret for storing issued SSL certificates.