ProjectTech4DevAI / ProjectTech4DevAI/kaapi-backend

Infra: Use ALB for Kaapi Instances

Open
#848 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

infrastructure
Dominant language
Python
Stars
18
Forks
10
Avg merge
2d 20h
Merged PRs (30d)
14

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing EC2 instances, security groups, ALB resources, and Cloudflare DNS configuration for the kaapi production and staging services. Create or reuse target groups and listener rules, route each domain through the ALB, update DNS and SSL settings, and restrict EC2 access to the ALB security group. Done means both services are reachable through their domains without Elastic IPs and their health checks pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
cloud, devops, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.