Cost Management
AWS คิดค่าใช้จ่ายแบบ Pay-as-you-go จึงเหมาะกับการทดลอง แต่ต้องมี guardrail ตั้งแต่เริ่ม: AWS Budgets, Billing Alert, Cost Explorer และ Tagging convention คือเครื่องมือพื้นฐานที่ควรทำก่อนสร้าง Resource จำนวนมาก
Pay-as-you-go และ Free Tier
Pay-as-you-go หมายถึงจ่ายตามการใช้งานจริง เช่น ชั่วโมงของ EC2, ขนาด Storage, จำนวน Request หรือ Data transfer Free Tier ช่วยลดค่าใช้จ่ายช่วงเริ่มต้น แต่ไม่ได้ครอบคลุมทุก Service, ทุก Region หรือทุกขนาด Resource
AWS Budgets
AWS Budgets ใช้ติดตาม Cost และ Usage พร้อมตั้ง Notification เมื่อค่าใช้จ่ายจริงหรือค่าใช้จ่ายคาดการณ์เข้าใกล้ Threshold เช่นแจ้งเตือนเมื่อใช้ถึง 50%, 80% และ 100% ของ Budget รายเดือน
Budget ไม่ใช่ระบบปิด Resource อัตโนมัติในทุกกรณี และข้อมูล Billing อาจมี delay ดังนั้นควรใช้คู่กับนิสัยลบ Resource หลัง Lab และตรวจ Cost Explorer เป็นประจำ
Cost Explorer
Cost Explorer ใช้ดูแนวโน้มค่าใช้จ่าย แยกตาม Service, Region, Linked Account หรือ Tag ช่วยตอบคำถามว่า ค่าใช้จ่ายมาจากอะไรและเพิ่มขึ้นตั้งแต่เมื่อไร
Tagging convention
Tag ช่วยแยก Owner, Environment, Project และ Cost allocation ตัวอย่าง convention สำหรับ Lab:
Environment = learning
Owner = your-name
Project = aws-infra-learning
ManagedBy = manual-lab
Best practices
- ตั้ง Budget ก่อนเริ่มสร้าง Resource
- เปิด Notification ทั้ง actual และ forecasted spend
- ใช้ Tag กับ Resource ทุกตัวที่รองรับ
- กำหนด cleanup checklist ในทุก Lab
- ตรวจ Cost Explorer หลัง Lab ที่สร้าง Resource ราคาแพง
Review questions
- เข้าใจว่า Budget alert มี billing delay และไม่ใช่ auto-shutdown ทุกกรณี
- รู้ service ที่มักทำให้ lab มีค่าใช้จ่าย เช่น NAT Gateway, ALB, RDS และ logs
- มี tagging convention ที่จะใช้ซ้ำใน lab ถัดไป
- ทำไม Budget Alert อาจแจ้งเตือนช้ากว่าค่าใช้จ่ายจริง?
- Tag ใดบ้างที่ควรมีใน Account สำหรับเรียน?
- Service ใดใน Lab ที่ควรระวังค่าใช้จ่ายเป็นพิเศษ?