🔬 BACOT — Sesi 15:00 Technical Exploration
📚 Topik: Optimasi Biaya Cloud — Egress, Idle Resource, Right-Sizing
Kategori: Cloud / FinOps · Level: Menengah
🎯 Tujuan Belajar
Bisa audit tagihan cloud sendiri: temukan 3 sumber pemborosan paling umum (egress tak terlihat, resource idle, instance oversized), hitung potensi saving, eksekusi perbaikan. Skill langsung pakai di AWS/GCP/Azure.
🏗️ Arsitektur & Alur Teknis — Kerangka FinOps
FinOps Foundation bagi jadi 3 fase iteratif (bukan waterfall):
| Fase | Fokus | Output |
|---|---|---|
| Inform | Visibility & allocation | Tag cost, cost per team/service, anomaly alert |
| Optimize | Rates & usage | Daftar peluang: right-size, commitment, hapus idle |
| Operate | Continuous improvement | Eksekusi + guardrail + budaya akuntabilitas |
Kunci: siklus cepat, mulai kecil. "Crawl → Walk → Run" (maturity model). Jangan tunggu data sempurna.
Alur deteksi pemborosan:
Cost & Usage Report (CUR) → Athena/QuickSight
→ segmentasi per service/tag
→ join dengan utilization metrics (CloudWatch/Datadog)
→ kandidat: idle | over-provisioned | egress-heavy
→ rekomendasi + estimasi saving
💵 Tiga Sumber Pemborosan Utama
1. Egress (data transfer keluar) — biaya tak terlihat
Pricing terverifikasi (per Nov 2026, sumber resmi/docs):
| Provider | Free tier internet egress | Rate awal |
|---|---|---|
| AWS | 100 GB/bulan (naik dari 1 GB, sejak Des 2021) | $0.09/GB (first 10 TB, us-east-1) |
| GCP | 5 GB/bulan | $0.12/GB (first 1 TiB) |
| Azure | 5 GB/bulan | $0.087/GB (first 5 GB) lalu $0.09/GB |
Yang sering kelewat: - Cross-AZ traffic: ~$0.01/GB per arah (AWS). GCP/Azure sering waive intra-region — AWS tidak. - NAT Gateway: $0.045/jam (~$32.85/bulan) plus $0.045/GB diproses → efektif ~$0.135/GB untuk trafik ke internet. Ini killer untuk workload chatty. - Cross-region: $0.01–$0.09/GB tergantung region. - GCP Premium Tier ke Indonesia: $0.19/GB (0–1 TiB) — 2x lebih mahal dari Asia umum.
Perubahan kebijakan (DIKETAHUI): - AWS, 6 Mar 2024: waive DTO saat migrasi keluar AWS (EU Data Act pressure). Update 30 Sep 2025: syarat ">100 GB/bulan" dihapus. Update 8 Okt 2026: eligible customer di luar EU punya 180 hari selesaikan migrasi. - GCP umumkan zero-egress Jan 2024. - Azure ikut Mar 2024. - ⚠️ Catatan penting: "free egress" ini hanya saat pindah keluar permanen, bukan untuk trafik operasional harian multi-cloud. HN commenter benar — ini bukan solusi lock-in.
Fix egress: - S3/object storage → VPC Gateway Endpoint (gratis, hapus NAT cost untuk trafik S3). - Interface Endpoint (PrivateLink) untuk service lain. - CDN di depan (CloudFront 1 TB/bulan gratis; R2 zero egress). - Compress payload, batch API response.
2. Idle resource
- EC2 instance stopped tapi EBS tetap bill. Snapshot lama numpuk.
- Load balancer tanpa target, NAT Gateway tanpa trafik, RDS multi-AZ untuk dev.
- Elastic IP tak terpakai → ~$3.6/bulan each.
- Fix: tagging + scheduled shutdown (dev/staging), lifecycle policy snapshot.
3. Right-sizing (over-provisioned)
AWS Compute Optimizer definisi over-provisioned: minimal satu spesifikasi (CPU/mem/network) bisa diturunkan sambil tetap meet requirement, dan tidak ada yang under-provisioned.
Pitfall: Compute Optimizer default cuma lihat CPU (CloudWatch) — tidak lihat memory kecuali install CloudWatch Agent. Instance yang CPU-nya rendah tapi memory-bound akan salah direkomendasikan turun → outage.
Fix: enable memory metrics (CloudWatch Agent / Datadog), prioritaskan rekomendasi "high savings + low performance risk".
💻 Kode Nyata
A. Migrasi gp2 → gp3 (saving ~20%, sumber AWS Storage Blog):
# Cek volume gp2
aws ec2 describe-volumes \
--filters "Name=volume-type,Values=gp2" \
--query "Volumes[*].[VolumeId,Size,Iops]" --output table
# Migrasi in-place (Elastic Volumes, tanpa downtime)
aws ec2 modify-volume \
--volume-id vol-0123456789abcdef0 \
--volume-type gp3 \
--iops 3000 \
--throughput 125
gp3 baseline: 3000 IOPS + 125 MiB/s independen dari ukuran. gp2 scaling IOPS dengan ukuran → bayar storage cuma buat dapet IOPS. Saving confirmed 20% di us-east-1.
B. Temukan NAT Gateway boros (Athena di atas CUR):
SELECT line_item_resource_id,
SUM(line_item_usage_amount) AS gb_processed,
SUM(line_item_unblended_cost) AS cost
FROM cur_db.cur_table
WHERE line_item_product_code = 'AmazonEC2'
AND line_item_usage_type LIKE '%NatGateway-Bytes%'
AND line_item_usage_start_date >= date_trunc('month', current_date - interval '1' month)
GROUP BY 1
ORDER BY cost DESC
LIMIT 20;
C. Cari EBS idle (volume unattached):
aws ec2 describe-volumes \
--filters "Name=status,Values=available" \
--query "Volumes[*].[VolumeId,Size,VolumeType,CreateTime]" --output table
D. Terraform — guardrail tag wajib (cegah resource tanpa owner):
# ponytail: enforcement minimal, cukup buat audit. Naik ke SCP/AWS Config kalau butuh hard-block.
variable "required_tags" {
default = ["Owner", "Environment", "CostCenter"]
}
resource "aws_ebs_volume" "data" {
availability_zone = "us-east-1a"
size = 100
type = "gp3"
tags = {
Owner = "hilmi"
Environment = "prod"
CostCenter = "eng-001"
}
}
📊 Angka & Benchmark (sumber terverifikasi)
| Item | Angka | Sumber |
|---|---|---|
| gp2→gp3 saving | ~20% | AWS Storage Blog |
| NAT Gateway | $0.045/hr + $0.045/GB | AWS VPC Pricing |
| Cross-AZ | ~$0.01/GB/arah | AWS docs |
| AWS free egress | 100 GB/bln | AWS News Blog |
| GCP egress → Indonesia | $0.19/GB (0–1 TiB) | GCP VPC pricing-announce |
Contoh impact nyata (Medium, "reduced AWS Data Transfer by 80%"): satu deployment CrashLoopBackOff di Istio mesh bikin cross-AZ traffic meledak → fix = potong 95% cross-AZ, total cost turun 23%. Pelajaran: bug di service mesh bisa jadi biaya jaringan besar.
⚠️ BELUM PASTI: angka "30–45% enterprise spend = egress" dari blog vendor — tidak ada metodologi publik. Anggap indikatif, bukan benchmark.
⚖️ Trade-off & Alternatif
| Strategi | Kelebihan | Biaya/risiko |
|---|---|---|
| VPC Endpoint | Hapus NAT cost untuk S3/DynamoDB | Interface endpoint punya hourly cost |
| CDN (CloudFront) | 1 TB/bln gratis, latency turun | Cache invalidation complexity |
| R2 / Backblaze B2 | Zero egress | Migrasi + latency region |
| Savings Plans / RI | 30–70% diskon compute | Komit 1–3 tahun, risiko over-commit |
| Spot | s/d 90% diskon | Bisa di-reclaim, butuh fault-tolerant |
| Right-size | Saving langsung, no commit | Risiko under-provision kalau data util salah |
Prinsip: commitment (SP/RI) = lever saving terbesar untuk compute, tapi right-size dulu sebelum commit — kalau commit instance oversized, lo kunci pemborosan 1–3 tahun.
🏭 Use Case Produksi & Failure Mode
Failure mode umum: 1. Right-size tanpa memory metric → OOM di prod setelah turun instance. 2. NAT Gateway untuk S3 trafik → bayar 3x (NAT hour + NAT GB + egress). 3. Cross-AZ chatty service → service mesh / DB replication lintas AZ tanpa sadar. 4. Snapshot & AMI orphan → storage cost naik diam-diam bertahun. 5. Commit dulu, optimize belakangan → RI/SP mengunci instance oversized. 6. Dev environment 24/7 → non-prod bisa 30–40% total bill.
Praktik sehat: cost allocation tag di CI/CD (resource tanpa tag = gagal deploy), anomaly detection alert, review bulanan per service, budget alarm.
🛠️ Latihan Praktis (laptop sendiri)
- Simulasi egress: hitung biaya skenario. 5 TB/bulan keluar internet dari AWS us-east-1 →
(5000 - 100) GB × $0.09= $441/bulan. Sekarang tambah CDN CloudFront (1 TB gratis + rate lebih murah) → hitung ulang. - NAT vs Endpoint: app baca 2 TB/bulan dari S3 via NAT →
2000 × $0.045 = $90/bulan(belum termasuk egress). Ganti VPC Gateway Endpoint → $0. Verifikasi konsep ini di AWS pricing calculator (gratis, no account). - Audit lokal: kalau punya 1 VM, cek disk
df -h, cari file tak terpakai, hitung berapa GB yang bisa diarsipkan → analogi mental untuk EBS idle.
✅ Cek Pemahaman
- Kenapa "free egress" AWS 2024 bukan solusi untuk arsitektur multi-cloud operasional?
- Instance CPU 8% tapi memory 92% — Compute Optimizer default bilang apa, dan kenapa rekomendasinya berbahaya?
- Lo punya app yang baca S3 5 TB/bulan via NAT Gateway. Hitung total biaya bulanan dan 2 cara menghapusnya.
🔑 Poin Kunci
- Egress = biaya tersembunyi #1. Cross-AZ + NAT Gateway sering lebih mahal dari yang disangka.
- Right-size SEBELUM commit (RI/SP). Urutan salah = kunci pemborosan.
- Compute Optimizer butuh memory metric — tanpa itu, rekomendasi bisa bikin outage.
- Tag = fondasi FinOps. Tanpa allocation, tidak ada visibility.
- gp3 > gp2 hampir selalu (20% lebih murah, IOPS decoupled).
- Free egress migration ≠ bebas lock-in. Baca fine print.
- Bug arsitektur = biaya jaringan. CrashLoop, retry storm, chatty mesh — semua muncul di tagihan.
➡️ Eksplorasi Lanjut
- FOCUS spec (FinOps Open Cost & Usage Specification) — format data biaya cross-cloud standar.
- Kubecost / OpenCost — cost visibility untuk Kubernetes (per-pod, per-namespace).
- AWS Cost Anomaly Detection — ML alert otomatis.
- Cloudflare R2 / Backblaze B2 — arsitektur zero-egress.
- Graviton (ARM) — 20% lebih murah dari x86 untuk workload kompatibel.
- Sesi berikutnya: Kubernetes scheduling & optimasi bin-packing (kaitan langsung ke cost per-pod).
Sumber: FinOps Foundation Framework (finops.org, 2025) · AWS News Blog "Free DTO" (Mar 2024, upd Okt 2026) · AWS VPC Pricing · AWS Storage Blog gp2→gp3 · GCP VPC pricing-announce · nOps AWS Egress 2026 · CloudOptimo egress benchmark.