Skip to content

fix(ssm): key getParameters results by requested name so ARN lookups work - #5596

Open
RamonGal wants to merge 1 commit into
github-aws-runners:mainfrom
RamonGal:fix/ssm-get-parameters-arn-lookup
Open

RamonGal wants to merge 1 commit into
github-aws-runners:mainfrom
RamonGal:fix/ssm-get-parameters-arn-lookup

Conversation

@RamonGal

@RamonGal RamonGal commented Nov 17, 2026 •

Copy link
Copy Markdown

Description

Fixes the scale-up Lambda failing with Parameter arn:aws:ssm:us-east-1:111111111111:parameter/github-runners/app/id not found when the GitHub App SSM parameters live in another account and are shared through RAM, so the module is configured with their ARNs.

Use case

Self-hosted runners run in a VPC so that jobs can reach a private EKS API endpoint. One GitHub App serves several clusters, so its credentials live in one central account and are shared with each cluster account through AWS RAM. Each cluster account deploys this module and passes the shared parameter ARNs in github_app.

flowchart LR
    GH["GitHub App<br/>workflow_job webhook"] --> WH

    subgraph SHARED["Central account"]
        PARAMS[("SSM parameters<br/>App id, private key, webhook secret")]
        RAM{{"RAM share"}}
        PARAMS --- RAM
    end

    subgraph CLUSTER["Cluster account, runner module"]
        WH["Webhook Lambda<br/>reads one parameter"]
        SQ[["Build queue"]]
        SU["Scale-up Lambda<br/>GetParameters by ARN"]
        WH --> SQ --> SU
        subgraph VPC["VPC, private subnets"]
            RUN["Self-hosted runner<br/>EC2"]
            EKS["EKS cluster<br/>private API endpoint"]
            RUN -->|"kubectl, helm, terraform"| EKS
        end
        SU -->|"launches"| RUN
    end

    RAM -. "shared with cluster account" .-> WH
    RAM -. "shared with cluster account" .-> SU
    SU == "App id and private key by ARN: Name returned is the plain name, lookup by ARN misses" ==> PARAMS
Loading

Without the App credentials the scale-up Lambda cannot create a registration token or JIT config, so no runner starts and jobs that need the private cluster wait forever. The webhook Lambda is not affected because it reads a single parameter and uses its value directly.

Affects module v8.1.0 and v8.1.1 (same code). The batch GetParameters call comes from #5017; v7.11.0 already uses the batch call.

Cause: getParameters keyed its result by the Name field of each returned parameter. For an ARN request SSM returns the plain name (/github-runners/app/id) in Name and the full ARN in ARN, so parameters.get(<ARN>) in the credentials store missed. It is not a permissions problem: the RAM share is active, CloudTrail shows a successful kms:Decrypt by the scale-up role, and get-parameters returns the plain Name with no InvalidParameters.

Fix: in lambdas/libs/aws-ssm-util/src/index.ts, getParameters now keys the map by the requested strings. A returned parameter matches a requested entry when the entry equals its Name or ARN. Matching is per 10-name chunk, duplicates do not change the result, and requested entries SSM does not return (missing or InvalidParameters) stay absent. Parameters with an empty Value stay omitted, as before. Callers are unchanged; this also fixes the matcher config store, ami-housekeeper and the scale-set parameter store, which all look results up by the requested name. getParameter (Powertools) already works with ARNs.

Test Plan

  • Added tests in lambdas/libs/aws-ssm-util/src/index.test.ts: ARN request, mixed names and ARNs, missing/invalid entries, duplicates, chunking (12 names with ARNs, reversed response order), empty value.
  • Added lambdas/libs/storage-providers/aws/ssm/github-app-credentials-store.arn.test.ts: real getParameters with the SSM client mocked, ARNs in PARAMETER_GITHUB_APP_ID_NAME and PARAMETER_GITHUB_APP_KEY_BASE64_NAME. The new ARN tests fail on main and pass on this branch.
  • yarn format-check, yarn lint, yarn test and yarn build pass from lambdas/.

Related Issues

Fixes #5595

🤖 Generated with Claude Code

…work

SSM GetParameters returns the plain parameter name even when an ARN was
requested, so lookups by ARN (cross-account parameters shared through RAM)
missed and the GitHub App credentials store failed with "not found".
Map each returned parameter back to the requested entry that equals its
Name or ARN.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@RamonGal
RamonGal marked this pull request as ready for review November 17, 2026 00:44
@RamonGal
RamonGal requested a review from a team as a code owner November 17, 2026 00:44

This branch has not been deployed

No deployments
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.

scale-up fails with "Parameter <arn> not found" for GitHub App parameters shared across AWS accounts (batch getParameters keys by returned Name)

1 participant