Skip to content

Add self-hosted cloud agent lab#35

Open
hsaab wants to merge 4 commits into
cursor:mainfrom
hsaab:add-cloud-agent-lab
Open

Add self-hosted cloud agent lab#35
hsaab wants to merge 4 commits into
cursor:mainfrom
hsaab:add-cloud-agent-lab

Conversation

@hsaab
Copy link
Copy Markdown

@hsaab hsaab commented May 15, 2026

Summary

  • Add the self-hosted Cloud Agents lab as cloud-agent, with EC2, ECS/Fargate, and EKS/Helm setup guides.
  • Include supporting Docker, Terraform, Helm, and helper script examples while excluding local secrets and generated Terraform state.
  • Add the new Cloud Agents example to the cookbook README.

Test plan

  • Ran git diff --check origin/main...HEAD.
  • Scanned copied files for common secret patterns; matches are placeholders only.

Made with Cursor


Note

Medium Risk
Adds substantial new Terraform/Lambda and Kubernetes/Helm automation that provisions AWS infrastructure and manipulates ECS desired count; main risk is misconfiguration or unexpected cloud cost/permission scope rather than changes to existing runtime code.

Overview
Adds a new cloud-agent/ lab documenting and automating self-hosted Cursor Cloud Agent workers on customer-managed AWS infrastructure (EC2+Docker, ECS/Fargate, and EKS+Helm).

Includes a shared worker Docker image + entrypoint, example labels, a Makefile for local build/ECR publish and deployment helpers, and ignore rules to keep .env, credentials, and Terraform state out of git.

Provides Terraform scaffolds for EC2 (ECR + Secrets Manager + IAM + SSM-accessible instance bootstrap) and ECS/Fargate (ECS service + CloudWatch logs + Application Auto Scaling driven by a scheduled Lambda metrics publisher that computes service-scoped worker utilization). Adds Helm manifests/scripts for EKS using Cursor’s worker-set controller plus an optional Prometheus/CronJob-based autoscaler. Updates the root README.md to link the new lab.

Reviewed by Cursor Bugbot for commit 02452a3. Bugbot is set up for automated code reviews on this repo. Configure here.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread cloud-agent/ec2/terraform/main.tf Outdated
Comment thread cloud-agent/ecs/terraform/metrics_publisher.py
Comment thread cloud-agent/ecs/terraform/metrics_publisher.py Outdated
cursoragent and others added 2 commits May 15, 2026 15:54
The data block was declared but never referenced in locals, resources,
outputs, or user_data template, causing an unnecessary STS API call on
every plan/apply.

Co-authored-by: Hassan Saab <hsaab@users.noreply.github.com>
The connected == 0 early-return path only applied min_capacity but not
max_capacity, unlike the normal path. If desired count exceeded max_capacity
(e.g. manual adjustment), RecommendedCapacity and scale-out could propagate
the uncapped value.

Co-authored-by: Hassan Saab <hsaab@users.noreply.github.com>
@hsaab
Copy link
Copy Markdown
Author

hsaab commented May 15, 2026

@ericzakariasson ready for your review when you get a moment!

Use boundary-aware token matching instead of plain substring checks
when correlating Cursor workers to ECS task private IPs. Prevents
10.0.1.2 from matching ip-10-0-1-20.ec2.internal or 10.0.1.20,
which inflated Connected counts and suppressed UtilizationPercent.

Co-authored-by: Hassan Saab <hsaab@users.noreply.github.com>
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high mode and found 2 potential issues.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 02452a3. Configure here.

Comment thread cloud-agent/ec2/terraform/user_data.sh.tpl
Comment thread cloud-agent/ecs/terraform/metrics_publisher.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants