AWS Beanstalk, App Runner, ECS Fargate

লেসন ৩৩ / ৩৮

🌱 Elastic Beanstalk

Code upload → AWS manages EC2+LB+ASG+S3। Heroku-like for AWS।

pip install awsebcli
eb init
eb create production     # 5-10 min
eb deploy
eb logs
eb open
eb ssh

📝 .ebextensions/

option_settings:
  aws:elasticbeanstalk:application:environment:
    APP_ENV: production
    DB_HOST: rds-endpoint

container_commands:
  01_migrate:
    command: "php artisan migrate --force"
    leader_only: true

🔄 Deploy Policies

  • All at once — fast, downtime
  • Rolling — batch
  • Rolling+add — zero downtime
  • Immutable — safest, new ASG
  • Blue/Green — swap env, manual

⚡ App Runner (simplest)

GitHub/ECR → URL in 5 min
Auto HTTPS, auto-scale, deploy-on-push
Heroku competitor
Higher cost, zero config

🐳 ECS Fargate (modern standard)

Serverless container
No EC2 to manage
$0.04/vCPU-hour + $0.004/GB-hour

Task definition (JSON):
- Image, CPU, memory, env, port, log

Service:
- Desired count, ALB attach, auto-scale

☸️ EKS

Managed Kubernetes
$0.10/hr cluster + workers
Use when: K8s skill, multi-cloud

📊 Comparison

Lambda:      function, 15-min, scale 0
App Runner:  simple web, Heroku-like
Beanstalk:   traditional app PaaS
ECS Fargate: container, no VM 🔥 modern choice
ECS EC2:     container, manage VM
EKS:         Kubernetes
EC2:         bare VM

💰 Small App Cost

Lambda:      $0-20
App Runner:  $25-100
EB t3.small: $20
Fargate:     $30-100
EKS:         $73+ worker
EC2 t3.sm:   $15

🎓 মূল কথা ⭐

Fargate = modern AWS container choice। Beanstalk = traditional app। Lambda = event-driven। Pick based on team skill ও workload pattern।