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
{{ message }}
Repository navigation
REAPER_GRACEFUL cannot work cross-account: the spawn-ttl-reaper-ec2 role grants no ssm: actions #652
Noted during #625 and deferred; filing now with the grant sets confirmed.
The gap
REAPER_GRACEFUL=true makes the reaper attempt an in-guest graceful shutdown before terminating, via SSM (ssm:SendCommand + ssm:GetCommandInvocation). In cross-account mode — which is the production configuration (ScanSelf=false, RoleArns=arn:aws:iam::435415984226:role/spawn-ttl-reaper-ec2) — those calls run under the assumed role, and that role grants no ssm: actions at all.
No ssm:*. Compare the Lambda's own execution role, which #625 fixed to include ssm:SendCommand/ssm:GetCommandInvocation — that covers ScanSelf mode only.
So the asymmetry is now inverted from what #625 fixed: scan-self has the SSM grants and cross-account does not.
Impact, stated carefully
Low today, because REAPER_GRACEFUL is off in production — the live stack has no Graceful parameter and the function logs graceful=false. Nothing is currently broken.
It is a trap rather than an outage: enabling REAPER_GRACEFUL in the documented cross-account deployment would fail at the SSM call. Worth knowing whether it then falls back to a hard terminate (acceptable) or aborts the reap entirely (not acceptable — an instance past its TTL would survive, which is the one thing the reaper exists to prevent). That fallback behaviour should be checked before adding the grant, because if it aborts, the missing grant is currently masking a worse bug.
Fix
Add the two actions to ttl-reaper-cross-account-role.yaml, scoped as tightly as SSM allows — and ideally source them from pkg/reaperiam the way the Lambda's own policy now does, so the two roles cannot drift again. That package already exists for exactly this reason:
pkg/reaperiam is now the single source for this set, with a test that reads the reaper's own *API interfaces and fails if a call has no grant.
That test covers the scan-self statements. It does not cover the cross-account CFN template, which is why this gap survived #625 — so the fix should extend the drift gate to both roles, not just add a line to one YAML file.
Related: #625 (the scan-self half), #650 (the deploy-defaults hazard found in the same area).
Activity
fix(reaper): grant ssm: on the cross-account role so REAPER_GRACEFUL …
chore(release): v0.117.0
fix(reaper): ssm:SendCommand needs ssm:resourceTag, not ec2:ResourceT…
Scope the in-account reaper's ssm:SendCommand grant (#829)