In this guide, we will dive deep into AWS EKS pricing (Networking, Compute, Storage, etc.) and cost optimization best practices with real-life examples.

eks pricing banner, AWS eks cost optimization best practices

Amazon Elastic Kubernetes Service (Amazon EKS) is a managed Kubernetes service offered by Amazon Web Services (AWS) that simplifies the deployment, management, and scaling of containerized applications using Kubernetes. 

EKS pricing can be complex, with several components to consider. 

In this report, we will break down the key elements of Amazon EKS pricing, provide examples, and offer guidance on optimizing costs.

Overview of Amazon EKS

Before I dive into pricing details, let's briefly review the core components of Amazon EKS:

1. Control Plane: Amazon EKS manages the control plane for Kubernetes, which includes the API server, etcd, and other critical components. AWS handles the operational overhead, ensuring availability and scalability.

2. Worker Nodes: These are the compute instances in your EKS cluster responsible for running your containerized applications. You can choose from a variety of instance types and configurations to meet your specific needs.

3. Networking: EKS leverages Amazon VPC (Virtual Private Cloud) for networking. This allows you to control the network configuration and security settings for your Kubernetes clusters.

Now, let's delve into the pricing aspects of each of these components.

Also Read: Single Tenant vs Multi-tenant Cloud Architecture

Amazon EKS Pricing Components

1. Control Plane Pricing

Amazon EKS control plane pricing is straightforward:

  • $0.10 per hour: You pay a flat fee for each hour your EKS cluster's control plane is running. This cost is incurred as long as your cluster exists, regardless of whether worker nodes are connected or not.

We pay $0.10 per hour for each Amazon EKS cluster, 1 Day: $2.4, 30 days: $72. 

Also Read: Top Cloud Cost Optimization Best Practices

2. Worker Node Pricing

Worker node pricing is the most variable part of EKS costs since it depends on several factors:

  • EC2 Instance Costs: The primary cost of worker nodes comes from the EC2 instances you use. AWS offers a wide range of instance types with varying costs. You are billed for the compute capacity and storage associated with these instances. 

The hourly rates can range from a few cents to several dollars per hour, depending on the instance type.

  • On-Demand or Spot Instances: You have the flexibility to choose between On-Demand and Spot Instances for your worker nodes. Spot Instances can significantly reduce costs but come with the trade-off of potential termination when AWS needs the capacity back.

  • Autoscaling: If you configure autoscaling for your worker nodes, costs will vary based on the number of nodes added or removed in response to changes in workload demand.

Let's look at an example.

Suppose you have an EKS cluster running with three m5.large On-Demand instances for one month:

  • Monthly EC2 cost per instance: $0.096 x 24 hours x 30 days = $69.44 per instance

  • Total cost for three instances: $69.44 x 3 = $208.32

AWS resources (e.g. EC2 instances or EBS volumes) 

  • T3 Medium Server in N.Virginia - $0.0416 per Hour 

  • Per Day: $0.96 - Approximately $1 

  • Per Month: $30 per 1 t3.medium server 

Refer to the AWS pricing page for better context.

In short, if you run 1 EKS Cluster and 1 t3.medium worker node continuously for 1 month, your bill is going to be around $102 to $110.

Also Read: Top Kubernetes Cost Optimization Best Practices

3. Networking Pricing

Networking costs associated with EKS depend on various factors, including data transfer and load balancer usage:

  • Data Transfer: EKS uses the Amazon VPC for networking, and data transfer costs may apply if traffic flows outside the VPC (e.g., to the internet or other AWS regions).

Let's look at an example.

Suppose you have an EKS cluster with an ALB running 24 hours a day and serving 10 TB of data transfer in a month:

  • ALB cost per hour: $0.0225 (for the smallest size)

  • Data transfer cost: $0.09 per GB (assuming 10 TB)

  • Total ALB cost: $0.0225 x 24 hours x 30 days = $16.20

  • Total data transfer cost: $0.09 x 10,000 GB = $900.00

  • Total networking cost: $16.20 + $900.00 = $916.20

Pricing details for Amazon EKS in different deployment scenarios:

1. Pricing for Amazon EKS with Amazon EC2

When you run Amazon EKS with Amazon EC2 instances as worker nodes, you have control over the compute capacity and instance types. 

The primary cost components are:

  • EC2 Instance Costs: You are charged for the compute capacity and storage of EC2 instances used as worker nodes. The hourly rates vary based on the instance type and region.

  • Data Transfer Costs: Data transfer costs may apply if traffic between your EKS cluster and other AWS services or the internet goes beyond your Virtual Private Cloud (VPC). This includes data ingress and egress.

  • Load Balancer Costs: If you use Elastic Load Balancers (ELB) or Application Load Balancers (ALB) in conjunction with EKS, you'll incur costs based on the type of load balancer and its usage.

  • Storage Costs: If your EKS workloads use AWS services like Amazon EBS for persistent storage, those services have separate pricing based on the storage volumes and type.

Let's dive deeper into this with an example.

Suppose you run an EKS cluster with three t2.micro EC2 instances in the US East (N. Virginia) region for a month:

  • Monthly EC2 cost per instance: $0.0116 x 24 hours x 30 days = $8.35 per instance

  • Total cost for three instances: $8.35 x 3 = $25.05

Also Read: ECS vs AWS EKS

2. Pricing for Amazon EKS with AWS Fargate

AWS Fargate offers a serverless container management service. When using Amazon EKS with AWS Fargate, you don't manage underlying EC2 instances, which simplifies cost calculations:

  • Fargate Pricing: AWS Fargate charges you per vCPU and per GB of memory allocated to your containers. You pay for the exact amount of resources your containers use, with a minimum charge per pod.

  • Control Plane Pricing: Similar to EC2-based EKS, you still incur the control plane cost at a fixed hourly rate.

  • Networking Costs: Networking and data transfer costs may apply as needed.

Let's quickly look at an example. 

Suppose you run an EKS cluster with three pods, each requiring 0.5 vCPU and 1 GB of memory for a month:

  • Fargate cost per vCPU: $0.04048 per vCPU-hour

  • Fargate cost per GB of memory: $0.004445 per GB-hour

  • Total Fargate cost for three pods: (0.5 vCPU x $0.04048 + 1 GB x $0.004445) x 24 hours x 30 days x 3 pods = $97.24

3. Pricing for Amazon EKS with AWS Outposts

AWS Outposts extends AWS infrastructure to your on-premises data center. 

When using Amazon EKS with AWS Outposts, you typically incur:

  • Outposts Hardware Costs: You are charged for the AWS Outposts hardware infrastructure, which includes the compute and storage resources deployed in your data center.

  • Data Transfer Costs: Similar to EC2-based EKS, data transfer costs may apply if data flows between your Outpost and other AWS services or regions.

  • Control Plane Pricing: You still pay the control plane cost at the standard EKS rate.

Here is a sample scenario for this. 

Suppose you have an AWS Outpost in your data center and run an EKS cluster on it with three t2.micro EC2 instances for a month:

  • Monthly Outposts hardware cost: Depends on the specific configuration and location, typically starting at several thousand dollars per month.

  • Monthly EC2 cost per instance: $0.0116 x 24 hours x 30 days = $8.35 per instance

  • Total cost for three instances: $8.35 x 3 = $25.05

AWS Outposts costs can vary significantly based on your individual requirements and configuration choices for the on-premises hardware. 

Additionally, data transfer costs would apply based on your data traffic patterns.

humalect developer platform. AWS eks pricing

9 Best Practices to Cut AWS EKS Costs

The financial calculations done here are purely hypothetical and do not represent actual Amazon EKS costs. 

1. Terminate Unnecessary Pods

One of the most effective ways to reduce AWS EKS costs is to identify and terminate pods that are no longer needed. 

Kubernetes offers tools like the Kubernetes Dashboard and kubectl command-line tool, which can help you pinpoint pods that are not serving any useful purpose. 

By removing these idle pods, you can free up resources that would otherwise be wasted.

kubectl get pods -n <namespace>

You can then review the list of pods, identify the ones that are not needed, and delete them using:

kubectl delete pod <pod-name> -n <namespace>

Suppose you have 10 idle pods running on your EKS cluster, each consuming 0.5 vCPU and 1 GB of memory. 

By terminating these pods, you can potentially save $50 per month.

2. Utilize Auto-Scaling

AWS EKS provides seamless integration with Amazon EC2 auto scaling groups, allowing you to dynamically adjust the number of worker nodes based on resource demand. 

To set up auto-scaling for your AWS EKS worker nodes, follow these steps:

  • Create an Auto Scaling Group (ASG) with appropriate configurations, such as instance type and minimum/maximum instance count. You can use the AWS Management Console, AWS CLI, or AWS CloudFormation to create an ASG.

  • Enable Cluster Autoscaler by adding the following annotation to your EKS node group. (YAML)

  k8s.io/cluster-autoscaler/enabled: "true"
  • Configure auto-scaling policies based on metrics like CPU or memory utilization for your ASG.

Without auto-scaling, you may need to maintain a fixed cluster size of 10 nodes to meet peak demand, costing you $1000 per month. With auto-scaling, you can reduce this to an average of 6 nodes, saving $400 per month.

3. Fine-Tune Resource Requests

In Kubernetes, you can specify resource requests and limits for each container within a pod. 

Accurate resource requests ensure that containers have the minimum resources required to operate effectively. 

To set resource requests and limits for containers in a pod, you can define them in the pod's YAML configuration. 

For example:

resources:
  requests:
    cpu: "0.5"   # Request 0.5 CPU cores
    memory: "1Gi"  # Request 1 GB of memory
  limits:
    cpu: "1"      # Limit to 1 CPU core
    memory: "2Gi" # Limit to 2 GB of memory

By adjusting resource requests, you can reduce the CPU and memory allocation for each container by 20%. 

If your monthly cluster cost was $800, this optimization could save you $160 per month.

Also Read: AWS Cost Optimization Best Practices

4. Leverage Spot Instances

Amazon offers Spot Instances at significantly lower prices than on-demand instances. You can make use of this cost-saving opportunity by deploying non-critical workloads on Spot Instances within your EKS clusters. 

Using node selectors, tolerations and taints in Kubernetes, you can schedule pods on Spot Instances, while AWS Spot Fleet can help manage these instances efficiently.

To use Spot Instances for your Kubernetes workloads:

  • Configure node groups with Spot Instances in your EKS cluster using eksctl or AWS Console.

  • Use Kubernetes tolerations and node selectors in your pod YAML configurations to specify that certain pods can run on Spot Instances. 

For example:

   tolerations:
   - key: "spotInstance"
     operator: "Equal"
     value: "true"
     effect: "NoSchedule"

Optionally, consider using AWS Spot Fleet to manage Spot Instances within your cluster efficiently.

Suppose you have 5 non-critical pods running on Spot Instances, saving you 50% compared to on-demand instances. 

If the original monthly cost was $300, utilizing Spot Instances would reduce it to $150 per month.

5. Implement AWS Cost Allocation Tags

Cost allocation tags are valuable tools for tracking and managing AWS resources, including EKS clusters and worker nodes. 

To implement cost allocation tags for EKS clusters and worker nodes:

  • In the AWS Management Console, navigate to the resource you want to tag, such as an EKS cluster or EC2 instances.

  • Add tags with key-value pairs that provide meaningful metadata. For example, you can tag an EKS cluster with "Environment" as the key and "Production" as the value.

  • Use AWS Cost Explorer or AWS Billing and Cost Management to analyze your costs based on these tags.

By accurately tagging resources and monitoring their costs, you can identify areas of overspending and reduce unnecessary expenses by an average of 10%. 

If your initial monthly AWS bill was $2000, effective tagging could save you $200 per month.

Also Read: AWS Karpenter vs Cluster Autoscaler

6. Use Cluster Autoscaler

Cluster Autoscaler is a Kubernetes feature that automatically adjusts the size of your EKS cluster based on the number of pending pods. 

To enable Cluster Autoscaler for your AWS EKS cluster:

  • Edit the EKS node group configuration to add the Cluster Autoscaler setting:

aws eks update-nodegroup-config --cluster-name <cluster-name> --nodegroup-name <nodegroup-name> --scaling-config minSize=2,maxSize=10,desiredSize=2

  • Make sure to adjust `minSize`, `maxSize`, and `desiredSize` according to your requirements.

Without Cluster Autoscaler, you maintain a static cluster size of 20 nodes, costing you $2000 per month. 

With Cluster Autoscaler, you can reduce this to an average of 12 nodes, saving $800 per month.

7. Implement Horizontal Pod Autoscaling

Kubernetes provides Horizontal Pod Autoscaling (HPA), which allows you to automatically adjust the number of pod replicas based on resource utilization metrics like CPU and memory. 

To set up Horizontal Pod Autoscaling (HPA) for a deployment or replica set in Kubernetes:

  • Create an HPA resource by defining the scaling metrics and target utilization in a YAML configuration file:

   apiVersion: autoscaling/v2beta2
   kind: HorizontalPodAutoscaler
   metadata:
     name: <hpa-name>
   spec:
     scaleTargetRef:
       apiVersion: apps/v1
       kind: Deployment  # or ReplicaSet
       name: <deployment-name>  # or <replicaset-name>
     minReplicas: <min-replicas>
     maxReplicas: <max-replicas>
     metrics:
     - type: Resource
       resource:
         name: cpu
         targetAverageUtilization: <target-cpu-utilization>

Without HPA, you maintain five replicas of a pod at all times, regardless of demand, costing you $500 per month. 

With HPA, you can reduce this to an average of three replicas, saving $200 per month.

8. Optimize Storage Costs

EKS clusters often require storage for various purposes, such as persistent volumes and container images. 

To optimize storage costs, consider implementing lifecycle policies for Amazon Elastic Block Store (EBS) volumes and optimizing Docker image sizes. 

To optimize storage costs in AWS EKS, you can consider the following:

  • For Amazon Elastic Block Store (EBS) volumes, set up a lifecycle policy to manage snapshots efficiently. This can be done through the AWS Management Console or AWS CLI.

  • To minimize Docker image sizes, follow best practices for building lean images and regularly clean up unused images and containers.

By optimizing storage and reducing the volume of EBS snapshots and Docker images, you can save 20% on your monthly storage costs. 

If your monthly storage cost was $400, you could save $80 per month.

Also Read: AWS EBS vs EFS vs S3

9. Utilize Reserved Instances (RIs)

If you have a predictable workload with a long-term commitment, you can purchase AWS Reserved Instances (RIs). 

RIs offer substantial discounts compared to on-demand instances.

By reserving EKS cluster instances, you can lock in lower prices and reduce your overall compute costs.

To utilize Reserved Instances for AWS EKS:

  • Determine your instance requirements, such as instance type, region, and term (1-year or 3-year).

  • Purchase Reserved Instances through the AWS Management Console, AWS CLI, or AWS SDKs.

  • Apply the RIs to your EKS node groups, ensuring that the instance attributes match those of the reserved instances (e.g., instance type and availability zone).

Suppose you have a predictable workload that requires eight instances running 24/7. 

Without RIs, this would cost you $2000 per month. By using RIs, you could potentially reduce this cost by 30%, resulting in monthly savings of $600.

You could use the AWS Pricing Calculator to estimate the pricing of a particular resource before using it.

humalect developer platform cta, AWS EKS, EKS pricing

Summary of AWS EKS Pricing

So, understanding Amazon EKS pricing is essential for effectively managing your Kubernetes workloads on AWS. 

Considering the costs of the control plane, worker nodes, and networking, and by implementing cost optimization strategies, you can potentially control your EKS expenses while ensuring the reliability and scalability of your containerized applications. 

Regularly reviewing and adjusting your EKS resources based on actual usage will help you strike the right balance between cost and performance.