
Optimizing costs on your Amazon EKS
Amazon EKS (Elastic Kubernetes Service) cluster is crucial, as costs can quickly add up if resources are not managed efficiently
Published Feb 19, 2025
- "Recently, I discovered that our production environment contains the following resources, which are inactive and not in use but still generating costs. Since this is a production environment, it may be difficult to notice these unused resources:-
Unattached EBS volumes
Old Load Balancers (ELBs)
Idle EBS snapshots
Unused Persistent Volumes (PVs) and Persistent Volume Claims (PVCs)
Orphaned IPs (Elastic IPs still allocated but not in use)"
so i will dive deep one by one on how to identify this resources and to check if they are in use or not before getting rid of it incase if they are not in use.
Using AWS Console:
- Go to EC2 Dashboard → Volumes.
- Look for volumes with State = Available (this means they are not attached to any EC2 instance).
- Check Tags to verify they are not needed (some might be used for future reattachment).
This is an example of volume not in use so you can check properly , so in my own case i clicked on the volume with available and since i don't need it for future re attachement i delete it

You can also use command line to check
aws ec2 describe-volumes --filters Name=status,Values=available --query "Volumes[*].{ID:VolumeId,Size:Size,AZ:AvailabilityZone,Created:CreateTime}" --output table
How to Delete Unattached EBS Volumes
aws ec2 delete-volume --volume-id <VOLUME_ID>
Replace
<VOLUME_ID>
with the actual volume ID.Load Balancers (Classic, ALB, NLB) left unused continue to incur hourly charges.
- Using AWS Console:
- Go to EC2 Dashboard → Load Balancers.
- Look for ELBs with zero active instances (no instances registered).
- Check last activity (if it's old, it might be unused).
- Using AWS CLI:shCopiaModifica
aws elbv2 describe-load-balancers --query "LoadBalancers[*].{Name:LoadBalancerName,State:State.Code,ARN:LoadBalancerArn}"
--output table- If the State is "active" but unused, consider deleting.
- For Classic Load Balancer:
aws elb delete-load-balancer --load-balancer-name <ELB_NAME>
- For ALB/NLB:-
aws elbv2 delete-load-balancer --load-balancer-arn <ELB_ARN>
EBS snapshots stored in S3 can accumulate storage costs if not needed.
- Using AWS Console:
- Go to EC2 Dashboard → Snapshots.
- Identify old snapshots that are not linked to active EBS volumes.
- Using AWS CLI:
aws ec2 describe-snapshots --owner-id self --query "Snapshots[*].{ID:SnapshotId,StartTime:StartTime,Size:VolumeSize}"
--output table
aws ec2 delete-snapshot --snapshot-id <SNAPSHOT_ID>
If you need to retain the snapshot but want to reduce costs, move it to Amazon S3 Glacier for cheaper long-term storage.
EKS automatically provisions Persistent Volumes (PVs) and Persistent Volume Claims (PVCs), but unused ones still take up EBS storage.
- List all PVs in your EKS cluster:
kubectl get pv
Look for PVs with "Released" or "Available" status (these are not in use). - List all PVC
kubectl get pvc --all-namespaces
If a PVC is not attached to a running pod, it may be unused.
- Delete PVC (this will also delete the linked PV if using dynamic provisioning):
- kubectl delete pvc <PVC_NAME> -n <NAMESPACE>
- Manually delete PV if still lingering:
kubectl delete pv <PV_NAME>
Elastic IPs (EIPs) incur charges if they are allocated but not attached to an active EC2 instance.
- Using AWS Console:
- Go to EC2 Dashboard → Elastic IPs.
- Look for Elastic IPs that are not associated with any instance.
- Using AWS CLI:
aws ec2 describe-addresses --query "Addresses[?AssociationId==null].{PublicIP:PublicIp,AllocationId:AllocationId}"
--output table
aws ec2 release-address --allocation-id <ALLOCATION_ID>
If an IP is needed for future use, consider stopping charges by attaching it to a low-cost EC2 instance instead of keeping it idle.
Use AWS Trusted Advisor – Detects unused resources automatically.
Enable AWS Budgets & Cost Anomaly Detection – Alerts for unexpected cost spikes.
Use Kubecost – Monitors EKS costs per namespace/workload.
Enable AWS Budgets & Cost Anomaly Detection – Alerts for unexpected cost spikes.
Use Kubecost – Monitors EKS costs per namespace/workload.