Skip to content

fix(lightsail): derive Remote Control name from the public host - #156

Open
defangdevs wants to merge 1 commit into
masterfrom
fix/lightsail-remote-control-host
Open

fix(lightsail): derive Remote Control name from the public host#156
defangdevs wants to merge 1 commit into
masterfrom
fix/lightsail-remote-control-host

Conversation

@defangdevs

Copy link
Copy Markdown
Owner

Problem

aws/lightsail-template.yaml hardcoded the Remote Control session name:

remoteControlName = "${UserName}@${StackName}";

Two issues with that:

  1. The name shown in the Claude apps was the CloudFormation stack name, which says nothing about how to reach the box.
  2. remoteControlName is a per-user option, so it pinned one name across every session that user runs. Sessions added at runtime all collided on the same label.

The EC2 template already does the right thing (aws/template.yaml:634), so this was Lightsail-only drift.

Fix

Drop the hardcoded name and set remoteControlHost = hostname at the services.agent-box level, mirroring EC2. The module then derives <user>-<session>@<host> per session, where <host> is the sslip.io address the box is actually reached at.

Before → after, for stack my-box at 1.2.3.4:

name in Claude apps
before agent@my-box
after agent-main@1-2-3-4.sslip.io

Three coupled edits fall out of it:

  • RemoteControlSession Output advertised the old shape, so it moves in lockstep. It uses the same dashed-IP form the userdata bakes into hostname (tr . -) and that WebUrl already reports — verified the two agree.
  • Fn::Sub StackName variable is now unreferenced in the userdata, so it is removed.
  • UserName parameter description mentioned the old <user>@<stack> shape.

Also here

README.md:43 documented <UserName>@<stack name> for the EC2 walkthrough. That has been stale since aws/template.yaml started setting remoteControlHost — it is corrected in the same pass since it is the identical claim.

Verification

  • yamllint parses the template clean (with key-duplicates enabled).
  • hostname is in scope where remoteControlHost now reads it — same let block, aws/lightsail-template.yaml:368.
  • Grepped for any remaining ${StackName} reference inside the Fn::Sub: none.

Not deploy-tested — I have no Lightsail stack to launch, and the change is in userdata that only runs on first boot. Worth a real launch before merge if you want the Output confirmed end-to-end.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PsqGhkpjsb4kKAdVz25xKN

The Lightsail template hardcoded remoteControlName = "<user>@<stack>",
so the entry in the Claude apps named the CloudFormation stack — which
says nothing about how to reach the box — and pinned one name for every
session the user runs, since remoteControlName is per-user rather than
per-session.

Drop it and set remoteControlHost = hostname instead, mirroring
aws/template.yaml. Sessions are then identifiable as
"<user>-<session>@<host>", where <host> is the sslip.io address the box
is actually reached at, and runtime-added sessions get distinct names.

The stack Output moves in lockstep (it advertised the old name), using
the same dashed-IP form the userdata bakes into the hostname and that
WebUrl already reports. The Fn::Sub StackName variable is now unused,
so it goes too.

README's EC2 walkthrough claimed the same <UserName>@<stack name> shape;
that has been stale since aws/template.yaml started setting
remoteControlHost, so it is corrected here as well.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PsqGhkpjsb4kKAdVz25xKN
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