Bài này gộp 4 chủ đề: AWS Trusted Advisor, Cost Explorer và AWS Budgets, Reserved Instances và Savings Plans Deep Dive, Spot Instance Strategies.
Mục tiêu học tập
- Hiểu Trusted Advisor: best practice recommendations
- Phân biệt 5 categories checks
- Nắm Support Plan tiers ảnh hưởng đến checks
- Áp dụng cho cost + security optimization
- Phân tích chi phí với Cost Explorer
- Setup AWS Budgets với alerts
- Sử dụng Cost Anomaly Detection
- Apply Cost Allocation Tags
- So sánh RI và Savings Plans
- Hiểu Compute SP vs EC2 Instance SP
- Áp dụng strategy mix RI/SP/On-Demand
- Quản lý RI Marketplace
- Hiểu Spot pricing và interruption mechanism
- Áp dụng Spot Fleet với allocation strategies
- Build fault-tolerant Spot architectures
- Combine Spot + On-Demand trong ASG
Phần 1: AWS Trusted Advisor
1. Tổng quan Trusted Advisor
AWS Trusted Advisor = online tool give real-time guidance để follow AWS best practices.
5 check categories
- Cost Optimization: identify wasted spending
- Performance: improve speed/throughput
- Security: identify security risks
- Fault Tolerance: improve availability
- Service Limits: usage approaching quotas
2. Check Categories Examples
Cost Optimization
- Low Utilization EC2 Instances (< 10% avg CPU 14 days)
- Underutilized EBS Volumes
- Idle Load Balancers
- Idle RDS DB Instances
- Reserved Instance optimization
- Savings Plans recommendations
Performance
- High Utilization EC2 (> 90% CPU)
- Large Number of Rules in SG (slow firewall)
- EBS Magnetic Volumes (consider gp3)
- CloudFront Content Delivery Optimization
- Overutilized EC2
Security
- Security Group with unrestricted access (0.0.0.0/0 on common ports)
- IAM password policy weak
- Root account without MFA
- S3 buckets with open permissions
- MFA on root account
- CloudTrail logging
- Exposed access keys
Fault Tolerance
- Not Multi-AZ RDS
- EBS snapshots missing
- Auto Scaling not configured
- VPN tunnel redundancy
- Direct Connect Single Connection
- Route 53 health checks missing
Service Limits
- Approaching limit on EC2 instances, EBS volumes, etc.
- 80% threshold warning
3. Support Plan Tiers
Basic / Developer plans
- Core checks only (7 checks):
- S3 bucket permissions
- Security Groups — unrestricted ports
- IAM use
- MFA on root
- EBS public snapshots
- RDS public snapshots
- Service limits
Business / Enterprise plans
- All checks available (200+)
- Programmatic API access
- Weekly notifications
- Recommended actions automation via EventBridge
Recommendation
- Production workload: Business Support minimum ($100/month or 10% of usage)
- Get full Trusted Advisor + AWS Health API + 24/7 support
4. Trusted Advisor Console
Dashboard
- Shows checks pass/warning/error per category
- Drill down to specific resources
Refresh
- Auto-refresh weekly (some checks)
- Manual refresh available
Exclude items
- Mark items as "ignored" (e.g., known issue, intentional)
5. API and Automation
AWS Support API
- Programmatic access to Trusted Advisor (Business+ plans only)
- Query checks, refresh, exclude items
EventBridge integration
- Trusted Advisor check status change → EventBridge event
- → Lambda auto-remediate
Example automation
Trusted Advisor: "SG with 0.0.0.0/0 on port 22 (SSH)"
→ EventBridge
→ Lambda: remove the rule (or alert)
6. Compute Optimizer (related)
Định nghĩa
AWS Compute Optimizer = ML-based right-sizing recommendations for EC2, EBS, Lambda, ASG.
Đặc điểm
- More detailed than Trusted Advisor
- 14-day analysis window
- Provides specific instance type recommendations
- Cost savings projection
Use case
- Right-size EC2 (downgrade overprovisioned)
- Lambda memory tuning
- EBS gp2 → gp3 migration
Pricing
- Free
7. AWS Health Dashboard
Định nghĩa
Service health dashboard with personalized events affecting your AWS account.
2 views
- Public health dashboard: general AWS service status
- Personal Health Dashboard (PHD): events affecting YOUR resources
Events
- AWS-wide outages
- Scheduled maintenance (RDS patching, EC2 retirement)
- Security events
- Resource-specific alerts (e.g., your EBS volume will be migrated)
AWS Health API (Business+ plans)
- Programmatic access
- Integration with monitoring tools
- Automated incident response
8. Common Patterns
Pattern 1: Weekly security review
- Friday review Trusted Advisor security checks
- Document exceptions, fix violations
Pattern 2: Auto-remediate
Trusted Advisor: "S3 bucket public"
→ EventBridge event
→ Lambda → block public access
→ SNS notify team
Pattern 3: Cost saving sprint
- Monthly Cost Optimization checks
- Right-size underutilized EC2 (Compute Optimizer)
- Migrate gp2 → gp3 (Trusted Advisor + Compute Optimizer)
- Delete idle resources
Pattern 4: Service limit monitoring
- Trusted Advisor warns at 80%
- Auto-create AWS Support ticket to increase limit
- Avoid hitting limits in production
Phần 2: Cost Explorer và AWS Budgets
1. AWS Cost Management Suite
Tổng quan các tools
- AWS Billing Console: hóa đơn, thanh toán
- Cost Explorer: visualize + phân tích chi phí
- AWS Budgets: set alerts về cost/usage
- Cost Anomaly Detection: ML detect anomalies
- AWS Cost Categories: group costs by custom logic
- AWS Pricing Calculator: estimate before deploy
- Cost & Usage Report (CUR): detailed CSV/Parquet
2. Cost Explorer (Recap + Advanced)
Visualize options
- Granularity: Hourly (14 days history), Daily (38 months), Monthly (38 months)
- Group by: Service, Region, Account, Tag, Usage Type, Instance Type, Linked Account, Charge Type, Purchase Option
- Filter: similar dimensions
- Forecast: predict next 1-12 months based on past
Reports
- Daily, Monthly, Year-over-Year
- Save filter as Custom Report
- Schedule email reports (Cost Reports)
Reserved Instance / Savings Plans Recommendations
- Analyze past usage
- Suggest RI/SP purchase for savings
- Show estimated savings
Right-sizing recommendations
- Identify underutilized EC2
- Suggest smaller instance type
- Combined với Compute Optimizer (more detailed)
3. AWS Budgets
4 budget types
- Cost budget: dollars
- Usage budget: hours, GB, requests
- RI/SP budget: utilization, coverage
- Action-based budget: trigger actions on threshold
Actions (Budget Actions)
- Send SNS notification
- Apply IAM policy (restrict permissions)
- Stop EC2/RDS instances
- Target SCP in Organizations
Alerting
- Email (up to 10 recipients)
- SNS topic
- AWS Chatbot (Slack, Teams)
Cost
- 2 budgets free
- $0.02/budget/day after
4. Cost Anomaly Detection
Định nghĩa
ML-powered service detect unexpected cost spikes.
Setup
- Monitor types:
- AWS services (per service)
- Linked Account (per account in Organization)
- Cost Categories
- Cost Allocation Tags
- Threshold: dollar amount OR percentage increase
- Subscription: email/SNS
Detection
- Algorithm learns normal pattern (14+ days)
- Alerts on anomalies (statistical significance)
- Suggests root cause (which service/resource increased)
Cost
- Free
Use case
- Detect hacker mining crypto on EC2
- Catch app bug causing Lambda invocation spike
- Identify cost surprises before month-end
5. Cost Allocation Tags
2 types
- AWS-generated:
aws:createdBy,aws:cloudformation:stack-name - User-defined:
Project,Environment,CostCenter,Owner
Activation
- Tag resources (manual hoặc via Tag Policies)
- Billing Console → Cost Allocation Tags → Activate
- Wait ~24 hours for tag to appear in Cost Explorer
- Filter/group by tag in Cost Explorer
Best practice
- Mandatory tags via SCP: enforce tagging
- Tag policies via Organizations: standardize values
- Tag missing → automation: Lambda finds untagged → notify owner
Common tag schema
Project (string): "ProjectX"
Environment (enum): "prod", "staging", "dev", "test"
Owner (email): "alice@company.com"
CostCenter (string): "CC-1234"
Application (string): "billing-service"
6. Cost Categories
Định nghĩa
Cost Categories = group costs by custom rules for reporting.
Setup
- Define category with rules:
- Match by account, service, tag, charge type
- Multiple categories per cost
Example
Use case
- Multi-team chargeback
- Department billing
- Project P&L
7. Cost & Usage Report (CUR)
Định nghĩa
CUR = most detailed billing data, delivered to S3 daily.
Format
- CSV, Parquet, ORC
- Includes: every line item with usage, cost, tax, credits, etc.
Analysis
- Athena: SQL queries
- QuickSight: visualizations
- 3rd party tools: Cloudability, CloudHealth
vs Cost Explorer
- Cost Explorer: visual UI, summarized
- CUR: raw data, granular, customizable
Use case
- Custom dashboards beyond Cost Explorer
- FinOps team analysis
- Chargeback to departments
8. AWS Pricing Calculator
Workflow
- Add services to estimate (EC2, S3, etc.)
- Configure: instance type, hours, storage, transfer
- Calculator estimates monthly + 12-month cost
- Export PDF/CSV
- Share via URL
Use case
- Estimate before deploy
- Present to stakeholders / management
- Compare options (EC2 vs Lambda vs Fargate)
- Migration planning
URL
9. Cost Optimization Workflow
Monthly cycle
- Review Cost Explorer (last month)
- Identify top cost drivers, anomalies
- Right-size with Compute Optimizer
- Reserved Instance / Savings Plans recommendations
- Tag compliance check (untagged resources)
- Budget review vs actual
- Action items: optimization, cleanup
Quarterly
- Audit unused resources (idle EC2, unattached EBS)
- Review storage classes (S3 lifecycle)
- Check Reserved Instance utilization
- Renew or modify RI as needed
10. Common Cost Optimization Strategies
1. Right-sizing
- Compute Optimizer recommendations
- Schedule shutdowns for dev/test (off-hours)
- AWS Instance Scheduler service
2. Reserved Instances / Savings Plans
- 3-year AURI: up to 72% off
- Compute Savings Plans: flexible
3. Spot Instances
- Fault-tolerant workloads
- Up to 90% off
4. Storage tiering
- S3 lifecycle to IA/Glacier
- EBS gp2 → gp3 (~20% saving)
- EFS Lifecycle Management
5. Reduce data transfer
- VPC Endpoints (avoid NAT/IGW)
- CloudFront caching
- Same-region traffic
6. Delete unused resources
- Idle EC2, RDS, ELB
- Unattached EBS volumes
- Unused EIPs
- Old snapshots
7. Lambda vs EC2 for low traffic
- Lambda free tier: 1M requests/month
- Often cheaper for sporadic workload
8. Use ARM (Graviton)
- t4g, m6g, c7g instances ~20% cheaper
Phần 3: Reserved Instances và Savings Plans Deep Dive
1. Reserved Instances (RI) Recap
Term
- 1 hoặc 3 năm commitment
- Discount lên đến 72%
Payment options
- All Upfront (AURI): most discount
- Partial Upfront (PURI): medium
- No Upfront (NURI): least discount
Offering Class
- Standard RI: locked attributes, can sell on Marketplace
- Convertible RI: exchange to other instances (cùng giá trị trở lên), cannot sell
Scope
- Regional RI (default): apply to any AZ in Region, no capacity reservation
- Zonal RI: 1 AZ, capacity reservation included
Applies to
- EC2, RDS, ElastiCache, OpenSearch, Redshift, DynamoDB
2. Savings Plans (SP) Recap
Commitment
- $/hour for 1 or 3 years
- e.g., commit $5/hour for 1 year → $$$$ savings
3 types
- Compute Savings Plans: most flexible
- EC2 Instance Savings Plans: limited to 1 family + region
- SageMaker Savings Plans: for SageMaker
Applies to
- Compute SP: EC2 (any family, region, OS, tenancy), Fargate, Lambda
- EC2 Instance SP: 1 family, 1 region, any OS/tenancy/size
- SageMaker SP: SageMaker training/inference
3. RI vs Savings Plans Comparison
| Feature | Reserved Instance | Savings Plans |
|---|---|---|
| Commitment | Specific instance attributes | $/hour spend |
| Applies to | Specific service (EC2/RDS/etc.) | Compute (EC2+Fargate+Lambda) or EC2 family |
| Flexibility | Convertible RI = some | Compute SP = highest |
| Marketplace | Standard RI can sell | Cannot sell |
| Discount | Up to 72% | Up to 72% |
| Discount priority | RI applies first | SP applies after RI |
| Use case | Specific predictable workload | Flexible compute commitment |
Discount Application Order
1. AWS-generated discounts (free tier, promotional credits)
2. Reserved Instance discounts
3. Savings Plans discounts (after RI)
4. Remaining usage at On-Demand rate
4. Detailed: Compute Savings Plans
Flexibility
- Switch EC2 family (m5 → c5 → r5)
- Switch region
- Switch OS (Linux → Windows)
- Switch tenancy
- Apply to Fargate, Lambda
Use case
- Multi-region apps
- Workload may evolve (migrate to Fargate, Lambda)
- Most cost-conscious teams
Discount
- Up to 66%
5. Detailed: EC2 Instance Savings Plans
Flexibility
- Same family (e.g., m5) + same region
- Switch size (m5.large → m5.xlarge)
- Switch OS
- Switch tenancy
Use case
- Specific EC2 family standardization
- Known region
Discount
- Up to 72% (highest within SP)
6. Combining RI + SP + On-Demand
Best practice mix
Baseline 24/7 workload → Reserved Instance 3y AURI (72% off)
Variable 80% of week → Savings Plans 1y (66% off)
Peak hourly burst → On-Demand (no commitment)
Background batch → Spot (90% off)
Example calculation
- Workload: 10 EC2 m5.large baseline + 5 peak during business hours
Strategy A: 100% On-Demand
- 15 instances × $0.10/hr × 730 hr = $1,095/month
Strategy B: Mix RI + On-Demand
- 10 RI 3y AURI: 10 × $0.04/hr × 730 = $292/month
- 5 On-Demand peak (8 hr/day, 22 days): 5 × $0.10 × 176 = $88
- TOTAL: $380/month (saving 65%)
7. RI Utilization Best Practices
Track utilization
- Cost Explorer → Reserved Instance Utilization report
- Target: 90%+
- Below 50%: waste, consider modify
Improve utilization
- Regional RI > Zonal RI (more flexible)
- Convertible RI for changing workload
- Standard RI for predictable
Sell on Marketplace (Standard RI only)
- List remaining term
- Buyers purchase shorter-term RIs
- Recover cost when no longer needed
8. Savings Plans Utilization
Track
- Cost Explorer → Savings Plans Utilization
- Target: 90%+
- Below 70%: review
Optimize
- Right-size commitment (don't over-commit)
- Use Compute SP for flexibility
- Stack multiple SPs for granularity
Cannot resell
- Avoid over-committing
9. Capacity Reservations (ODCR)
Định nghĩa
On-Demand Capacity Reservation = reserve capacity (instance available when needed) without commitment.
Đặc điểm
- No discount on price (same as On-Demand)
- Reserve capacity in specific AZ
- Cancel anytime
- Can combine với SP/RI for discount
Use case
- Critical events (Black Friday, product launch)
- DR scenario (ensure capacity for failover)
- Stable workload needing AZ-specific capacity
vs Zonal RI
- Zonal RI: capacity + discount + 1y/3y commitment
- ODCR: capacity only, no commitment, can pair với SP/RI for discount
10. RI Pricing Math Example
Scenario: 1 m5.large 24/7 for 3 years (us-east-1, Linux)
| Pricing | $/hour | 3-year total | Saving |
|---|---|---|---|
| On-Demand | $0.096 | $2,524 | 0% |
| 1-year No Upfront RI | $0.067 | $1,760 | 30% |
| 1-year All Upfront RI | $0.063 | $1,650 | 35% |
| 3-year No Upfront RI | $0.042 | $1,104 | 56% |
| 3-year All Upfront RI | $0.033 | $867 | 66% |
| Compute SP 3y AURI | $0.034 | $895 | 64% |
| EC2 SP 3y AURI | $0.030 | $789 | 69% |
Numbers approximate, verify on AWS Pricing.
11. Free Trial / Credits
Free Tier
- 12 months free (e.g., 750 EC2 t2.micro hours)
- Always-free services (Lambda 1M requests)
AWS Credits
- Promotional credits (events, contests)
- Apply to specific services or all
- Expire after period
AWS Activate (startups)
- Up to $100K credits for startup founders
12. Common Pricing Patterns
Pattern 1: Stable production
- 100% RI 3-year AURI
- Lowest cost for predictable workload
Pattern 2: Growing workload
- Compute SP 1-year (re-evaluate yearly)
- Some On-Demand for growth headroom
Pattern 3: Variable + batch
- Baseline: SP for steady state
- Peak: On-Demand
- Batch: Spot
Pattern 4: Serverless
- Lambda + Fargate covered by Compute SP
- Pay-per-execution savings on top
Phần 4: Spot Instance Strategies
1. Spot Recap
Spot Instances = unused EC2 capacity at up to 90% discount, AWS có thể reclaim với 2-min warning.
When to use
- Fault-tolerant workloads (can interrupt + retry)
- Stateless or checkpoint-based
- Big data, ML training, image rendering
- CI/CD workers, dev/test environments
When NOT to use
- Database (stateful)
- Mission-critical apps
- Workload không thể replace mid-execution
2. Spot Pricing
Pricing model
- AWS sets price based on capacity supply/demand
- You set max price willing to pay
- If Spot price ≤ max → instance runs
- If Spot price > max → instance terminated
Spot Price History
- View past 90 days
- Identify stable instance types/AZs
- Avoid volatile pools
Best practice
- Set max price = On-Demand price (giúp instance ít bị reclaim do giá)
- Spot interruption due to capacity, not price (most common reason)
3. Spot Interruption Behaviors
3 options
- Terminate (default): instance destroyed
- Stop: stop instance, keep EBS, restart later if Spot available
- Hibernate: save RAM to EBS, fast resume
Stop và Hibernate yêu cầu
- EBS-backed
- Specific instance types
Use case for each
- Terminate: stateless, can replace
- Stop: large state, OK to pause
- Hibernate: warm cache, fast resume needed
4. Spot Interruption Notice
Workflow
- AWS decides to reclaim instance
- 2-minute warning sent via instance metadata
- App should:
- Save state (S3, DynamoDB)
- Drain connections (deregister from ELB)
- Checkpoint progress
- After 2 min: instance terminated
Check warning
# Inside instance
curl http://169.254.169.254/latest/meta-data/spot/instance-action
# Returns terminate time if interruption coming
EventBridge integration
- Spot interruption event → Lambda → handle
- E.g., update database, notify monitoring
5. Spot Allocation Strategies (Spot Fleet & ASG)
Why important
- Pool = combination (instance type + AZ + OS + tenancy)
- Spread across pools = less interruption
Strategies
lowestPrice
- Cheapest pool
- Higher interruption risk
- Use: cost-sensitive batch
diversified
- Spread evenly across all pools
- Better availability
- Use: stateless workloads
capacityOptimized
- Pool với largest available capacity
- Lowest interruption rate
- Use: workload ưu tiên uptime tuyệt đối
priceCapacityOptimized (AWS-recommended default)
- Balance lowest price + lowest interruption
- Use: hầu hết workloads — AWS hiện khuyến nghị làm mặc định
Decision
- price-capacity-optimized: default cho hầu hết workload (AWS recommended)
- capacity-optimized: priority is uptime (lowest interruption)
- lowest-price: priority is cost (more risk)
6. Spot Fleet
Định nghĩa
Spot Fleet = managed group of Spot (+ optional On-Demand) instances meeting target capacity.
Features
- Mix multiple instance types/families
- Multiple Spot pools
- Optional On-Demand baseline
- Auto-replace terminated instances
Configuration
Spot Fleet:
Target capacity: 100 instances (or vCPUs or memory units)
On-Demand portion: 20 (always running)
Spot portion: 80 (price-sensitive)
Allocation strategy: capacity-optimized
Instance types pool:
- m5.large
- m5.xlarge
- m5a.large
- c5.large
- c5a.large
7. EC2 Auto Scaling với Mixed Instances
Mixed Instances Policy
- ASG launch nhiều instance types
- Mix Spot + On-Demand
- Specify base capacity (On-Demand) + percentage (Spot)
Example
ASG:
Min: 2, Desired: 10, Max: 50
On-Demand base: 2 (always)
On-Demand percentage above base: 20% (2 of every 10 above base)
Spot percentage: 80%
Instance types:
- m5.large
- m5a.large
- m5n.large
- m4.large
Spot allocation strategy: capacity-optimized
Result
- 2 baseline On-Demand
- Above 2: 20% On-Demand, 80% Spot
- E.g., at desired=10: 4 On-Demand + 6 Spot
8. Spot Best Practices
1. Design for interruption
- Stateless or checkpoint state
- Idempotent operations
- Use SQS for work distribution (resume if interrupted)
2. Diversify
- Multiple instance types, AZs
- Reduce dependency on single pool
3. Use capacity-optimized
- Lowest interruption
- Often default best choice
4. Combine with Spot
- Spot for elasticity (scale out/in)
- On-Demand + Spot blend
5. Test handle interruption
- Simulate via metadata or AWS Fault Injection Simulator
- Verify app saves state, fails gracefully
9. Use Cases
Big Data (Spark, EMR)
- EMR managed Spot + On-Demand cluster
- Master + core: On-Demand (stable)
- Task nodes: Spot (fault-tolerant compute)
CI/CD
- Jenkins agents on Spot
- Multiple instance types
- Fallback to On-Demand if Spot unavailable
Batch processing
- AWS Batch with Spot pricing
- Auto-retry on interruption
Containerized workloads
- ECS / EKS with Spot
- Spot nodes for stateless services
- Persistent state in RDS/EFS
Image/video rendering
- Render farm on Spot
- Each job checkpoint progress
- Resume if interrupted
10. Spot vs On-Demand Cost Example
Scenario: 100 m5.large for batch (4 hours/day)
Pure On-Demand
- 100 × $0.096/hr × 4 hr × 30 days = $1,152/month
Spot (70% discount, ~10% interruption overhead)
- 100 × $0.029/hr × 4 hr × 30 days × 1.1 = $382/month
- Saving: ~$770/month (66%)
11. Common Architecture Patterns
Pattern 1: Web app baseline + Spot scale
ASG:
- 5 On-Demand baseline (always)
- Auto-scale up to 50 with mix:
- 20% On-Demand (reliability)
- 80% Spot (cost)
- capacity-optimized strategy
Pattern 2: Big data pipeline
EMR cluster:
- Master + Core: On-Demand
- Task nodes: Spot Fleet (mix m5, c5, r5)
- Checkpoint to S3 frequently
Pattern 3: ML training
SageMaker Training:
- Use Managed Spot Training
- Save model checkpoints to S3
- Resume from checkpoint if interrupted
- 70-90% saving
Pattern 4: CI/CD farm
Jenkins or GitHub Actions runners:
- Auto-launch Spot instance per job
- Self-host runner on Spot
- Reduce idle cost vs always-on
12. Spot Limits
Service quotas
- Default: 256 vCPUs per region for Spot
- Request increase if needed
Region/AZ availability
- Some instance types not in all regions
- Availability changes (capacity)
Cannot use Spot for
- Dedicated Hosts
- Dedicated Instances
- Capacity Reservations
- Some specific instance types
Câu hỏi ôn tập
-
5 categories của Trusted Advisor là gì?
Xem đáp án
(1) Cost Optimization — idle resources, underutilized EC2, unattached EBS. (2) Performance — CloudFront config, EC2 instance types. (3) Security — open security groups, IAM MFA, exposed access keys, S3 public buckets. (4) Fault Tolerance — Multi-AZ RDS, Auto Scaling, EBS snapshots. (5) Service Limits (Quotas) — alert khi usage > 80% của service limit.
-
Free tier có access đầy đủ checks không?
Xem đáp án
Không — Free tier (Basic/Developer Support) chỉ có access đến 7 core checks: S3 public buckets, Security Groups unrestricted ports, IAM use, MFA on root, EBS public snapshots, RDS public snapshots, và Service Limits. Để access tất cả ~400+ checks cần Business hoặc Enterprise Support plan ($100+/month). AWS Organizations có thể aggregate checks cross-account.
-
Compute Optimizer khác Trusted Advisor ở điểm gì?
Xem đáp án
Compute Optimizer: sử dụng ML analyze CloudWatch metrics 14 ngày để recommend optimal EC2 instance type, Lambda memory, EBS volume type, ECS on Fargate. Recommendations rất cụ thể với cost/performance impact estimates. Trusted Advisor: broad recommendations across 5 categories, không chỉ compute. Compute Optimizer deeper và ML-driven cho sizing; Trusted Advisor broader coverage. Cả hai miễn phí (Compute Optimizer free tier available).
-
AWS Health Dashboard show gì?
Xem đáp án
AWS Health Dashboard (Service Health Dashboard + Personal Health Dashboard) hiển thị: (1) AWS service health globally và per region, (2) Upcoming maintenance scheduled events ảnh hưởng resources của bạn, (3) Account-specific events — ví dụ EC2 instance của bạn đang trên hardware sắp được maintain. Khác với generic status page: Personal Health Dashboard chỉ show events relevant đến account của bạn.
-
Threshold warning cho service limit là bao nhiêu %?
Xem đáp án
80% — Trusted Advisor cảnh báo khi usage đạt 80% của service quota (limit). Cho phép bạn request increase trước khi hit hard limit và gây outage. Ví dụ: EC2 instance limit 1000, đang dùng 800 → warning. Request quota increase qua Service Quotas console trước khi reach 100%. Một số quotas có thể tự động increase (soft limits), một số cần AWS review (hard limits).
-
Cost Explorer granularity options là gì?
Xem đáp án
Hourly (data retained 14 ngày), Daily (38 tháng), Monthly (38 tháng). Hourly granularity có phí thêm nếu dùng API nhưng miễn phí trong console. Hourly hữu ích để identify spikes trong ngày. Monthly đủ cho high-level budget review. Daily cho trend analysis theo tuần. Cũng có thể filter theo Service, Linked Account, Tag, Region, Usage Type, Instance Type.
-
Cost Anomaly Detection có miễn phí không?
Xem đáp án
Miễn phí — Cost Anomaly Detection (2020) không có phí riêng. Sử dụng ML để detect cost anomalies so với historical patterns, gửi alert qua email hoặc SNS khi phát hiện. Có thể setup monitors theo individual service, AWS account, cost category, hoặc cost allocation tag. Phát hiện được ransomware mining, data exfiltration, code bugs gây cost spike — trước khi nhận bill cuối tháng.
-
Cost Allocation Tags hiện trong Cost Explorer sau bao lâu?
Xem đáp án
24 giờ sau khi activate. Điều quan trọng: chỉ cost data sau thời điểm activate mới được tag — không retroactive. Và tags phải được activate trong Billing Console (Billing → Cost Allocation Tags) — chỉ tag resource không đủ. Workflow: tag resources → activate tag → đợi 24h → filter theo tag trong Cost Explorer.
-
CUR khác Cost Explorer ở điểm gì?
Xem đáp án
Cost and Usage Report (CUR): raw, granular CSV/Parquet data export sang S3 — mọi line item (hourly), resource IDs, pricing details, reservation usage. Dùng với Athena, QuickSight, third-party tools cho custom analysis. Cost Explorer: interactive visualization, predefined dashboards, forecasting, recommendations — không granular như CUR nhưng dễ dùng hơn. CUR cho advanced analytics; Cost Explorer cho quick insights.
-
Compute Optimizer khác Cost Explorer recommendation ở điểm gì?
Xem đáp án
Compute Optimizer: dùng ML analyze CloudWatch utilization metrics (CPU, network, memory từ agent) để recommend optimal EC2 instance type, Lambda memory, EBS size — rất cụ thể với performance trade-offs. Cost Explorer right-sizing: recommend based on CloudWatch metrics đơn giản hơn, focus trên cost savings của EC2. Compute Optimizer có ML model tốt hơn, analyze Lambda và EBS — Cost Explorer chỉ EC2.
- Discount priority: RI applied trước hay sau SP?
Xem đáp án
RI applied trước, sau đó Savings Plans. Cả hai so sánh usage với committed resources: RI match exact instance type/AZ/OS configuration trước; Savings Plans flexible hơn và apply sau RI. Cả hai không thể "stack" trên cùng hour — RI committed hour không còn available cho SP. Unused RI/SP được "charged" dù không dùng — thiết kế để maximize utilization.
- Convertible RI cho phép đổi gì?
Xem đáp án
Convertible RI cho phép exchange sang RI khác có equal or greater value: đổi instance family (m5 → r5), OS (Linux → Windows), tenancy (shared → dedicated), size. Không đổi được Region và term (RI gắn với Region). Không thể exchange xuống giá trị thấp hơn (phải exchange nhiều RI nhỏ lấy một RI lớn). AWS apply blended pricing khi exchange. Discount thấp hơn Standard RI (~54% vs ~72%) để bù đắp flexibility.
- EC2 Instance SP khác Compute SP ở flexibility nào?
Xem đáp án
EC2 Instance SP: commit cho một instance family cụ thể trong một Region cụ thể (ví dụ: m5 in us-east-1) — có thể đổi size (m5.large → m5.4xlarge) và OS. Compute SP: flexible across instance family, size, Region, OS, và cả Lambda + Fargate. EC2 Instance SP discount cao hơn (~72%); Compute SP thấp hơn (~66%) nhưng flexible hơn nhiều. Compute SP phù hợp khi workload thay đổi.
- Standard RI có thể sell on Marketplace không?
Xem đáp án
Có — Standard RI có thể bán lại trên AWS Reserved Instance Marketplace khi không còn cần. Điều kiện: không phải All-Upfront mới mua < 30 ngày, phải là 1-year RI còn ít nhất 1 tháng, không phải Windows/RHEL/SUSE với dedicated tenancy. Convertible RI không bán được trên Marketplace — đây là trade-off của flexibility. Giá bán do người bán set, AWS take 12% fee.
- ODCR có discount không?
Xem đáp án
Không — On-Demand Capacity Reservation (ODCR) charge On-Demand rate kể cả khi không sử dụng. ODCR chỉ đảm bảo capacity available khi cần (không bị "capacity unavailable" errors). Để vừa có capacity reservation vừa discount, kết hợp với Zonal RI hoặc Savings Plans — chúng tự động apply discount lên ODCR matching. Hữu ích cho disaster recovery capacity reservation.
- Spot interruption warning có bao lâu trước khi terminate?
Xem đáp án
2 phút (120 giây). AWS gửi Spot Instance interruption notice qua Instance Metadata (/latest/meta-data/spot/termination-time) và EventBridge. Application phải checkpoint work, drain connections, save state trong 2 phút này. Best practice: polling metadata mỗi 5 giây, configure ASG lifecycle hooks để graceful drain từ LB trước khi terminate.
- Allocation strategy nào cho lowest interruption?
Xem đáp án
capacity-optimized strategy — AWS chọn pools có nhiều capacity nhất (và do đó ít likely bị interrupted nhất). Khác với lowest-price (default) chọn cheapest pool. capacity-optimized-prioritized kết hợp: AWS ưu tiên pools bạn chỉ định nhưng vẫn optimize capacity. Cho workloads quan trọng hơn là workloads chỉ cần lowest cost — batch ETL hay HPC jobs nên dùng capacity-optimized.
- Spot có thể Stop hoặc Hibernate được không?
Xem đáp án
Có — thay vì terminate, Spot có thể Stop (EBS-backed only — instance state lưu trên EBS) hoặc Hibernate (RAM dumped to EBS, instance stopped, resume về đúng state). Cấu hình interruption behavior khi request. Hibernate phù hợp cho workloads cần memory state preserved (ML inference models loaded). Cần EBS với dung lượng ≥ RAM size, và instance type/OS hỗ trợ hibernation.
- Khi nào KHÔNG nên dùng Spot?
Xem đáp án
Không dùng Spot cho: (1) Databases (stateful, interruption gây data loss hoặc corruption), (2) Stateful web servers mà không có proper drain/failover, (3) Long-running jobs không checkpoint (mất hết progress khi interrupted), (4) Compliance workloads cần guaranteed availability, (5) Primary instances trong HA architectures không có On-Demand fallback. Spot cần fault-tolerant, stateless, hoặc checkpoint-capable workloads.
- Mixed Instances Policy trong ASG là gì?
Xem đáp án
Mixed Instances Policy cho phép ASG dùng nhiều instance types từ cùng một Launch Template base. Kết hợp On-Demand + Spot trong cùng ASG: On-Demand cho baseline capacity (ổn định), Spot cho burst capacity (giảm cost). Cấu hình: % On-Demand base, danh sách instance types (AWS chọn best availability), allocation strategy. Giảm Spot interruption bằng cách diversify across nhiều pools.
Bài tập thực hành
Phần 1: AWS Trusted Advisor
- Vào Trusted Advisor console, review tất cả checks
- Fix 1 Security finding (ví dụ: SG 0.0.0.0/0:22)
- Enable Compute Optimizer, review EC2 recommendations
- Check Service Limits, request increase nếu cần
- Setup EventBridge: Trusted Advisor security check fail → SNS
Phần 2: Cost Explorer và AWS Budgets
- Mở Cost Explorer, group by Service, identify top 3 costs
- Tạo monthly cost budget $50 với email alert
- Enable Cost Anomaly Detection
- Activate user-defined tags
ProjectvàEnvironment - Estimate cost cho 1 EC2 t3.medium + RDS db.t3.small via Pricing Calculator
Phần 3: Reserved Instances và Savings Plans Deep Dive
- Vào Cost Explorer → RI Recommendations
- So sánh cost 1 m5.xlarge với 5 pricing models trên Pricing Calculator
- Check RI utilization của account (nếu có)
- (Thử nghiệm) Mua 1 RI Zonal cho t3.micro 1-year No Upfront, observe sau
- Setup Compute SP 1-year $1/hr commitment (cancellable trong 7 days nếu thử)
Phần 4: Spot Instance Strategies
- Launch Spot Instance với max price = On-Demand
- Listen for instance metadata interruption notice
- Tạo ASG với Mixed Instances Policy (50% Spot, 50% On-Demand)
- Test Spot Fleet với 3 instance types
- Run sample batch job on EMR with Spot task nodes
Tài liệu tham khảo
- Trusted Advisor
- Compute Optimizer
- Personal Health Dashboard
- Cost Explorer
- AWS Budgets
- Cost Anomaly Detection
- Pricing Calculator
- Cost Allocation Tags
- Reserved Instances
- Savings Plans
- Capacity Reservations
- Marketplace
- Spot Instances
- Spot Best Practices
- Mixed Instances Policy
- Spot Allocation Strategies