Skip to content

REAPER_GRACEFUL cannot work cross-account: the spawn-ttl-reaper-ec2 role grants no ssm: actions #652

Closed

Description

@scttfrdmn

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.

deployment/cloudformation/ttl-reaper-cross-account-role.yaml grants exactly:

ec2:DescribeInstances
ec2:DescribeTags
ec2:TerminateInstances   (tag-conditioned)
fsx:DescribeFileSystems
fsx:DeleteFileSystem

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

  1. added a commit that references this issue on Oct 4, 2026
    9b989d1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions