Skip to content

idle-shutdown: wake Lambda IAM policy limits ec2:DescribeInstanceStatus to one instance ARN #129

Closed

Description

@royosherove

In install-idle.sh L236-237 the wake Lambda policy is:

{"Effect":"Allow","Action":["ec2:StartInstances","ec2:DescribeInstanceStatus"],
 "Resource":"arn:aws:ec2:${REGION}:${ACCT_ID}:instance/${INSTANCE_ID}"}

Problem: EC2 Describe* actions do not support resource-level permissions. They match only "Resource": "*". The call at wake-lambda/index.mjs L82 then gets AccessDenied, and the handler goes to its error path (L87). The wake link can fail before it starts the instance.

Fix: Put ec2:DescribeInstanceStatus in a separate statement with "Resource": "*". Keep ec2:StartInstances limited to the instance ARN.


Found by a code read at commit 1e50295. The code was read, but not run on a real instance.

Activity

  1. royosherove commented on Oct 11, 2026

    @royosherove
    MemberAuthor

    👻 Drew is on this · Kiro Crew Issue Radar
    awaiting-merge · PR #139 · updated 12:37 UTC

    Finding: The report is correct. In bootstraps/optional/idle-shutdown/install-idle.sh (lines 235-238 at 1e50295), the wake Lambda inline policy gives ec2:DescribeInstanceStatus only on the instance ARN. EC2 Describe* actions do not support resource-level permissions, so they match only "Resource": "*". Thus the call in wake-lambda/index.mjs line 82 gets AccessDenied and the handler goes to its error path (line 87) before StartInstances (line 110). The notify Lambda policy in the same file (line 221) already uses "Resource": "*" for its Describe actions. No open or closed PR changes this policy (open PRs #71, #125, #126 do not touch install-idle.sh).

    Fix (PR #138): ec2:DescribeInstanceStatus is now in its own statement with "Resource": "*". ec2:StartInstances stays limited to the instance ARN. The new test tests/test-idle-wake-policy.sh reads the policy from the script and checks both statements. It fails on main (1 of 6 checks) and passes with the fix (6 of 6). Existing installs get the new policy when install-idle.sh runs again. I did not run the installer against a real AWS account. PR #138 is merged. A Codex review on #138 found that the test accepted any ec2:Describe* action; that test fix is in follow-up PR #139, because #138 merged before the commit was pushed.

    progress
  2. added a commit that references this issue on Oct 11, 2026
    2a0f08f
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

    bugSomething isn't workingcrew: in progressIssue Radar work claimed by a Kiro Crew workergood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions