# Elastic Beanstalk Quick Start

Schnellanleitung für Elastic Beanstalk Deployment in 10 Minuten.

## 🚀 Setup (nur einmal)

### 1. Prerequisites installieren

```bash
# AWS CLI
brew install awscli

# EB CLI
pip install awsebcli

# Docker Desktop muss laufen
```

### 2. AWS Credentials konfigurieren

```bash
aws configure
# Eingeben: Access Key, Secret Key, Region (z.B. eu-central-1)
```

### 3. Environment erstellen

```bash
cd backend-image-service

# Environment initialisieren und erstellen (dauert 5-10 Minuten)
./init-eb-environment.sh image-service-prod
```

Das wars! Dein Image Service läuft jetzt auf AWS.

## 📦 Updates deployen

Nach Code-Änderungen:

```bash
cd backend-image-service

# Neues Deployment (dauert 5-10 Minuten)
./deploy-to-eb.sh image-service-prod
```

## ✅ Testen

```bash
# Environment URL bekommen
eb status

# Health Check testen
curl http://your-env-url.elasticbeanstalk.com/health

# Image testen
curl -X POST http://your-env-url.elasticbeanstalk.com/render \
  -H "Content-Type: application/json" \
  -d '{
    "html": "<!DOCTYPE html><html><body><h1>Test</h1></body></html>",
    "width": 1280,
    "height": 720
  }'
```

## 📊 Monitoring

```bash
# Status anzeigen
eb status

# Logs anzeigen
eb logs

# Logs live streamen
eb logs --stream

# Health Dashboard
eb health --refresh
```

## 🔧 Skalierung

```bash
# Auf 4 Instances skalieren
eb scale 4

# Größere Instance Type
eb scale 2 --instance-type t3.large
```

## 🛑 Environment löschen

```bash
eb terminate image-service-prod
```

## 💰 Kosten

- **Development:** ~$50-60/Monat (1 t3.medium Instance + ALB)
- **Production:** ~$90-160/Monat (2-4 Instances mit Auto-Scaling)

## 🆘 Probleme?

```bash
# SSH in Instance
eb ssh

# Docker logs
sudo docker logs $(sudo docker ps -q)

# Environment neu starten
eb restart
```

## 📚 Mehr Details

Siehe [ELASTIC_BEANSTALK_DEPLOYMENT.md](ELASTIC_BEANSTALK_DEPLOYMENT.md) für:
- Detaillierte Konfiguration
- Security Best Practices
- Troubleshooting Guide
- Cost Optimization
- Production Checklist

---

**Das wars!** 🎉 Dein Image Service läuft auf AWS Elastic Beanstalk.
