ProjectTech4DevAI / ProjectTech4DevAI/kaapi-backend

Infra: Use ALB for Kaapi Instances

Offen
#848 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

infrastructure
Vorherrschende Sprache
Python
Sterne
18
Forks
10
Ø Merge
2 T. 20 Std.
Gemergte PRs (30 T.)
14

Beschreibung

Is your feature request related to a problem?

  • Attaching Elastic IPs to kaapi-prod-ui-guardrails and kaapi-staging-ui-guardrails is unnecessary and adds cost.
  • EIPs are not needed if services are accessible through an ALB

Describe the solution you'd like

  • Do this via ALB instead of Elastic IPs
    • Create Target Groups for kaapi-prod-ui-guardrails and kaapi-staging-ui-guardrails
    • Register respective EC2 instances in each target group

Describe the enhancement you'd like

  • Attach Elastic IP (to be done after services are up).
    • kaapi-prod-ui-guardrails
    • kaapi-staging-ui-guardrails
  • Create / Update ALB
    • Create ALB (or reuse existing one)
    • Add listener rules:
      • domain → forward to targeted group which we have created.
      • same for others.
  • Update DNS in Cloudflare
  • SSL Certificate update

Here is the high-level steps:

1. Create a Target Group
This is the group that tells ALB which EC2 to send traffic to.

Go to EC2 Console → Target Groups → Create Target Group
  • Target type: Instance
  • Protocol: HTTP, Port: whatever your app runs on (e.g. 8000, 3000)
  • Health check path: / or /health if your app has one
  • Register your EC2 instance as a target

2. Create the ALB

Go to EC2 Console → Load Balancers → Create Load Balancer → Application Load Balancer
  • Scheme: Internet-facing
  • Listeners: HTTPS 443 (or HTTP 80 to start)
  • Subnets: select at least 2 public subnets
  • Security group: allow inbound 80 and 443 from anywhere (0.0.0.0/0)
  • Forward traffic to the target group

3. Attach SSL Certificate to ALB via Cloudflare

  • Set ALB listener to HTTP 80 only
  • In Cloudflare, keep SSL mode as Flexible — Cloudflare terminates HTTPS, sends HTTP to ALB

4. Update Cloudflare DNS Record

5. Update EC2 Security Group
Right now EC2 probably allows inbound traffic from anywhere. After ALB is set up, lock it down so only the ALB can reach the EC2:

  • Remove the rule: 0.0.0.0/0port 8000
  • Add rule: ALB security group → port 8000

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der Überprüfung der vorhandenen EC2-Instanzen, Sicherheitsgruppen, ALB-Ressourcen und der Cloudflare-DNS-Konfiguration für die kaapi-Produktions- und Staging-Dienste. Erstelle Zielgruppen und Listener-Regeln oder verwende vorhandene wieder, route jede Domain über den ALB, aktualisiere die DNS- und SSL-Einstellungen und beschränke den EC2-Zugriff auf die ALB-Sicherheitsgruppe. Als abgeschlossen gilt die Aufgabe, wenn beide Dienste über ihre Domains ohne Elastic IPs erreichbar sind und ihre Health Checks erfolgreich sind.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
aws
Bereich
cloud, devops, infrastructure
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.