You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
run-on-ec2: make the shared ssh key robust to concurrent/overlapping runs
The shared bench keypair must outlive every box that uses it, but two paths
deleted it based only on 'did THIS invocation create it', which is wrong when
runs overlap:
- teardown deleted the keypair + local .pem whenever CREATED_KEY=1. A creator
that finishes before a concurrent reuser's boxes thus rugged their ssh/rsync
mid-grid ('Permission denied (publickey)'). Observed 2026-08-21: a 6-cell
aisix run created the key; a 36-cell busbar run reused it; aisix finished
first and its teardown orphaned the still-measuring busbar box. Now the key
is deleted only when NO other bench box is still alive.
- the launch-time rebuild regenerated the keypair on local/AWS mismatch, minting
a new public key that already-running boxes don't trust. Now, when boxes are
live and we hold the local private key, it re-imports that key's public half
instead of regenerating, so new boxes match the running ones.
'run-on-ec2.sh kill' remains the global sweep. A leaked key costs nothing; a
deleted one costs a whole grid.
echo"[key] other bench boxes still running ($(echo $_live_others| tr '\n''')) - keeping shared key $KEYNAME durable; \`run-on-ec2.sh kill\` sweeps it once they are done">&2
601
+
fi
602
+
fi
584
603
if [[ "$CREATED_SG"== 1 ]];then
585
604
# The just-terminated instances are `shutting-down`, not `running/pending`, but they STILL hold
586
605
# ENI associations to this SG for a short window - so an IMMEDIATE delete-security-group fails with
if [[ -s"$KEYFILE"&&-n"$_aws_keyid"&&"$_local_keyid"!="$_aws_keyid" ]];then
625
644
echo"[key] local key does not correspond to AWS keypair $KEYNAME (recorded '${_local_keyid:-none}' vs live '$_aws_keyid') - rebuilding both, or every box would refuse it"
echo"[key] $KEYNAME missing/mismatched but bench boxes are live - re-importing the local key's public half so their ssh keeps working (not regenerating)"
0 commit comments