Loading
Loading
Cloud Computing is the delivery of computing services — servers, storage, databases, networking, and software — over the Internet on a pay-as-you-go basis.
| Before Cloud | After Cloud | |-------------|-------------| | Buy physical servers for thousands | Pay for only minutes of compute | | Wait weeks for server setup | New server running in under 60 seconds | | Unused capacity 90% of the time | Capacity on actual demand | | Full team for maintenance and ops | Provider handles all maintenance |
| Model | Description | Example | |-------|-------------|---------| | Public Cloud | Shared servers managed by big provider | AWS, Azure, GCP | | Private Cloud | Dedicated cloud within the organization | VMware, OpenStack | | Hybrid Cloud | Mix of public and private | On-premise + AWS | | Multi-Cloud | Using multiple providers | AWS + GCP together |
Without Cloud:
GPU A100 to buy ← $15,000 + electricity + maintenance
With Cloud (AWS):
GPU A100 to rent ← $3.20/hour
Model needs 10 hours training ← only $32
Run 10 experiments for $320 instead of $150,000
# محاكاة حاسبة تكاليف الكلاود — Cloud Cost Calculator
from dataclasses import dataclass, field
@dataclass
class CloudResource:
name: str
category: str
unit: str
price_per_unit: float
monthly_usage: float
@property
def monthly_cost(self) -> float:
return round(self.price_per_unit * self.monthly_usage, 2)
# ─── AWS أسعار تقريبية ────────────────────────────────────
aws_resources = [
CloudResource("EC2 t3.small", "compute", "hour", 0.0208, 720),
CloudResource("S3 Storage", "storage", "GB", 0.023, 100),
CloudResource("Data Transfer", "network", "GB", 0.09, 50),
CloudResource("SageMaker Studio", "ai", "hour", 0.057, 40),
CloudResource("RDS db.t3.micro", "database","hour", 0.017, 720),
]
@dataclass
class CostCalculator:
provider: str
resources: list[CloudResource] = field(default_factory=list)
def total(self) -> float:
return round(sum(r.monthly_cost for r in self.resources), 2)
def report(self):
print(f"\n{'='*58}")
print(f"☁️ {self.provider} — تقرير التكاليف الشهري")
print(f"{'='*58}")
print(f"{'الخدمة':<25} {'الوحدة':<8} {'السعر':>9} {'الشهري':>9}")
print(f"{'─'*58}")
for r in self.resources:
price = "$" + f"{r.price_per_unit:.4f}"
cost = "$" + f"{r.monthly_cost:.2f}"
print(f"{r.name:<25} {r.unit:<8} {price:>9} {cost:>9}")
print(f"{'─'*58}")
total = self.total()
total_str = "$" + f"{total:.2f}"
annual_str = "$" + f"{round(total * 12, 2):.2f}"
print(f"{'المجموع الشهري':<45} {total_str:>9}")
print(f"{'المجموع السنوي':<45} {annual_str:>9}")
# ─── مشروع AI صغير على AWS ────────────────────────────────
calc = CostCalculator("AWS — مشروع AI صغير")
for r in aws_resources:
calc.resources.append(r)
calc.report()
# ─── مقارنة: خادم مادي vs الكلاود ────────────────────────
print(f"\n{'='*58}")
print(f"📊 مقارنة: خادم مادي vs الكلاود")
print(f"{'='*58}")
print(f"{'المعيار':<25} {'خادم مادي':<18} {'الكلاود':<15}")
print(f"{'─'*58}")
comparison = [
("التكلفة المبدئية", "$3,000 — $10,000", "$0"),
("وقت الإعداد", "2—4 أسابيع", "دقائق"),
("المرونة", "❌ ثابتة", "✅ كاملة"),
("الصيانة", "❌ على عاتقك", "✅ المزود"),
("التوسع", "❌ شراء جديد", "✅ في ثوانٍ"),
("الاسترداد (DR)", "❌ معقد", "✅ مدمج"),
]
for row in comparison:
print(f"{row[0]:<25} {row[1]:<18} {row[2]:<15}")
# ─── AWS Free Tier ────────────────────────────────────────
print(f"\n{'='*58}")
print(f"🆓 AWS Free Tier — ما تحصل عليه مجاناً (12 شهر)")
print(f"{'='*58}")
free_tier = [
("EC2 t2.micro", "750 ساعة/شهر", "كافٍ لتطبيق صغير"),
("S3 Storage", "5 GB", "لتخزين الملفات"),
("Lambda Functions", "1M استدعاء/شهر", "للـ Serverless"),
("RDS", "750 ساعة/شهر", "قاعدة بيانات مُدارة"),
("SageMaker", "250 ساعة Studio", "للتعلم الآلي"),
("CloudFront CDN", "50 GB", "لتوصيل المحتوى"),
]
for service, limit, desc in free_tier:
print(f" ✅ {service:<22} {limit:<20} {desc}")
print("\n💡 سجّل الآن على aws.amazon.com/free وابدأ مجاناً!")